How skkuding/codedang works
Project type and purpose
• This is a cloud-native, full-stack online judge system (“Codedang”) comprised of:
• A Next.js front-end (apps/frontend) serving both student (client) and admin dashboards
• A NestJS GraphQL back-end (apps/backend) handling business logic, authentication, and data access via Prisma
• An independent Go judge service “Iris” (iris/) that compiles and runs submitted code in sandboxes
• Supporting libraries (apps/backend/libs and apps/frontend/libs) for shared auth, caching, and utilities
• Infrastructure-as-code (apps/infra/) that provisions AWS ECS, RDS, Redis, S3, CloudFront, VPC, and a RabbitMQ queue
File structure
• Top-level directories reveal separation of concerns:
• apps/frontend – Next.js App Router, handlers for NextAuth, GraphQL codegen, Playwright tests
• apps/backend – NestJS monorepo with “admin” and “client” GraphQL sub-apps, shared libs, Prisma schema, migrations
• iris – standalone Go microservice interacting with RabbitMQ, S3, Postgres, providing judge/sandbox logic
• apps/infra – Terraform configs for “production”, “stage”, and “rc” environments, each deploying ECS services (admin_api, client_api, iris), network, storage, and autoscaling modules
Read the README for additional insights
• Confirms it’s an Online Judge system aimed at lowering the barrier for new coders, with compile+run+judge fully online.
• Documentation and contributing guides link to an external docs site.
Main components & interactions (
a. Frontend (Next.js)
• Student UI and Admin UI served by Vercel or ECS behind CloudFront
• NextAuth handler for OAuth/JWT flows
• Apollo Client connects over GraphQL to back-end
b. Backend (NestJS GraphQL)
• “client” and “admin” GraphQL endpoints
• Auth guards (JWT, OAuth) via libs/auth
• Business services (User, Contest, Assignment, Submission, Notice, Group)
• Data layer: Prisma + PostgreSQL, plus Redis cache via libs/cache
• File storage: media and testcases in S3 via storage service
• Publishes judge requests to RabbitMQ
c. Judge Service (Iris – Go)
• Consumes messages from RabbitMQ
• Loads testcases from S3 or Postgres
• Executes code in sandbox (e.g., container or chroot)
• Produces results back to queue or directly calls back GraphQL endpoint
d. Infrastructure (AWS via Terraform)
• VPC with public/private subnets, Route53, CloudFront, ACM TLS
• ECS Fargate clusters for frontend (if self-hosted), backend, iris, and IRIS
• RDS (PostgreSQL) for primary data
• Elasticache (Redis) for cache
• S3 buckets for media, problem testcases, and sample files
• RabbitMQ or SQS (message_queue.tf) for judge requests
• Load balancers and autoscaling modules
Architectural patterns & design principles
• Separation of concerns: distinct UI, API, and worker tiers
• Modular monorepo: shared libraries for auth, exception handling, logging, pipes, Prisma module
• Event-driven microservice: judge requests via message queue decoupling the API and compute
• Infrastructure-as-code for repeatable environments (prod, stage, rc) with Terraform modules
Essential details to capture
• Separate student and admin frontends (they share Next.js but different paths/components)
• The two GraphQL sub-applications within NestJS (“client” & “admin”) and their shared libs
• The judge worker’s sandbox steps and policy module (Java, C++ support)
• Terraform modules for VPC, ECS, Auto-scaling, Load Balancing
• Security boundaries: JWT/OAuth guards; IAM roles for S3 and ECS tasks
• CI/CD workflows (GitHub Actions) that build, test, and deploy each layer