CD Judge is a secure, multi-language code execution engine and online judge platform featuring a sandboxed runner, interactive playground, and integrated performance analytics.
- Framework: Next.js 15
- Database: PG with Drizzle ORM
- Authentication: Better Auth
- API: tRPC
- UI: React 19 with Tailwind CSS v4
- Monorepo: Turborepo with pnpm
- Node.js ^23
- pnpm ^10.19.0
-
Install dependencies:
pnpm install
-
Setup environment:
cp .env.example .env
-
Start required services (Database & Redis):
make services
-
Initialize database and auth:
pnpm db:push pnpm auth:generate
Run the full stack in development mode:
pnpm devOr run only the web application (ensure services are running):
pnpm dev:nextpnpm build- Build all appspnpm dev- Start development serverspnpm lint- Lint all packagespnpm format- Format code with Prettierpnpm typecheck- Type check all packagespnpm db:studio- Open Drizzle Studio
The Submissions API allows you to execute code in various programming languages and retrieve results asynchronously.
All requests require a Bearer token in the Authorization header.
Authorization: Bearer <your_api_key_or_session_token>- API Key: Secret key from your dashboard.
- Session Token: Internal usage for the playground.
POST /api/v1/submissions
Request Body:
| Field | Type | Description |
|---|---|---|
code |
string |
The source code to be executed. |
lang |
string |
The programming language (py, js, java, cpp). |
Example:
{
"code": "print('Hello, World!')",
"lang": "py"
}Success Response (200 OK):
{
"id": "12345"
}GET /api/v1/submissions/[id]
Success Response (200 OK):
Returns the status and output of the job.
status:waiting,active,completed, orfailed.result: Execution details (verdict, stdout, stderr, time, memory).
Example Response:
{
"id": "12345",
"status": "completed",
"result": {
"verdict": "OK",
"stdout": "Hello, World!\n",
"stderr": "",
"exitCode": 0,
"time": 50,
"memory": 1048576
}
}.
├── apps
│ └── web # Next.js web application
├── packages
│ ├── api # tRPC API definitions
│ ├── auth # Authentication configuration
│ ├── db # Database schema and client
│ ├── jobs # Job queue and logic
│ ├── ui # Shared UI components
│ ├── validators # Shared validation schemas
└── tooling
├── eslint # ESLint configurations
├── prettier # Prettier configuration
├── tailwind # Tailwind CSS configuration
└── typescript # TypeScript configurations