This document describes the environment variables and local configuration needed to run each app in this monorepo.
Copy apps/api/.env.example to apps/api/.env:
| Variable | Description | Example |
|---|---|---|
PORT |
Port the API listens on | 4000 |
DATABASE_URL |
PostgreSQL connection string used by Prisma | postgresql://postgres:postgres@localhost:5432/qyou?schema=public |
JWT_SECRET |
Secret used to sign access tokens | a long random string |
JWT_EXPIRES_IN |
Access token lifetime (jsonwebtoken expiresIn format) |
1h |
All of these have safe development defaults baked into src/shared/config/env.ts, so the API
and its tests run without a .env file. A real DATABASE_URL is only required to run the API
against PostgreSQL (e.g. npm run dev -w @qyou/api) — the auth tests use an in-memory
repository and need no database.
Copy apps/web/.env.example to apps/web/.env.local:
| Variable | Description | Example |
|---|---|---|
NEXT_PUBLIC_API_URL |
Base URL of apps/api |
http://localhost:4000 |
Copy apps/mobile/.env.example to apps/mobile/.env:
| Variable | Description | Example |
|---|---|---|
EXPO_PUBLIC_API_URL |
Base URL of apps/api (reserved for future mobile auth work) |
http://localhost:4000 |
apps/api uses Prisma with PostgreSQL. To run the API against a real database:
- Start a local PostgreSQL instance and set
DATABASE_URLaccordingly. - From
apps/api, runnpx prisma migrate devto create theuserstable.
.env*files are gitignored — never commit real secrets..env.examplefiles document required variables with safe placeholder values only.- Use a long, randomly generated
JWT_SECRETin any shared, staging, or production environment.
- If a required variable is missing and has no default, Zod validation in
src/shared/config/env.tsthrows a clear error at startup. The API will not start until the variable is set. - Variables with safe defaults (see table above) allow the API to start without a
.envfile for development and testing. Override them in.envwhen connecting to real services. - The test suite uses an
InMemoryAuthRepositoryand never readsDATABASE_URL, so tests pass without a running PostgreSQL instance.
Run the env validation script to check that .env.example files are consistent and documented:
npm run validate:envThis script checks:
- Every variable in
.env.exampleis documented indocs/SETUP.md - No placeholder values (e.g.,
change-me) are used without a clear documentation note - No duplicate values across variables within the same file