Inspiration

Our college lacked a dedicated platform for placement-focused coding practice. Students relied on scattered external platforms with no way to host internal contests tailored to our curriculum and placement patterns. We wanted a Codeforces-like experience built specifically for NIT Kurukshetra.

What it does

Codespardha is a competitive programming platform where admins host timed coding contests and students solve problems in C++, Java, or Python. It features sandboxed code execution, real-time judging across multiple test cases, ACM-ICPC style leaderboards with penalty scoring, public profiles with solve statistics, and an approach-first gate that requires students to document their thinking before submitting code — turning contests into learning experiences.

How we built it

The backend is built with Bun and Elysia for a fast, type-safe API layer, with Drizzle ORM over PostgreSQL for a fully typed data layer. Authentication uses Better Auth with Google Workspace SSO, domain-locked to our college. Code execution is offloaded to a sandboxed exec0 engine with configurable time/memory limits. The entire stack runs in Docker containers with health checks and migration support.

Challenges we ran into

  • Designing the async judging pipeline, submissions needed to return instantly while results polled in the background with proper error recovery
  • Generating leaderboards efficiently with penalty calculations, tie-breaking, and per-problem breakdowns in a single SQL query using window functions
  • Handling edge cases like large stdout from infinite loops overwhelming the database and frontend, solved by adding output truncation limits
  • Enforcing contest integrity, hiding test case details during active contests while showing them after

Accomplishments that we're proud of

  • The approach-first submission gate, a simple design decision that fundamentally changed how students engage with problems, forcing them to think before coding
  • A clean async judging flow that handles concurrent submissions gracefully with fire-and-forget dispatch and background persistence
  • Lazy leaderboard generation that computes full ICPC-style standings in a single atomic transaction
  • The entire platform runs self-hosted on college infrastructure with zero external dependencies beyond Google OAuth

What we learned

  • How real judge systems like Codeforces handle sandboxed execution, output limits, and concurrent submissions at scale
  • The importance of rate limiting at multiple layers — cheap in-memory limits for fast operations, durable DB-backed limits for expensive ones
  • That forcing structure (approach before code) improves learning outcomes more than any feature we could have built
  • Production concerns like output truncation, session security, and time-gated visibility matter as much as core features

What's next for Codespardha

  • Live contest dashboard with real-time submission feed and standings updates via WebSockets
  • Plagiarism detection using code similarity analysis across submissions
  • Problem recommendations based on user solve history and difficulty progression
  • Editorial system where problem setters publish solutions after contests end
  • Multi-institution support to let other colleges host their own contests on the platform
  • Impromptu video, for students to daily upload 3 minute video explaining random topic to improve their communication and articulation skill

Built With

Share this project:

Updates