Local Setup
Environment Variables
Copy the example env file and fill in your values:
bash
cp .env.example .env.localRequired Variables
| Variable | Description |
|---|---|
DATABASE_URL | PostgreSQL connection string |
POSTGREST_URL | PostgREST endpoint |
POSTGREST_ANON_KEY | PostgREST anonymous JWT |
POSTGREST_SERVICE_ROLE_KEY | PostgREST service role JWT |
GEMINI_API_KEY | Google Gemini API key (for AI generation) |
SECRET_ENCRYPTION_KEY | AES key for encrypting teacher secrets |
Optional Variables
| Variable | Description | Default |
|---|---|---|
REDIS_HOST | Redis host for BullMQ | localhost |
REDIS_PORT | Redis port | 6379 |
REDIS_PASSWORD | Redis password | (none) |
STORAGE_PROVIDER | gcs or local | local |
Database Setup
The project uses PostgreSQL via PostgREST. Migrations are in supabase/migrations/.
bash
# Apply all migrations
supabase db push --include-allRunning 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.jsRunning 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