A real-time coding competition platform for one admin and ~100 whitelisted Python participants. Features live session control, browser coding, automated judging via Piston, and a final exportable leaderboard.
- Node.js 20+
- pnpm
- Docker & Docker Compose (for Piston)
-
Install dependencies:
pnpm install
-
Environment variables: Copy
.env.exampleto.envand set the required variables:DATABASE_URL="file:./dev.db" JWT_SECRET="your-32-character-secret-key-here" ADMIN_DEFAULT_USERNAME="admin" ADMIN_DEFAULT_PASSWORD="password123" PISTON_API_URL="http://localhost:2000/api/v2"
-
Start Piston (Python execution engine):
docker compose up -d
-
Database setup:
pnpm prisma migrate deploy pnpm prisma db seed
-
Start the development server:
pnpm dev
Open http://localhost:3000 in your browser.
This application is designed for a single VPS deployment (not Vercel/serverless) due to the SQLite database and local Piston execution engine.
- Clone the repository on your VPS.
- Install Node.js, pnpm, and Docker.
- Set up your
.envfile with a strongJWT_SECRETand admin credentials. - Run
docker compose up -dto start Piston. - Run
pnpm install,pnpm prisma migrate deploy, andpnpm prisma db seed. - Build the application:
pnpm build. - Start the production server:
pnpm start(or use PM2/systemd). - Configure a reverse proxy (Nginx/Caddy) to route traffic to port 3000.
- Execution: Python code is executed exclusively via the Piston HTTP API. No
child_processcalls are made. - State: Session state is synchronized via lightweight polling (2.5s intervals). No WebSockets are used.
- Auth: Admin uses a signed HttpOnly cookie. Participants use a signed Bearer token stored in
localStorage. No heavy auth frameworks (e.g., NextAuth) are used. - Database: SQLite via Prisma. Submissions and test case results are persisted for auditing.