Environment
Install the toolchain, create the environment file, and every variable the app reads.
Install the toolchain
Install Node.js 22.12 or newer, then enable Corepack and install pnpm dependencies from the repository root:
corepack enable
pnpm installThe root package.json pins pnpm 10.9.0 through its packageManager field. Use a compatible pnpm 10 release if Corepack is not available.
If pnpm reports that it ignored a package build script needed by your environment, review the package name and approve only the required dependency with pnpm approve-builds.
With the FastAPI API, also install uv. The API needs Python 3.12 (apps/api/.python-version), which uv downloads when it isn't installed. The CLI runs uv sync in apps/api after pnpm install; in a fresh clone, the API's scripts run through uv run, which installs its dependencies on first use. Each module option has its own dependency group in apps/api/pyproject.toml: every project keeps the same uv.lock, development installs every group, and the production image only those of your modules.
Create the environment file
Projects generated by the CLI already have apps/web/.env.local. Otherwise, copy the example:
cp .env.example apps/web/.env.localWith a separate API, the CLI creates two files: apps/web/.env.local for the React + Vite frontend, from .env.example, and apps/api/.env.local for the API, from apps/api/.env.example. The API owns the database and the modules, so DATABASE_URL and the modules' variables, such as REDIS_URL, SMTP_URL, or STRIPE_SECRET_KEY, go in the API's file. The database commands read it there.
With a mobile app, the CLI also creates apps/shell/.env.local, from apps/shell/.env.example. It holds WEB_URL, the deployed website's https:// address, which the app calls. The app's build also reads apps/web/.env.local, and the values in apps/shell/.env.local win.
With the native app, the CLI also creates apps/mobile/.env.local, from apps/mobile/.env.example. Expo builds its EXPO_PUBLIC_* values into the app, so they are public:
| Variable | Needed for | Details |
|---|---|---|
EXPO_PUBLIC_API_URL | Release builds, and a phone in development | Where the app sends its requests: the website's address, or the API's without a website. Blank in development, it means this computer's dev server, which the Android emulator reaches at 10.0.2.2 and the iOS simulator at localhost. |
EXPO_PUBLIC_DEV_SERVER_PORT | Without a website | The port of that dev server: 3001, the API's. With a website, it is 3000. |
EXPO_PUBLIC_SUPABASE_URL, EXPO_PUBLIC_SUPABASE_PUBLISHABLE_KEY | Supabase Auth | The same project's settings as the website's, or the API's without a website. Sign-in |
In a project without a website, there is no apps/web/.env.local: apps/api/.env.local holds every variable, with HOST=0.0.0.0 so that a phone on the same network reaches the API in development. With Better Auth, which then runs in the API, it also holds BETTER_AUTH_SECRET (at least 32 characters, which pnpm check:env checks) and BETTER_AUTH_URL, the API's public URL: http://localhost:3001 in development.
The example points at your local services and leaves provider keys blank, so the app builds and starts before anything is configured. Without local services, set at least DATABASE_URL:
DATABASE_URL=postgres://user:password@host:5432/appVariables
A project only contains the variables of the modules it uses. Next.js and TanStack Start name a few of them differently, and React + Vite splits them between the frontend and the API:
| Variable | Needed for | Details |
|---|---|---|
DATABASE_URL | Required | PostgreSQL connection URL, such as a Supabase transaction pooler URL. |
NEXT_PUBLIC_APP_URL | Recommended | The app's origin. Defaults to http://localhost:3000. |
NEXT_PUBLIC_SUPABASE_URL, NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY | Supabase Auth | Authentication |
CLIENT_IP_HEADER, TRUSTED_PROXY_HOPS | Rate limits in production | Where the client's address is for your host (Starter v0.27.0 or newer): Client addresses |
With Next.js and TanStack Start, the rest are the same for both frameworks. With React + Vite, the module variables are the API's:
| Variable | Needed for | Details |
|---|---|---|
DATABASE_URL_DIRECT | Optional | Pooled and direct connections |
SUPABASE_SECRET_KEY | Account deletion (Supabase) | Authentication |
BETTER_AUTH_SECRET | Better Auth | Authentication |
BETTER_AUTH_REQUIRE_EMAIL_VERIFICATION | Better Auth with email (optional) | Authentication |
FIREBASE_PROJECT_ID, FIREBASE_API_KEY | Firebase | Authentication |
FIREBASE_CLIENT_EMAIL, FIREBASE_PRIVATE_KEY | Firebase in production (the service account) | Authentication |
FIREBASE_AUTH_EMULATOR_HOST | Firebase in development only | Authentication |
APPWRITE_ENDPOINT, APPWRITE_PROJECT_ID, APPWRITE_API_KEY | Appwrite | Authentication |
REDIS_URL | Redis (optional) | Cache and rate limits |
SMTP_URL, EMAIL_FROM | SMTP email | |
RESEND_API_KEY, EMAIL_FROM | Resend email | |
STORAGE_BUCKET, STORAGE_REGION, STORAGE_ENDPOINT, STORAGE_ACCESS_KEY_ID, STORAGE_SECRET_ACCESS_KEY, STORAGE_PUBLIC_URL | S3-compatible storage | File storage |
STORAGE_DIRECTORY | S3-compatible storage in a local folder (--infra local) | File storage |
SUPABASE_STORAGE_BUCKET | Supabase Storage | File storage |
STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET, STRIPE_PRICE_<PLAN> | Payments | Payments |
JOBS_WORKER, CRON_SECRET | pg-boss or BullMQ (optional) | Background jobs |
INNGEST_DEV, INNGEST_EVENT_KEY, INNGEST_SIGNING_KEY | Inngest | Background jobs |
OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS, OTEL_SERVICE_NAME | OpenTelemetry | Observability |
SENTRY_DSN, SENTRY_ENVIRONMENT, SENTRY_TRACES_SAMPLE_RATE | Sentry | Observability |
SENTRY_AUTH_TOKEN, SENTRY_ORG, SENTRY_PROJECT | Sentry source maps, at build time only | Observability |
DATABASE_URL must be a non-empty string for server environment validation. If you are only exploring the UI, a local placeholder URL works, but database operations fail until it points to a real PostgreSQL database.
Start the app
pnpm devThe app is available at http://localhost:3000, the liveness endpoint at /api/health, and the readiness endpoint, which also checks the database, at /api/ready.
With a separate API, pnpm dev starts the API too, on port 3001. The frontend forwards /api to it, so /api/health and /api/ready on port 3000 answer from the API. Without a website, pnpm dev starts the API alone: its liveness endpoint is http://localhost:3001/api/health.
How is this guide?