CodePie
A university-scale competitive programming platform: students submit code, a judge cluster runs it in isolation, verdicts come back in real time and the contest leaderboard keeps up.
The problem
Contests are bursty. Hundreds of students submit within the same window, each expecting a verdict in seconds, while the leaderboard has to stay correct without the database becoming the bottleneck.
- active students
- 200+
- submissions / hour, stable uptime
- 3,500+
- submissions / min in load tests, no degradation
- 1,000
Request pathon submit
client
Code editor
React · Monaco
service
Submission API
Go · chi → 202 Accepted
external
Judge0 cluster
self-hosted · all hidden tests in one run
Judge0 calls back with a signed token naming the submission
Result pathper callback
callback
Verify callback
token checked, then graded
store
Persist result
pgx · sqlc → PostgreSQL
client
Live verdict
Server-Sent Events → browser
only the submission is written — no scores or ranks stored
Ranking pathcomputed on read
client
Leaderboard request
paginated, team aware
store
One SQL query
best score per problem → rank() window
client
Standings
always current, nothing to sync
What I built
- 01Built and deployed the platform, used by 200+ active students.
- 02Moved the backend from Node.js, Express and Prisma to Go (chi, pgx, sqlc) on a normalized PostgreSQL schema with hand-written migrations.
- 03Runs untrusted code on a self-hosted Judge0 cluster, judging each submission in a single run with all hidden tests concatenated instead of one run per test.
- 04Judge0 reports back through a callback carrying a signed token, so verdicts can't be forged; students get them live over Server-Sent Events.
- 05Leaderboards went from recalculation on every callback, to scheduled batches, to a single SQL query over submissions — no stored scores to keep in sync.
Stack
- Go
- chi
- sqlc
- PostgreSQL
- Judge0
- SSE
- React
- TypeScript
