emjudge is a monorepo application for managing frontend coursework. Students upload assignments, the platform evaluates them inside isolated Docker containers with Playwright, and teachers can review scores, screenshots, logs, and submission history from a web interface.
The system is organized into separate web, API, and worker applications so grading can scale independently from the user-facing product.
- React web app for students, teachers, and admins
- Fastify API with authentication, class management, assignments, and submissions
- Dedicated judge worker that polls grading jobs from PostgreSQL
- Docker-based isolated execution for submitted projects
- Playwright-driven grading with screenshots, logs, and structured test results
- Shared workspace packages for types, schemas, permissions, and config
- Multi-language web UI with Traditional Chinese, Simplified Chinese, and English
You can deploy to Zeabur with one click, but since Zeabur doesn't supports Docker-in-Docker yet so judge still needs to be run somewhere else.
docker compose up --build- App:
http://localhost:8080 - API health:
http://localhost:8080/api/health - MinIO API:
http://localhost:9000 - MinIO Console:
http://localhost:9001 - PostgreSQL:
localhost:5432
- Admin username:
admin - Admin password:
admin123 - MinIO access key:
minio - MinIO secret key:
minioadmin
docker compose downTo also remove named volumes:
docker compose down -vChoose one of these local workflows:
docker-compose.dev.yml- only PostgreSQL and MinIO, for running app processes withpnpm devdocker-compose.yml- full stack in Docker, including API, web, reverse proxy, and worker
pnpm installdocker compose -f docker-compose.dev.yml up -dThis starts local PostgreSQL and MinIO for development.
cp .env.example .envAt minimum, update these values before real usage:
JWT_SECRETDEFAULT_ADMIN_PASSWORD
pnpm db:migrate
pnpm db:seedpnpm --filter @judge/shared buildpnpm devpnpm dev:workerdocker build -t judge-runner:latest docker/judge-runner/If you want to run everything locally with one command, use the root docker-compose.yml.
postgres- PostgreSQL databaseminio- object storageminio-init- creates the required bucketsapi- Fastify backendweb- React frontend served by Nginxcaddy- local reverse proxy entrypointworker- judge worker with Docker socket access
- The worker uses
/var/run/docker.sockto launch isolated judge containers from inside the compose stack - The worker auto-builds
judge-runner:latestfromdocker/judge-runner/if the image does not exist yet - The API container runs database migration and admin seeding on startup
- For real deployments, replace the default secrets in
docker-compose.yml
emjudge/
├── apps/
│ ├── api/ # Fastify backend
│ ├── web/ # React + Vite frontend
│ └── worker/ # Judge worker process
├── docker/
│ ├── api.Dockerfile
│ ├── web.Dockerfile
│ ├── worker.Dockerfile
│ ├── caddy/
│ ├── nginx/
│ ├── worker/
│ └── judge-runner/ # Playwright runner image
├── packages/
│ ├── shared/ # Shared types, schemas, constants, templates
│ └── config/ # Shared TypeScript config
├── docker-compose.yml # Full local stack
├── docker-compose.dev.yml # Infra-only dev stack
└── pnpm-workspace.yaml
apps/web- React frontend for authentication, classes, assignments, grading results, and administrationapps/api- Fastify API for auth, user management, classes, assignments, submissions, storage access, and job creationapps/worker- background judge worker that consumes queued grading jobs and writes results back to PostgreSQL
packages/shared- shared Zod schemas, domain types, permissions, constants, and built-in Playwright test templatespackages/config- shared TypeScript configuration used across apps
- PostgreSQL for application data and job queue state
- MinIO for uploaded submission files and grading artifacts
- Docker for isolated grading execution
- A student uploads an assignment through the web app.
- The API stores files in MinIO and creates submission and job records in PostgreSQL.
- The worker claims a pending job using PostgreSQL locking.
- The worker downloads files, prepares the grading workspace, and runs the submission inside the
judge-runnerDocker image. - Playwright executes the assignment's test script.
- The worker stores logs, screenshots, and structured results, then updates submission status and score.
| Area | Stack |
|---|---|
| Frontend | React, Vite, React Router, React Query, Tailwind CSS |
| Backend | Fastify, PostgreSQL, Zod, JWT |
| Worker | Node.js, PostgreSQL, MinIO, Docker |
| Testing Runtime | Playwright |
| Tooling | pnpm workspaces, TypeScript |
| Tool | Version |
|---|---|
| Node.js | 22.13+ |
| pnpm | 11+ |
| Docker | 24+ |
| PostgreSQL | 15+ |
| MinIO | latest |
pnpm dev
pnpm dev:web
pnpm dev:api
pnpm dev:worker
pnpm build
pnpm db:migrate
pnpm db:seed
pnpm formatpnpm --filter @judge/web build
pnpm --filter @judge/api build
pnpm --filter @judge/worker build
pnpm --filter @judge/shared buildThe project uses a shared root .env for local development. See .env.example for the full reference.
Commonly used variables include:
DATABASE_URLJWT_SECRETDEFAULT_ADMIN_PASSWORDCORS_ORIGINMINIO_ENDPOINTMINIO_PORTMINIO_ACCESS_KEYMINIO_SECRET_KEYMINIO_PUBLIC_BASE_URLCACHE_ROOT_DIRJUDGE_IMAGEWORKER_ID
The web app uses react-i18next and ships with:
zh-TWzh-CNen
Translation sources live under apps/web/src/i18n/locales/, and crowdin.yml is configured for translation sync workflows.
Interactive API documentation is available through Swagger in the running API service: /api/docs.
pnpm --filter @judge/shared build
pnpm --filter @judge/web build
pnpm --filter @judge/api build
pnpm --filter @judge/worker buildnode apps/api/dist/index.js
node apps/worker/dist/index.jsThe frontend production bundle is generated in apps/web/dist and can be served by Nginx or any static file server.
The judge worker must run on a machine with Docker access because it launches isolated judge-runner containers through /var/run/docker.sock.
Create a .env file on the worker host with the remote database and MinIO settings:
DATABASE_URL=postgresql://...
MINIO_ENDPOINT=...
MINIO_PORT=443
MINIO_ACCESS_KEY=...
MINIO_SECRET_KEY=...
MINIO_USE_SSL=true
JUDGE_REACT_CPUS=1
JUDGE_HTML_CPUS=1
JUDGE_REACT_MEMORY=1g
JUDGE_HTML_MEMORY=512m
JUDGE_PLAYWRIGHT_WORKERS=1
JUDGE_DOCKER_PIDS_LIMIT=128Build the judge image and start three worker instances:
docker build -t emjudge-judge:latest docker/judge-runner/
docker compose -f docker-compose.workers.yml up -d --build worker1 worker2 worker3Each worker in docker-compose.workers.yml has a unique WORKER_ID and cache directory. With the default limits above, three concurrent React grading jobs use about three judge CPUs plus container overhead.
If the root docker-compose.yml stack is also running on the same host, stop its single worker service so you do not accidentally run a fourth worker:
docker compose stop worker
docker compose rm -f workerCheck worker status and resource usage:
docker ps
docker stats
docker logs -f emjudge-worker-1The local Docker images used by docker-compose.yml are defined in docker/api.Dockerfile, docker/web.Dockerfile, and docker/worker.Dockerfile.
- Use a strong
JWT_SECRET - Rotate the seeded admin password after setup
- Replace default PostgreSQL and MinIO credentials
- Restrict
CORS_ORIGINto trusted domains - Enable SSL for MinIO in production where applicable
- Build and publish the
judge-runnerimage before enabling grading - Run API and worker processes under a supervisor such as systemd, PM2, or containers
- Ensure Docker permissions and resource limits are reviewed before accepting untrusted submissions
Assignments support two grading modes:
html-css-jsreact
Teachers can define:
- title
- markdown description
- assignment type
- due date
- whether multiple submissions are allowed
- Playwright grading script
The web app also includes built-in Playwright test templates to speed up assignment authoring.
Core entities include:
- users
- classes
- class members
- assignments
- assignment specs
- submissions
- submission files
- submission runs
- submission artifacts
- judge jobs
- password reset logs
- bulk import jobs
The SQL schema lives in apps/api/src/db/schema.sql.
- Sign in with the seeded admin account.
- Create users individually or through bulk import.
- Create classes.
- Add students and teachers to classes.
- Open a class.
- Create an assignment.
- Add instructions and a Playwright grading script.
- Review submissions, screenshots, logs, and scores.
- Open a class.
- View assignment requirements.
- Upload files or a project folder.
- Wait for grading to complete.
- Review score, screenshots, logs, and test output.
- Code of Conduct:
CODE_OF_CONDUCT.md - Contributing Guide:
CONTRIBUTING.md - Security Policy:
SECURITY.md - License:
LICENSE
If you extend the system, prefer keeping cross-app contracts in packages/shared, and keep user-facing API details documented in Swagger rather than duplicating them in Markdown. For contribution workflow, review CONTRIBUTING.md before opening an issue or pull request.
