Skip to main content

Environment Variables

This document lists every environment variable used across the project - backend, frontend, and CI/CD workflows.

No .env files are committed to the repository. You must create them manually in each workspace.


Backend

File: backend/.env

VariableRequiredDefaultDescription
SUPABASE_URLYes-Your Supabase project URL (e.g., https://abcdef.supabase.co)
SUPABASE_SERVICE_ROLE_KEYYes-Supabase service role key. Has full database access, bypasses RLS. Keep secret.
SUPABASE_PUSHABLE_KEYYes-Supabase anon/public key. Used for user-context clients that respect RLS policies.
FRONTEND_URLNohttp://localhost:3000Allowed CORS origin. Set to your frontend's production URL in deployment.
PORTNo3001Port the backend server listens on.
USE_REDISNofalseSet to true to use Redis for caching instead of in-memory.
REDIS_URLOnly if USE_REDIS=true-Redis connection URL (e.g., redis://localhost:6379).

Example backend/.env

SUPABASE_URL=https://your-project-id.supabase.co
SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6...
SUPABASE_PUSHABLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6...
FRONTEND_URL=http://localhost:3000
PORT=3001
USE_REDIS=false
# REDIS_URL=redis://localhost:6379

Where Each Variable Is Used

VariableFileUsage
SUPABASE_URLsrc/supabase/supabase.service.tsCreating both service and user Supabase clients
SUPABASE_SERVICE_ROLE_KEYsrc/supabase/supabase.service.tsService client - bypasses RLS for admin operations
SUPABASE_PUSHABLE_KEYsrc/supabase/supabase.service.tsUser client - respects RLS using the user's JWT
FRONTEND_URLsrc/createApp.tsCORS origin configuration
PORTsrc/main.tsFastify listen port (local dev only; not used in serverless)
USE_REDISsrc/cache/cache.service.tsSelects Redis store when true
REDIS_URLsrc/cache/cache.service.tsRedis connection URL for ioredis

Frontend

File: frontend/.env.local

VariableRequiredDefaultDescription
NEXT_PUBLIC_API_URLNohttp://localhost:3001Backend API base URL (without /api - that's appended automatically)

Example frontend/.env.local

NEXT_PUBLIC_API_URL=http://localhost:3001

Where It Is Used

VariableFileUsage
NEXT_PUBLIC_API_URLlib/api.tsConstructs the API base URL as ${NEXT_PUBLIC_API_URL}/api

Note: The NEXT_PUBLIC_ prefix makes this variable available in the browser bundle. Do not put secrets in NEXT_PUBLIC_ variables.


GitHub Actions Secrets

These secrets must be configured in the repository's Settings → Secrets and variables → Actions.

SecretRequired ForDescription
CODECOV_TOKENcodecov.ymlUpload token from codecov.io for test coverage reports
DISCORD_WEBHOOK_URLdiscord-merge-main.yml, success.ymlDiscord webhook URL for sending PR merge and workflow success notifications

CI Build Variables

The ci.yml workflow uses placeholder values for the frontend build (since the actual Supabase keys aren't needed at build time):

env:
NEXT_PUBLIC_SUPABASE_URL: "https://your-project.supabase.co"
NEXT_PUBLIC_SUPABASE_ANON_KEY: "supabase-anon-key"

These are dummy values to prevent the build from failing. The frontend doesn't currently read these variables at runtime - it only uses NEXT_PUBLIC_API_URL.


Quick Setup

1. Get Supabase Keys

  1. Go to your Supabase Dashboard
  2. Select your project
  3. Go to Settings → API
  4. Copy:
    • Project URLSUPABASE_URL
    • service_role key (under "Project API keys") → SUPABASE_SERVICE_ROLE_KEY
    • anon public keySUPABASE_PUSHABLE_KEY

2. Create Backend .env

cd backend
cp .env.example .env # if an example exists, or create manually
# Fill in the three Supabase values

3. Create Frontend .env.local

cd frontend
echo "NEXT_PUBLIC_API_URL=http://localhost:3001" > .env.local

4. (Optional) Configure GitHub Secrets

For CI/CD features:

Repository → Settings → Secrets and variables → Actions → New repository secret

Add CODECOV_TOKEN and DISCORD_WEBHOOK_URL if using those workflows.


Security Notes

  • Never commit .env files - they are in .gitignore
  • SUPABASE_SERVICE_ROLE_KEY has full database access - treat it like a database admin password
  • SUPABASE_PUSHABLE_KEY is the anon key - safe to expose in user-context clients since RLS policies protect the data
  • Frontend variables prefixed with NEXT_PUBLIC_ are embedded in the JavaScript bundle and visible to users