Skip to content

Environment Variables


API (apps/api/)

These are read via NestJS ConfigService (config.get('VAR')) or directly via process.env['VAR'].

Required

VariableExampleDescription
DATABASE_URLpostgresql://...Prisma connection string (PgBouncer pooled URL)
JWT_SECRET<random 64-char hex>HS256 signing secret for access + refresh tokens
NODE_ENVproductionControls dev-only behaviour (media sink, error details)
VariableExampleDescription
ANTHROPIC_API_KEYsk-ant-...Claude Sonnet access; falls back to scripted questions if absent
CENTRIFUGO_URLhttp://centrifugo:8000Internal Centrifugo HTTP API URL
CENTRIFUGO_API_KEY<secret>Centrifugo API key for server-to-server publish
CENTRIFUGO_PUBLIC_URLwss://rt.rgls.ukPublic WebSocket URL (exposed to clients)
RESEND_API_KEYre_...Resend email API key; if absent, emails are logged only
APP_URLhttps://rgls.ukBase URL for email deep links
API_PUBLIC_URLhttps://api.rgls.ukExposed in CORS + link-preview allowlist
ALLOWED_ORIGINShttps://rgls.uk,https://admin.rgls.ukComma-separated CORS origins
API_PORT3000HTTP port (default 3000)

Storage (Cloudflare R2)

VariableExampleDescription
R2_ACCOUNT_IDabc123...Cloudflare account ID
R2_ACCESS_KEY_ID<key>R2 S3-compatible access key
R2_SECRET_ACCESS_KEY<secret>R2 secret
R2_BUCKETregulus-mediaR2 bucket name
R2_PUBLIC_HOSThttps://media.rgls.ukPublic CDN URL for committed assets

Observability

VariableExampleDescription
SENTRY_DSNhttps://[email protected]/...Sentry error tracking
SENTRY_RELEASEv1.2.3Release identifier for source maps
SENTRY_TRACES_SAMPLE_RATE0.1Tracing sample rate (0..1)

Source maps: after pnpm --filter @regulus/api build, run pnpm --filter @regulus/api sentry:sourcemaps on deploy with SENTRY_AUTH_TOKEN, SENTRY_ORG, SENTRY_PROJECT set in the environment. The release defaults to the current git SHA when SENTRY_RELEASE is unset — keep it identical to the runtime SENTRY_RELEASE so traces de-minify.


Mobile (apps/mobile/)

All variables must be prefixed with EXPO_PUBLIC_ to be embedded in the JS bundle. Set in .env.local or EAS secrets.

VariableExampleDescription
EXPO_PUBLIC_API_URLhttps://api.rgls.uk/api/v1Base URL for all API calls
EXPO_PUBLIC_POSTHOG_API_KEYphc_...PostHog analytics key
EXPO_PUBLIC_SENTRY_DSNhttps://[email protected]/...Sentry mobile DSN

Source maps: the @sentry/react-native/expo config plugin uploads maps during EAS builds. It activates only when SENTRY_ORG + SENTRY_PROJECT are set (see eas.json build profiles) and reads the auth token from the SENTRY_AUTH_TOKEN EAS secret: eas secret:create --scope project --name SENTRY_AUTH_TOKEN --value <token>.


Admin (apps/admin/)

No build-time env vars required. The admin panel resolves the API URL at runtime:

  • Dev: Vite proxy forwards /apilocalhost:3001 (configured in vite.config.ts).
  • Prod: Hardcoded https://api.rgls.uk in apps/admin/src/lib/api.ts.

To override the production API URL, edit PROD_API in apps/admin/src/lib/api.ts.

Optional documentation site URL (used by the Docs page):

VariableDefaultDescription
VITE_DOCS_URLhttps://docs.regulus.appVitePress docs site URL embedded in admin iframe
VITE_SENTRY_DSN(unset)Sentry DSN for the admin SPA. No-op when blank
VITE_SENTRY_RELEASE(unset)Optional release id surfaced to Sentry

Source maps: when SENTRY_AUTH_TOKEN, SENTRY_ORG, SENTRY_PROJECT are present at build time, vite build auto-injects debug IDs and uploads maps via @sentry/vite-plugin. With any of them missing the build proceeds and simply skips the upload.


Local Development

Copy .env.example.env in apps/api/:

bash
cp apps/api/.env.example apps/api/.env
# Fill in DATABASE_URL and JWT_SECRET at minimum
pnpm dev

Minimum viable .env for local dev (no AI, no email, no real-time):

dotenv
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/regulus"
JWT_SECRET="dev-secret-change-in-production-use-64-random-hex-chars"
NODE_ENV="development"

With Anthropic AI and email:

dotenv
DATABASE_URL="postgresql://..."
JWT_SECRET="..."
NODE_ENV="development"
ANTHROPIC_API_KEY="sk-ant-..."
RESEND_API_KEY="re_..."
APP_URL="http://localhost:8081"

Regulus — invite-only social-knowledge platform