Skip to content

mattrabe/plannting

Repository files navigation

Plannting

An app for scheduling fertilizer feedings and other landscaping and property care chores.

This monorepo contains a TypeScript+Express API application and a TypeScript+Expo React Native mobile application.

Structure

plannting/
├── apps/
│   ├── api/          # Express.js API server
│   └── mobile/       # Expo React Native mobile application
└── package.json      # Root workspace configuration

Getting Started

Install Dependencies

# Install all dependencies for the entire monorepo
npm run install

Development

Run All Apps Simultaneously

npm run dev

Run Individual Apps

API Server (Express.js)

npm run dev:api

Mobile App (Expo)

npm run dev:mobile

Building

Build API Server

npm run build:api

Build Mobile App

Create a new Development Build in EAS
npm run build:mobile:development-build
Push an Update to Development Builds in EAS
npm run build:mobile:update
Build for production or TestFlight
npm run build:mobile

Other Commands

# Check dependencies for compatibility
npm run doctor

# Lint apps
npm run lint

Tests

  • Run all tests: npm run test
  • Run api tests: npm run test:api (npm run test:api:watch to watch changes)
  • Run mobile tests: npm run test:mobile (npm run test:mobile:watch to watch changes)

E2E tests (Cypress)

  • Run all e2e tests headless: npm run test:e2e
  • Run single e2e test headless: npm run test:e2e:start-servers:wait, in second window: npm run cypress:run -- --spec "**/*your-test-file-name-glob*"
  • Open interactive runner: npm run cypress:open

These commands boot a test API at http://localhost:3050 using an in-memory MongoDB (via mongodb-memory-server), wait for /health, then run Cypress specs from cypress/e2e/**.

Applications

API Server (apps/api)

  • Framework: Express.js with TypeScript
  • Database: MongoDB
  • Features:
    • RESTful API endpoints
    • tRPC endpoints

Mobile App (apps/mobile)

  • Framework: Expo with React Native
  • Data Fetching: TanStack Query

Development Notes

  • The API server runs on http://localhost:3000 by default
  • The mobile app connects to the API server at http://localhost:3000
  • For testing on physical devices, you may need to use your computer's IP address instead of localhost
  • All apps use TanStack Query for data fetching with automatic caching and background updates
  • The shared package ensures type consistency between all applications
  • The API server handles all database connections and business logic

Verbose debug logging

Verbose debug logging is facilitated by the debug package, and is turned off by default.

Many 3rd party packages utilize the debug package.

To enable verbose logging, set the DEBUG (or EXPO_PUBLIC_DEBUG for mobile) variable to include the namespace(s) that you want verbose logging for.

Examples:

In apps/api/.env:

  • Everything: DEBUG=* (noisy!)
  • App: DEBUG=app:*
  • App Endpoints: DEBUG=app:endpoints
  • Router: DEBUG=router

In apps/mobile/.env:

  • Everything: EXPO_PUBLIC_DEBUG=* (extremely noisy!)
  • App: EXPO_PUBLIC_DEBUG=app:*

Deploying

This app is deployed using Vercel automatically, any time a PR is merged into the main branch.

See Vercel project here: https://vercel.com/matt-rabe/plannting-api

Scripts Reference

Command Description
npm run dev Run all apps (API on :3000, mobile)
npm run dev:api Run only the API server (port 3000)
npm run dev:mobile Run only the mobile app
npm run build Build API and apps
npm run build:api Build the API server
npm run build:mobile Build the mobile app
npm run build:mobile:development-build Create a development build using EAS
npm run build:mobile:update Ship an update to the development build
npm run start Start production API (port 3000) server
npm run start:api Start production API server (port 3000)
npm run doctor Check dependencies for mobile expo app

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published