Setup

Prerequisites

Environment variables

Copy .env.example to .env and fill in the values for:

OAuth callback allowlist

AUTH_REDIRECT_URLS adds comma-separated exact client callback URLs to the server’s built-in allowlist. The production defaults are https://3spinningplates.com/auth/callback, https://www.3spinningplates.com/auth/callback, threeplates://auth/callback, and legacy threeplates://auth-finished. Queries, fragments, and embedded credentials are rejected. This setting controls the client return location; AUTH_BASE_URL controls the API callback URL registered with Google and Apple and does not implicitly authorize a client redirect.

For another web hostname, add its exact /auth/callback URL. For Expo Go, add the exact callback for the trusted development host, for example AUTH_REDIRECT_URLS=exp://192.168.1.10:8081/--/auth/callback. Local web callbacks at http://localhost:8081/auth/callback and http://localhost:3000/auth/callback are built in only outside production. Restart the API after changing this environment variable. Do not use wildcards.

Local development

  1. Install dependencies with pnpm install.
  2. Start Postgres and apply migrations with pnpm db:setup.
  3. Start the backend with pnpm dev:api.
  4. Start the Expo app with pnpm dev:mobile.
  5. Open the app in web, Android, or iOS as needed.

Hosted native auth smoke test

Check out the commit you want to test. Use an Expo project with access to Expo Simulators and export its ID as EXPO_PUBLIC_EAS_PROJECT_ID. Sign in to EAS CLI before building or starting a session.

For Android, build an x86_64 APK from the repository root with the Android SDK and JDK configured:

ORG_GRADLE_PROJECT_reactNativeArchitectures=x86_64 pnpm --filter @3plates/mobile build:android:production
cd apps/mobile
npx --yes eas-cli@27.11.0 simulator:start --platform android --type agent-device --max-duration-minutes 20 --no-force --non-interactive
npx --yes eas-cli@27.11.0 simulator:exec npx --yes agent-device@0.21.41 install com.christitustech.threeplates ./dist/3plates-android-production.apk --platform android
pnpm test:simulator:auth android
npx --yes eas-cli@27.11.0 simulator:stop --non-interactive

For iOS, run the simulator build from apps/mobile and use its build ID when starting the session:

npx --yes eas-cli@27.11.0 build --platform ios --profile ios-preview --non-interactive
npx --yes eas-cli@27.11.0 simulator:start --platform ios --type agent-device --build-id "$IOS_BUILD_ID" --open-url 'threeplates://auth/callback' --max-duration-minutes 20 --no-force --non-interactive
pnpm test:simulator:auth ios
npx --yes eas-cli@27.11.0 simulator:stop --non-interactive

The smoke test verifies that missing and unsolicited callback parameters are rejected, and checks the browser handoff for Google, Apple, and WHOOP. Use the default Android Expo emulator image, which includes Chrome. Screenshots go to apps/mobile/test-results/expo-auth/. Stop the session even if the test fails. Complete provider sign-in with a dedicated test account when testing live OAuth end to end.

Database setup

  1. The repo ships with docker-compose.yml for a local Postgres 16 instance.
  2. The container binds to 127.0.0.1:${POSTGRES_PORT} so it is not exposed beyond the host.
  3. The Drizzle migrations in packages/db/drizzle/ create both the schema and the pgcrypto prerequisite for UUID generation.
  4. Generate new migration SQL with pnpm db:generate after changing packages/db/src/schema.ts.
  5. Apply migrations with pnpm db:migrate.
  6. pnpm db:setup combines container startup and migration application for normal local use.
  7. Use pnpm db:reset to recreate the database volume and replay migrations from scratch.
  8. Use pnpm db:test after the API is running to validate container health, migration state, and a persisted API round-trip.

VPS recreation

Use VPS Setup Checklist for a full rebuild and validation pass.

The database rule is fixed for the current scaffold: keep Postgres bound to 127.0.0.1 and keep DATABASE_URL pointed at localhost when the API runs on the VPS host. If the API later moves into Docker on the same compose network, remove the published Postgres port and connect to the postgres service name instead.

Track remaining VPS and website validation work in VPS And Website Tasks.

GitHub Pages setup

  1. In the GitHub repository, open Settings.
  2. Open Pages.
  3. Set Source to GitHub Actions.
  4. Keep .github/workflows/jekyll-gh-pages.yml enabled on main.
  5. The workflow builds Jekyll from ./docs, uploads ./_site, and deploys to GitHub Pages.
  6. Confirm the latest Pages workflow run succeeds and the docs site loads.

Publishing rule

Validation dependency compatibility

The shared contract, API and mobile client use Zod 4.6.7 or newer. This includes the constrained-collection resource exhaustion fix. Paginated workout responses cap arrays at the existing 50-item page limit so oversized pages fail before individual entries are validated.

@ts-rest/core is pinned to 3.53.0-rc.1, the upstream release candidate that officially supports Standard Schema and Zod 4. This is an intentional prerelease dependency: stable 3.52.x requires vulnerable Zod 3. Before changing the pin, run workspace typechecks and tests, Expo exports for all platforms, and the dependency audit. No audit finding is suppressed.