Lightweight competitive programming platform (full-stack) for creating problems, running submissions against testcases, and viewing results.
This repository contains a Next.js frontend, a separate frontend app (Vite + React) used for the in-browser code editor, and an Express-based backend (judge service, problem & submission APIs).
backend/
— Express server, API routes, models, judge service and DB config.backend/server.js
— application entrypoint for the backend.backend/config/database.js
— DB connection configuration.backend/scripts/
— scripts such ascreateAdmin.js
andseedProblems.js
.backend/services/judgeService.js
— code execution / judging logic.
frontend/
— Vite React app used for the in-browser editor and test runner (src/components/...).app/
— Next.js app (likely production or main website).components/
— UI components used by the Next.js app.
- Node.js (16+ recommended)
- pnpm (preferred package manager) — https://pnpm.io/
- A running database (see
backend/config/database.js
for supported DB and connection env vars)
All commands below assume a PowerShell terminal on Windows. Adjust as needed for other shells.
- Install dependencies
# from repo root
cd d:\HireAnything\competitive-programming-platform
# install root deps (if present)
pnpm install
# install backend deps
cd backend
pnpm install
# install frontend deps
cd ..\frontend
pnpm install
# (optional) install Next.js app deps
cd ..\app
pnpm install
- Configure environment
Edit the DB/ENV configuration used by the backend. See backend/config/database.js
and add any required environment variables (for example, DATABASE_URL
, PORT
, JWT_SECRET
). The project may expect a .env
file in backend/
— check server.js
or config/database.js
for specifics.
- Seed data / create admin (optional)
If you want example problems and an admin user, run the scripts in backend/scripts
after the DB is reachable.
cd backend
node scripts/createAdmin.js
node scripts/seedProblems.js
Note: these scripts may expect environment variables (DB connection and possibly admin credentials). Inspect the script headers for usage.
From separate terminals:
- Backend (Express):
cd backend
# either
node server.js
# or if package.json contains scripts
pnpm start
- Frontend (Vite React app used for the editor):
cd frontend
pnpm dev
- Next.js app (if used for the main site):
cd app
pnpm dev
backend/server.js
— backend entrypoint and server routes.backend/routes/
— Express routes (auth.js
,problems.js
,submissions.js
,admin.js
).backend/models/
— Mongoose/ORM models (User.js
,Problem.js
,Submission.js
,TestCase.js
).backend/services/judgeService.js
— where submissions are executed/judged.frontend/src/components
— React components used by the editor and UI.app/
— Next.js app files (page.tsx
,layout.tsx
,globals.css
).
- Install dependencies:
pnpm install
- Start backend:
node backend/server.js
orpnpm --filter backend start
- Start frontend:
pnpm --filter frontend dev
orcd frontend && pnpm dev
- Seed DB:
node backend/scripts/seedProblems.js
If your monorepo uses workspace/pnpm filters, you can use pnpm -w
or pnpm --filter
to run workspace scripts. Adjust to your setup.
- If the backend cannot connect to the database, verify the values in
backend/config/database.js
and the env vars. - If judge executions fail, check
backend/services/judgeService.js
for required binaries or sandboxing requirements.
- Add explicit README sections per package with exact script names after verifying
package.json
files. - Add a
.env.example
inbackend/
documenting required env vars and formats.
If you want, I can: add a .env.example
with guessed env names, or inspect backend/package.json
and frontend/package.json
to list exact npm scripts and then update this README with precise commands. Which would you prefer?