You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A modern, scalable TypeScript/Express REST API with Prisma (PostgreSQL) and Zod validation. Built for an online examination system with support for multiple question types, automated grading, and AI-powered question generation.
🚀 Quick Start
Prerequisites
Node.js 18+ (recommended 20+)
PostgreSQL database (Supabase recommended)
npm or yarn package manager
Installation
# 1. Install dependencies
npm install
# 2. Create and configure .env (required)# Set DATABASE_URL or LOCAL_DATABASE_URL, JWT_SECRET, and FRONTEND_ORIGIN# 3. Run database migrations
npx prisma migrate deploy
npx prisma generate
# 4. Create admin user
npm run create:user
# 5. Start development server
npm run dev
Option 1: Local PostgreSQL (Recommended for Development)
# Server ConfigurationPORT=4000NODE_ENV=development# Database Configuration - Local PostgreSQLUSE_SUPABASE=falseDATABASE_URL="postgresql://postgres:password@localhost:5432/shadowcoders?schema=public"LOCAL_DATABASE_URL="postgresql://postgres:password@localhost:5432/shadowcoders?schema=public"# AuthenticationJWT_SECRET="your_jwt_secret_here"# Frontend ConfigurationFRONTEND_ORIGIN=http://localhost:3000# Google AI (Optional)GOOGLE_API_KEY=# Redis (required for BullMQ)REDIS_URL=redis://127.0.0.1:6379# Code Execution Configuration# OS for code execution: 'windows', 'linux', or 'darwin' (macOS)# This determines which commands to use (e.g., python vs python3)EXECUTION_OS=linuxMAX_CONCURRENT_EXECUTIONS=5# File Uploads (Optional - defaults to 'uploads' in project root)# Used for storing LISTENING audio files and SPEAKING recordings# UPLOADS_DIR=/path/to/custom/uploads/directory
Option 2: Supabase (Cloud Database)
# Server ConfigurationPORT=4000NODE_ENV=development# Database Configuration - SupabaseUSE_SUPABASE=trueDATABASE_URL="postgresql://postgres.xxxxx:password@aws-0-xxxxx.pooler.supabase.com:6543/postgres?pgbouncer=true"DIRECT_URL="postgresql://postgres.xxxxx:password@aws-0-xxxxx.pooler.supabase.com:5432/postgres"# AuthenticationJWT_SECRET="your_jwt_secret_here"# Frontend ConfigurationFRONTEND_ORIGIN=http://localhost:3000# Google AI (Optional)GOOGLE_API_KEY=# Redis (required for BullMQ)REDIS_URL=redis://127.0.0.1:6379# Code Execution Configuration# OS for code execution: 'windows', 'linux', or 'darwin' (macOS)# This determines which commands to use (e.g., python vs python3)EXECUTION_OS=linuxMAX_CONCURRENT_EXECUTIONS=5# File Uploads (Optional - defaults to 'uploads' in project root)# Used for storing LISTENING audio files and SPEAKING recordings# UPLOADS_DIR=/path/to/custom/uploads/directory
Setup Notes
Create backend/.env manually (or from your own template).
For local PostgreSQL, set USE_SUPABASE=false and LOCAL_DATABASE_URL.
For Supabase, set USE_SUPABASE=true, DATABASE_URL, and optionally DIRECT_URL.
Redis must be reachable via REDIS_URL for code execution and queue status.
# Development
npm run dev # Start development server with hot reload
npm run build # Build for production
npm run start # Start production server# Database
npm run prisma:generate # Generate Prisma client
npm run prisma:migrate # Run database migrations
npm run prisma:studio # Open Prisma Studio (database GUI)# Utilities
npm run create:user # Create admin user
npm run add:students # Add students
🏗️ Architecture
Module Structure
Each feature module follows a consistent MVC-like pattern:
# Test connection
npm run test:db
# Check RLS status (Supabase only)
npm run check:rls
# Verify DATABASE_URL in .env# For Supabase: Make sure project is active (not paused)# For Local: Make sure PostgreSQL is running
Local Database Setup
If your network blocks Supabase, use local PostgreSQL:
# Setup local database
npm run setup:local-db
# This will:# 1. Create database# 2. Run migrations# 3. Update .env file# 4. Generate Prisma Client