OpenSolve is a next-generation, open-source platform for algorithmic practice, coding challenges, and technical interviews — built for the community, by the community. It’s a self-hostable, extensible, and beautifully designed clone of LeetCode with full-stack flexibility and zero paywalls.
LeetCode is great — but closed. OpenSolve brings the same experience to the open world:
- 💻 Open Source — 100% free to use, self-host, and modify.
- ⚙️ Modern Stack — Built with Next.js, PostgreSQL, and TypeScript.
- 🔐 Self-Hostable — Deploy locally or on your own cloud (Docker support included).
- 🧠 Smart Judge — Supports multi-language execution (Python, C++, Java, JS) with sandboxed Docker containers.
- 🏗️ Problem Builder — Create, import, and manage your own problems with test cases and constraints.
- 🧑💻 User Profiles & Leaderboards — Compete, compare, and climb the ranks.
- 🎨 Sleek UI — Clean, minimal, and dark-mode ready.
| Layer | Technology |
|---|---|
| Frontend | Next.js, TailwindCSS, React Query |
| Backend | Next.js, PostgreSQL, Prisma ORM |
| Judging System | Docker-isolated code runner (supports multiple languages) |
| Auth | JWT + OAuth2 (GitHub, Google) |
| Deployment | Docker Compose / Fly.io / Railway / Supabase backend |
| AI Features (optional) | OpenAI / Ollama local inference for hints, explanations, and code optimization |
- Problem CRUD & submissions
- Code execution engine
- Contests & rating system
- Teams & collaborative problem solving
- Offline mode for universities & bootcamps
We love PRs! Clone, fork, or self-host — and help make OpenSolve the ultimate open coding playground.
git clone https://github.com/opensolve/opensolve.git
cd opensolve
docker compose up --buildPrefer shortcuts? Use make up or npm run docker:up. The default stack starts the web app, Postgres, RabbitMQ, MinIO, and the judge worker.
Useful local URLs:
- App: http://localhost:3000
- RabbitMQ: http://localhost:15672 (
opensolve/opensolve) - MinIO console: http://localhost:9001 (
opensolve/opensolve-secret)
To use a private local env file, copy ops/env/dev.env and point Compose at it:
cp ops/env/dev.env ops/env/dev.local.env
OPENSOLVE_ENV_FILE=./ops/env/dev.local.env docker compose up --buildMIT License — Free for personal, educational, and commercial use. No restrictions. Just code.
“Code is meant to be shared, not locked behind paywalls.” OpenSolve aims to democratize algorithmic practice and make technical learning accessible to everyone — from students in Kabul to developers in Silicon Valley.
Uploads (avatars, attachments, future problem assets) use the S3 API via lib/storage/minio.ts. For local/self-hosted deployments we bundle a MinIO stack that behaves exactly like AWS S3.
-
Set the environment variables (see
.env.examplefor defaults):MINIO_ENDPOINT=localhost:9000 MINIO_BUCKET=opensolve-assets MINIO_ACCESS_KEY=opensolve MINIO_SECRET_KEY=opensolve-secret MINIO_REGION=us-east-1 MINIO_USE_SSL=false MINIO_PUBLIC_URL=http://localhost:9000 MINIO_ROOT_USER=opensolve # only used by docker compose MINIO_ROOT_PASSWORD=opensolve-secret
-
Start MinIO (or run the full stack with
docker compose up --build):docker compose up -d minio minio-mc
- API:
http://localhost:9000 - Console UI:
http://localhost:9001
- API:
-
Provision the bucket (one-time). The bundled MinIO Client helper is the
minio-mcservice:docker compose up minio-mc
The helper exits after calling
mc mb --ignore-existing local/$MINIO_BUCKET, so it’s safe to rerun. -
Run the app (
docker compose up web). Upload routes will now stream directly into your MinIO bucket. In production, point the same variables at any S3-compatible endpoint (e.g., AWS S3, DigitalOcean Spaces, Cloudflare R2) and updateMINIO_PUBLIC_URLto whatever domain/CDN exposes the objects.
If the storage variables are omitted the upload endpoints throw a descriptive error, so you can disable attachments entirely if desired.
Phase 7 introduces a standalone judge worker that consumes RabbitMQ queues and runs submissions inside Docker sandboxes.
-
Configure env vars
JUDGE_RABBIT_URL=amqp://opensolve:opensolve@localhost:5672 JUDGE_RABBIT_PREFETCH=2 JUDGE_SANDBOX_DRIVER=docker # or mock for simulator mode JUDGE_SANDBOX_WORKDIR=/tmp/opensolve-judge
-
Start RabbitMQ + worker
- Dev mode:
docker compose up rabbitmq worker - Bare metal: run
npm run judge:workeralongsidenpm run dev
- Dev mode:
-
Manual review tools — staff can review hybrid/manual submissions at
/staff/judge/manual, postingMANUAL_ACCEPTED,MANUAL_PARTIAL, orMANUAL_REJECTEDverdicts with notes/score.
When RabbitMQ is unavailable (or the worker is down) the app falls back to the inline simulator so basic flows keep working.
Integration tests exercise Prisma CRUD flows against a disposable Postgres schema.
- Ensure Postgres is running and migrations have been generated (
npx prisma migrate deploy). - Provide the required environment variables (the tests read from
.env; at minimum setDATABASE_URL,SESSION_SECRET, andAPP_URL). - Run:
npm run testVitest will clone the schema into test_<worker> automatically, apply migrations, and run the CRUD suites without touching your development data. Use npm run test:watch during development for faster feedback.
- scrape
GET /api/internal/metricswithAuthorization: Bearer $METRICS_ACCESS_TOKEN. - Exposes
opensolve_trpc_duration_seconds,opensolve_submission_events_total,opensolve_judge_queue_messages, and contest gauges. - Deployments should call this endpoint after rolling out to ensure judge queues and tRPC calls are healthy.
Roles gate problem authoring, publishing, and moderation tools. To promote one of your users to ADMIN:
- Seed or sign up the user as usual so they exist in the
Usertable. - Run Prisma Studio (or any SQL client) and update the
rolecolumn toADMIN.
npx prisma studioOpen the User table, locate the account, and change the role dropdown to ADMIN. The change takes effect immediately—sign back in and you’ll see the staff console plus every curator tool. For scripted environments you can run:
npx prisma db execute --script "UPDATE \"User\" SET role = 'ADMIN' WHERE email = 'you@example.com';"Remember: admins can publish/archive problems, edit roles, and bypass reviewer restrictions, so keep these accounts limited.
- Environment parity:
ops/env/*.envhold canonical dev/staging/prod configs. Rootdocker-compose.ymlis the contributor default; staging and production compose specs live underops/docker/. - CI/CD pipeline:
.github/workflows/ci-cd.ymlruns lint → tests → Playwright → Docker builds → image pushes → staged releases. - Deploy targets: use the docker-compose stacks under
ops/docker/for dev/staging/VM setups or thefly.tomlspec for Fly.io. Secrets live inops/env/*.env. - Runbooks: outages, judge issues, DB slowdowns, and restore drills live under
docs/quality.