Skip to content

Local Setup

Environment Variables

Copy the example env file and fill in your values:

bash
cp .env.example .env.local

Required Variables

VariableDescription
DATABASE_URLPostgreSQL connection string
POSTGREST_URLPostgREST endpoint
POSTGREST_ANON_KEYPostgREST anonymous JWT
POSTGREST_SERVICE_ROLE_KEYPostgREST service role JWT
GEMINI_API_KEYGoogle Gemini API key (for AI generation)
SECRET_ENCRYPTION_KEYAES key for encrypting teacher secrets

Optional Variables

VariableDescriptionDefault
REDIS_HOSTRedis host for BullMQlocalhost
REDIS_PORTRedis port6379
REDIS_PASSWORDRedis password(none)
STORAGE_PROVIDERgcs or locallocal

Database Setup

The project uses PostgreSQL via PostgREST. Migrations are in supabase/migrations/.

bash
# Apply all migrations
supabase db push --include-all

Running the Worker

The background worker processes batch quiz generation jobs:

bash
# Build the worker bundle
pnpm build:worker

# Run the worker (connects to Redis)
node dist/worker/index.js

Running Tests

bash
# All tests
pnpm test

# Single file
npx vitest run src/lib/shuffling.test.ts

# Watch mode
npx vitest src/lib/shuffling.test.ts

TechTrans Lab