A full-stack, open-source online judge platform designed to elevate college programming education.
Go to file
2025-04-08 16:06:22 +08:00
.github/workflows chore(workflow): update workflow for judge4c docker image 2025-03-25 21:51:22 +08:00
docker/lsp/clangd feat(docker): update optimized Dockerfile and compose for CN environment 2025-03-25 21:43:45 +08:00
prisma chore(imports): update imports to use @/generated/client instead of @prisma/client 2025-04-01 11:46:25 +08:00
public chore(public): add placeholder SVG image 2025-03-14 14:38:11 +08:00
src refactor(editor/header): adjust workspace header layout structure 2025-04-07 12:32:15 +08:00
.dockerignore chore(docker): update .dockerignore to exclude additional files and directories 2025-04-08 14:02:24 +08:00
.env.example chore(env): update .env.example with PostgreSQL host/port and Docker remote access configuration 2025-04-08 14:04:06 +08:00
.gitignore chore(gitignore): add generated folder to ignore list 2025-04-01 01:59:41 +08:00
bun.lock feat(layout): refactor problem layout to use DockView for organizing content sections 2025-04-04 18:13:14 +08:00
components.json chore: initialize shadcn/ui 2025-02-19 09:07:30 +08:00
compose.local.cn.yml chore(docker): rename compose files to local variants 2025-04-08 16:06:22 +08:00
compose.local.yml chore(docker): rename compose files to local variants 2025-04-08 16:06:22 +08:00
compose.yml feat(docker): update docker-compose.yml with environment variables and remote Docker configuration 2025-04-08 14:15:43 +08:00
demo.png chore(images): replace demo image with new version 2025-03-26 14:47:17 +08:00
Dockerfile fix(docker): include generated files in builder stage 2025-04-06 18:42:05 +08:00
Dockerfile.cn fix(docker): include generated files in builder stage 2025-04-06 18:42:05 +08:00
eslint.config.mjs chore(eslint): ignore generated files in linting 2025-04-01 12:51:30 +08:00
LICENSE chore: add MIT License file to the repository 2025-02-19 18:38:49 +08:00
next.config.ts feat(next.config): add dockerode to serverExternalPackages 2025-02-26 21:18:33 +08:00
package.json feat(layout): refactor problem layout to use DockView for organizing content sections 2025-04-04 18:13:14 +08:00
postcss.config.mjs chore(postcss): support GitHub Markdown theme switching 2025-03-06 21:19:48 +08:00
README.md docs(readme): add docker compose command for Chinese users 2025-03-25 22:27:56 +08:00
tailwind.config.ts feat(components/ui): add Accordion component from shadcn/ui 2025-03-17 20:21:20 +08:00
tsconfig.json chore(tsconfig): enable strictNullChecks in tsconfig.json 2025-04-01 01:56:15 +08:00

Judge4c

A full-stack, open-source online judge platform designed to elevate college programming education.

demo

⚠️ WSL Users: Critical Configuration

🐧 Network Mode Requirement

When using Windows Subsystem for Linux (WSL), you must configure your network mode as Mirrored to ensure proper LSP server connectivity. Standard WSL network configurations may create IPv6 conflicts that block Monaco-LSP communication.

🔧 Mirror Mode Setup:

  1. Open WSL settings ⚙️
  2. Navigate to Network section 🌐
  3. Select Mirrored mode 🔄
  4. Restart WSL instance 💻

Complete these steps before launching the editor for seamless LSP integration! 🎉

🚀 Getting Started

Deploy the project quickly using Docker. Follow the steps below:

Step 1: Clone the Repository

git clone https://github.com/massbug/judge4c
cd judge4c

Step 2: Install Dependencies

This project uses bun as the default package manager, but you can also use other package managers like npm, yarn, or pnpm if you prefer.

If you choose to use a package manager other than bun, you should delete the bun.lock file from your project directory.

The Dockerfile is designed to dynamically detect and adapt to the package manager you are using, ensuring compatibility with your preferred tool.

bun install

Step 3: Configure Environment Variables

  1. Copy the example environment file:

    cp .env.example .env
    
  2. Open the .env file and set the following variables:

    • PostgreSQL Credentials:

      POSTGRES_USER="your_postgres_user"
      POSTGRES_PASSWORD="your_postgres_password"
      POSTGRES_DB="your_postgres_db"
      
    • Authentication Secret: Generate a secure secret key using:

      bunx auth secret
      

      Then, set the AUTH_SECRET variable:

      AUTH_SECRET="your_auth_secret"
      
    • GitHub OAuth (Optional): If you need GitHub OAuth, replace the following variables with your GitHub OAuth credentials:

      AUTH_GITHUB_ID="your_github_client_id"
      AUTH_GITHUB_SECRET="your_github_client_secret"
      
    • Authentication Callback URL: Set the base URL for authentication callbacks (typically your app's domain):

      AUTH_URL="http://localhost:3000"  # Replace with your production URL if deployed
      
    • OpenAI API Configuration (Optional): If you use OpenAI-based features, provide your API key and custom endpoint (if applicable):

      OPENAI_API_KEY="your_openai_api_key"              # Required for AI features
      OPENAI_BASE_URL="your_openai_base_url_if_custom"  # Optional, for self-hosted proxies
      

Step 4: Start the Application

Once the environment variables are configured, start the application using Docker Compose:

docker compose up -d --build

For Chinese users:

docker compose -f compose.cn.yml up -d --build

Step 5: Access the Application

The application should now be running. You can access it at:

  • Web Interface: http://localhost:3000
  • LSP Service (C Language): ws://localhost:4594/clangd
  • LSP Service (C++ Language): ws://localhost:4595/clangd

📁 .env.example File

For reference, you can see the content of the .env.example file.

⚙️ Technical Configuration

LSP Server Mapping

Language LSP Server Port
C clangd 4594
C++ clangd 4595

📦 Dependency Management

🔒 Version Lock Requirements

Critical Pairing:

Package Max Version Reference
monaco-editor ≤0.36.1 Compatibility Matrix
monaco-languageclient ≤5.0.1

Version Lock Rationale:

  1. API Stability

    • Newer monaco-editor (≥0.40.0) breaks monaco-languageclient integration
    • v0.36.1 matches @codingame/monaco-vscode-api@1.76.9 requirements
  2. LSP Feature Breakdown

    • Version mismatches disable:
      • Auto textDocument/didOpen events
      • textDocument/inlayHint resolution
      • textDocument/documentLink functionality
  3. Version Conflict

    • @codingame package versioning (e.g., 11.1.2) ≠ monaco-editor versions (e.g., 0.36.1)
    • @monaco-editor/react depends on monaco-editor versioning scheme

Failure Indicators:

  • ✔️ WebSocket connection established
  • Missing syntax highlighting
  • No autocomplete suggestions
  • Silent LSP initialization failures