cojudge/cojudge
关于
Solve classic LeetCode problems complete offline. No discussion forum, no LLM assistant, not even the internet. Solve the curated list with just you, the problem and the offline judge.
学习与教育可以做什么
- Problem view Statement, examples and hints on the left; an editor for 8 languages on the right. Run the sample tests or submit against the hidden ones, judged in a Docker sandbox on your machine.
- 151 built-in problems in two courses (Blind 75, NeetCode 150), each with sample tests, hidden tests and a reference solution
- Problem packs (plugins): add more problems and courses from any GitHub repo, public or private, with cojudge plugin or the in-app Plugins page. Official packs: Basic 50 for beginners, NeetCode 250 and the 950-problem LeetCode 1000. Installed packs work offline. Browse packs or create your own
- 8 languages for every problem: Java, C++, Python, TypeScript, Rust, C#, Go and PHP
实测星标增长
- 24小时
- +1
- 7天
- +3
- 15天
- +8
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文
Cojudge
151 built-in problems · installable problem packs · 8 languages · offline
Practice coding interviews with a local judge. No AI assistant, no discussion forum, no internet. Just you, the problem and the judge.
Try the demo at cojudge.cloud · Install · Features · Highlights
Why Cojudge
- Honest practice. Nothing to reach for when a problem gets hard: no AI, no hints tab, no solutions forum (until you open the reference solution yourself).
- Works anywhere. On a plane, on a train, on a locked-down network, or with Wi-Fi off on purpose. Everything runs on your machine.
- A real judge. 151 built-in problems (plus more from problem packs) with sample tests, hidden tests and reference solutions, judged in Docker sandboxes, with a step debugger and a visualizer. All problems are tested for all programming languages we support
- Free and open source. MIT-licensed. Your code and progress stay local.
Features
Problem viewStatement, examples and hints on the left; an editor for 8 languages on the right. Run the sample tests or submit against the hidden ones, judged in a Docker sandbox on your machine. |
|
DebuggerStep through your solution line by line in any of the 8 languages, with a data-structure visualizer. |
|
CLIPrefer your own editor?cojudge init writes the starter code; cojudge run and cojudge submit judge it from the terminal.
|
|
Progress trackerCourses grouped by pattern, with solved counts per category, bookmarks and search across problem titles and statements. |
|
Problem packs (plugins)Add problems and courses from any GitHub repo, public or private:cojudge plugin install leetcode-1000, or one click on the Plugins page. Enable, disable, upgrade or remove packs at any time; installed packs work offline. Create your own
|
|
Install
macOS / Linux
curl -fsSL https://raw.githubusercontent.com/cojudge/cojudge/main/install-desktop.sh | sh
Windows (PowerShell)
irm https://raw.githubusercontent.com/cojudge/cojudge/main/install-desktop.ps1 | iex
You also need Docker running to judge code. Browsing problems works without it. Don't have Docker? Try cojudge.cloud first. More options (CLI-only, from source, containerized) are in Quickstart.
Highlights
- 151 built-in problems in two courses (Blind 75, NeetCode 150), each with sample tests, hidden tests and a reference solution
- Problem packs (plugins): add more problems and courses from any GitHub repo, public or private, with
cojudge pluginor the in-app Plugins page. Official packs: Basic 50 for beginners, NeetCode 250 and the 950-problem LeetCode 1000. Installed packs work offline. Browse packs or create your own - 8 languages for every problem: Java, C++, Python, TypeScript, Rust, C#, Go and PHP
- Debugger for all 8 languages, plus a data-structure visualizer
- Custom test cases: add your own inputs and compare the expected output with yours
- Dynamic judging: each problem can use custom
isCorrect(output)logic, so any valid answer passes, not just one exact string - Docker sandboxes: consistent, isolated runs on every machine
- Desktop app and CLI: native app for macOS, Windows and Linux, plus
cojudge init / run / submitfrom your own editor - Code playground: run snippets in any of the 8 languages without a problem
- Progress tracking and browser-like tabs for your solutions, stored locally
- Optional cloud sync through Google sign-in; local storage stays the source of truth offline
- Extensible: add problems by dropping folders into
~/cojudge/problems/, or publish your own pack as a GitHub repo
Cojudge is a practice judge with a curated set of tests, not a replacement for a full online judge. Practice offline, then run a full submission online when you're ready.
Requirements
- Node.js (v18+) and npm for CLI or source installs; desktop releases bundle Node.js
- Docker (installed and running, only required while judging)
Quickstart
1. Installation
Desktop app
Desktop builds bundle Node.js; Docker is only required when running, submitting, or debugging code. After installing the app, open the homepage menu and choose CLI to put cojudge on your PATH (no separate Node.js install).
- macOS / Linux (recommended, no Gatekeeper
xattrneeded):
On Linux, this installs thecurl -fsSL https://raw.githubusercontent.com/cojudge/cojudge/main/install-desktop.sh | sh.AppImageto~/.local/bin/cojudge-desktopby default (setCOJUDGE_LINUX_FORMAT=deborrpmto install system packages instead). - Windows (PowerShell):
irm https://raw.githubusercontent.com/cojudge/cojudge/main/install-desktop.ps1 | iex - Alternatives / manual downloads:
- Windows (winget):
Update withwinget install -e --id Cojudge.Cojudgewinget upgrade Cojudge.Cojudge. - Manual installers:
.dmg,-setup.exe,.deb,.rpm, and.AppImageare also attached to GitHub Releases. On macOS, browser-downloaded.dmgs are ad-hoc signed and requirexattr -dr com.apple.quarantine /Applications/Cojudge.appafter dragging to/Applications.
- Windows (winget):
CLI
If you are not using the desktop app, the easiest way to install the cojudge CLI without dealing with NPM permission issues is to run our install script:
Mac / Linux
git clone https://github.com/cojudge/cojudge
cd cojudge
./install.sh
source ~/.zshrc # or ~/.bashrc, depending on your shell
Windows Powershell
git clone https://github.com/cojudge/cojudge
cd cojudge
./install.ps1
. $PROFILE
This will install dependencies, build the app, and add a cojudge alias to your shell configuration.
2. Usage
Open the installed desktop app, or run cojudge to start the server and open it in your browser:
cojudge
CLI Commands
| Command | Description |
|---|---|
cojudge |
Start server & open browser |
cojudge <slug> <file> |
Open specific problem in browser with local file |
cojudge init <slug> [--lang <lang>] [--output <filename>] |
Initialize a problem file with starter code with filename. Fall back to, for example solution.rs, if filename is not provided |
cojudge run <slug> <file> |
Run sample tests for a problem from CLI (require running Docker) |
cojudge submit <slug> <file> |
Submit code for a problem from CLI (require running Docker) |
cojudge run <file> |
Run a playground file from CLI (require running Docker) |
cojudge list |
List all available problem slugs |
cojudge plugin search [keyword] |
Browse the problem-pack catalog |
cojudge plugin install <id|owner/repo> |
Install a problem pack (catalog id, GitHub repo, URL or local folder) |
cojudge plugin list |
List installed packs |
cojudge plugin enable|disable <id> |
Show or hide a pack without removing it |
cojudge plugin upgrade [id] |
Update packs from their source |
cojudge plugin uninstall <id> |
Remove a pack (your progress is kept) |
cojudge mark <slug> |
Mark a problem as solved |
cojudge unmark <slug> |
Unmark a problem as solved |
cojudge -p, --port <port> |
Start server on specific port (default 5375) |
cojudge -s, --status |
Check if server is running |
cojudge -u, --update |
Update to latest version (git pull, or check GitHub Releases in the desktop CLI) |
cojudge update |
Same as --update |
cojudge -l, --logs |
Stream the server logs |
cojudge -k, --kill |
Stop the server |
cojudge -v, --version |
Show current version & age |
cojudge version |
Same as --version |
cojudge -h, --help |
Show help message |
Note: You can browse problems and organize solutions without Docker. Docker is only required when you actually want to Run or Submit code, either from the web UI or CLI.
Manual Global Installation (If you prefer)
If you'd rather install it globally via NPM and have the necessary permissions:
npm install -g .
Troubleshooting Installation (Permission Denied)
If you encounter an EACCES error when running npm install -g . (especially on macOS with Homebrew), it's likely because your user doesn't have permissions to write to the global node_modules folder.
You can fix this by either:
- Using sudo (not recommended but fast):
sudo npm install -g . - Fixing npm permissions (recommended): Follow the official npm guide to change npm's default directory.
- Using the install script (easiest): Use
./install.shas described in the Quickstart section.
Alternative: Manual Run
If you don't want to install the CLI:
chmod +x run.sh
./run.sh
This starts the app at: http://localhost:5375.
Running with Docker (Containerized)
If you prefer to run the entire application inside a Docker container:
chmod +x docker.sh
./docker.sh
This builds a local image named cojudge and runs it, mapping the host Docker socket so the judge can spawn sibling containers.
Desktop Apps
Cojudge can also run as a native Tauri application on macOS, Windows, and Linux. The application bundles its Node.js backend, problems, and courses, so users do not need to install Node.js. Docker is still required when running or debugging code.
See docs/DESKTOP.md for development, DMG, signing, and notarization instructions.
Development
- Add $USER to docker group (if using Docker)
sudo usermod -aG docker "$USER"
newgrp docker
- Install dependencies
npm install
- Start the app (dev)
npm run dev
Problem packs (plugins)
Cojudge ships 151 problems (Blind 75 and NeetCode 150). Packs add more problems and courses:
cojudge plugin search # browse the catalog
cojudge plugin install basic-50 # 50 beginner problems: if/else, loops, arrays, strings, recursion
cojudge plugin install neetcode-250 # NeetCode 150 plus 100 more
cojudge plugin install leetcode-1000 # 950-problem archive grouped by pattern
cojudge plugin install owner/repo # any GitHub repo, including private ones (after `gh auth login` or with GH_TOKEN)
You can also use the Plugins page (plug icon next to the Playground button) to browse, install, enable, disable or remove packs. Packs are downloaded once and then work offline. Packs can't clobber each other: problems with the same slug in different packs are kept apart.
Create your own problem set, public or private: follow the step-by-step guide in cojudge/plugins. It covers the folder layout, testing locally, publishing on GitHub, private repos, and getting listed in the catalog. The full reference is docs/PLUGINS.md.
Add a problem
Local content lives in ~/cojudge (auto-seeded from the repo's bundled problems/ + courses/ on first start; your copy overrides bundled content — edit / add / delete files there, changes apply immediately). Unedited copies auto-update when Cojudge ships fixes; your edits are never overwritten (reset stale "Modified" items in Manage Problems or via cojudge sync --reset <id>). Override the location with COJUDGE_CONTENT_DIR.
See docs/ADD_PROBLEMS.md for a comprehensive guide covering:
- Required files (
statement.md,metadata.json,official-tests.json,Marker.java) - Standard function-based problems vs class-based design problems
- Supported parameter/output types
- Starter code conventions for all languages
- How to write
Marker.javawith the reference solution andisCorrectvalidator - Registration in
~/cojudge/courses/blind75/courseinfo.json - Verification checklist (
cojudge init/run/submit)
Refer to ~/cojudge/problems/two-sum (seeded from problems/two-sum) for a minimal example. To share a set of problems with others, package them as a problem pack.
Note on problems
Some test cases and reference marker solutions were AI‑assisted and human‑reviewed. Issues may remain—please open an issue or PR if you spot anything.
Add a programming language
This is a more complicated process but it is definitely doable.
For starter you need to create a new class that extends class
ProgramRunner.ts(e.g.JavascriptRunner.ts) and implement your ownabstract compile()andabstract run(). It's expected that all runtimes will be executed via DockerodeImplement all the
displayOutput({inputType})andto_{inputType}()methods on your custom utilitiy class (e.g.javascriptUtil.ts)Add your new languages on
api/image/pullandapi/image/statusAdd
starterCodeto the problem you like to solve in your language. Just the starter code is needed for existing problems. No need for solution in the new language. Our codebase will handle the rest.Update
type ProgrammingLanguage = 'java' | 'python' | 'cpp' | 'your_new_lang'onutil.ts;Add a new
<option>on the UI for the new language in#language-selectCreate a new class that extends
PlaygroundRunner(e.g.PlaygroundJavascriptRunner) insrc/lib/runners/PlaygroundRunners.tsand add the instantiation logic insrc/routes/api/playground/run/+server.ts.
Refer to javaUtil.ts, JavaRunner.ts and problems/two-sum (runtime copy: ~/cojudge/problems/two-sum) for a detailed example.
Troubleshooting
Error Connecting to Docker on macOS with Colima
Some Docker environments on macOS (like Colima) use a non-default Docker socket path. If the application has trouble connecting to Docker, you can specify the path manually by setting the HOST_DOCKER_SOCKET environment variable.
Example:
# Find your socket path by running `colima status`
HOST_DOCKER_SOCKET="/Users/your-user/.colima/default/docker.sock" ./docker.sh
Docker Not Found on macOS with Orbstack
If you're using Orbstack instead of Docker Desktop, you may need to set the DOCKER_HOST environment variable so the app can locate the Docker socket:
export DOCKER_HOST="unix://$HOME/.orbstack/run/docker.sock"
Add this line to your ~/.zshrc (or ~/.bashrc) to make it permanent:
Contact
Feel free to use the Issue page or Discussion page for any issues, feedback, comments, feature requests, or anything else related to cojudge.
探索相关项目
加载中…