# littleorange666/orangejudge architecture

> Architecture diagram of the GitHub repository littleorange666/orangejudge, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/littleorange666/orangejudge
- Repository: https://github.com/littleorange666/orangejudge

## Overview

OrangeJudge is a self-hosted competitive-programming judge. Users submit solutions through the web interface; the application records submissions, schedules judging, runs code in a sandbox, and makes results available. Separate capabilities cover accounts, problem authoring, and contests. The graph emphasizes documented and indexed call relationships; some subsystem internals are unsampled, so uncertain links are omitted. The README identifies the sandbox and database services but does not document their protocols.

Main entry points: [`modules/datas.py`](https://github.com/littleorange666/orangejudge/blob/main/modules/datas.py) (Application data), [`modules/tasks.py`](https://github.com/littleorange666/orangejudge/blob/main/modules/tasks.py) (Judge tasks), [`modules/submitting.py`](https://github.com/littleorange666/orangejudge/blob/main/modules/submitting.py) (Submission intake), [`modules/executing.py`](https://github.com/littleorange666/orangejudge/blob/main/modules/executing.py) (Language execution)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_application["Flask application<br/>[main.py]"]
  node_web_routes["Web routes<br/>[general.py]"]
  node_api_routes["API routes<br/>[general.py]"]
  node_contest_routes["Contest routes<br/>[contests.py]"]
  node_auth_routes["Login routes<br/>[login.py]"]
end

subgraph group_domain["Platform domains"]
  node_accounts["Accounts and login<br/>[login.py]"]
  node_submission["Submission intake<br/>[submitting.py]"]
  node_contests["Contest management<br/>[contests.py]"]
  node_problem_admin["Problem authoring<br/>[problemsetting.py]"]
end

subgraph group_judge["Judging runtime"]
  node_judge_queue["Judge tasks<br/>[tasks.py]"]
  node_execution["Language execution<br/>[executing.py]"]
  node_sandbox["Sandbox service"]
  node_judge_logic["Judge logic<br/>[judge.py]"]
end

subgraph group_foundation["Shared services"]
  node_store[("Application data<br/>[datas.py]")]
  node_domain_types["Domain models<br/>[objs.py]"]
  node_configuration["Configuration<br/>[config.py]"]
  node_shared_tools["Shared utilities<br/>[tools.py]"]
  node_locks["File locks<br/>[locks.py]"]
  node_publications["Publications<br/>[pubs.py]"]
end

node_user(("User"))

node_user -->|"uses"| node_application
node_application -->|"registers routes"| node_web_routes
node_web_routes -->|"submits code"| node_submission
node_web_routes -->|"reads submissions"| node_store
node_api_routes -->|"handles submissions"| node_submission
node_api_routes -->|"handles contest actions"| node_contests
node_api_routes -->|"requests rejudge"| node_judge_queue
node_contest_routes -->|"manages contests"| node_contests
node_auth_routes -->|"authenticates"| node_accounts
node_accounts -->|"reads and writes"| node_store
node_submission -->|"records submission"| node_store
node_submission -->|"schedules judging"| node_judge_queue
node_submission -->|"checks contest"| node_contests
node_judge_queue -->|"runs submissions"| node_execution
node_judge_queue -->|"updates results"| node_store
node_execution -.->|"runs code"| node_sandbox
node_judge_queue -->|"uses judge results"| node_judge_logic
node_problem_admin -->|"tests programs"| node_execution
node_problem_admin -->|"persists problems"| node_store
node_contests -->|"persists contest data"| node_store
node_execution -->|"loads judge settings"| node_configuration
node_execution -->|"uses utilities"| node_shared_tools
node_shared_tools -->|"locks files"| node_locks
node_judge_queue -->|"publishes updates"| node_publications
node_application -->|"loads settings"| node_configuration
node_store -->|"serializes domain data"| node_domain_types

click node_application "https://github.com/littleorange666/orangejudge/blob/main/main.py"
click node_web_routes "https://github.com/littleorange666/orangejudge/blob/main/modules/routers/general.py"
click node_api_routes "https://github.com/littleorange666/orangejudge/blob/main/modules/routers/api/general.py"
click node_contest_routes "https://github.com/littleorange666/orangejudge/blob/main/modules/routers/api/contests.py"
click node_auth_routes "https://github.com/littleorange666/orangejudge/blob/main/modules/routers/login.py"
click node_accounts "https://github.com/littleorange666/orangejudge/blob/main/modules/login.py"
click node_submission "https://github.com/littleorange666/orangejudge/blob/main/modules/submitting.py"
click node_contests "https://github.com/littleorange666/orangejudge/blob/main/modules/contests.py"
click node_problem_admin "https://github.com/littleorange666/orangejudge/blob/main/modules/problemsetting.py"
click node_judge_queue "https://github.com/littleorange666/orangejudge/blob/main/modules/tasks.py"
click node_execution "https://github.com/littleorange666/orangejudge/blob/main/modules/executing.py"
click node_judge_logic "https://github.com/littleorange666/orangejudge/blob/main/modules/judge.py"
click node_store "https://github.com/littleorange666/orangejudge/blob/main/modules/datas.py"
click node_domain_types "https://github.com/littleorange666/orangejudge/blob/main/modules/objs.py"
click node_configuration "https://github.com/littleorange666/orangejudge/blob/main/modules/config.py"
click node_shared_tools "https://github.com/littleorange666/orangejudge/blob/main/modules/tools.py"
click node_locks "https://github.com/littleorange666/orangejudge/blob/main/modules/locks.py"
click node_publications "https://github.com/littleorange666/orangejudge/blob/main/modules/pubs.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_application,node_web_routes,node_api_routes,node_contest_routes,node_auth_routes,node_user toneBlue
class node_accounts,node_submission,node_contests,node_problem_admin toneAmber
class node_judge_queue,node_execution,node_sandbox,node_judge_logic toneMint
class node_store,node_domain_types,node_configuration,node_shared_tools,node_locks,node_publications toneRose
```

## Components

### Web application

- [Flask application](https://github.com/littleorange666/orangejudge/blob/main/main.py): `main.py`
- [Web routes](https://github.com/littleorange666/orangejudge/blob/main/modules/routers/general.py): `modules/routers/general.py`
- [API routes](https://github.com/littleorange666/orangejudge/blob/main/modules/routers/api/general.py): `modules/routers/api/general.py`
- [Contest routes](https://github.com/littleorange666/orangejudge/blob/main/modules/routers/api/contests.py): `modules/routers/api/contests.py`
- [Login routes](https://github.com/littleorange666/orangejudge/blob/main/modules/routers/login.py): `modules/routers/login.py`

### Platform domains

- [Accounts and login](https://github.com/littleorange666/orangejudge/blob/main/modules/login.py): `modules/login.py`
- [Submission intake](https://github.com/littleorange666/orangejudge/blob/main/modules/submitting.py): `modules/submitting.py`
- [Contest management](https://github.com/littleorange666/orangejudge/blob/main/modules/contests.py): `modules/contests.py`
- [Problem authoring](https://github.com/littleorange666/orangejudge/blob/main/modules/problemsetting.py): `modules/problemsetting.py`

### Judging runtime

- [Judge tasks](https://github.com/littleorange666/orangejudge/blob/main/modules/tasks.py): `modules/tasks.py`
- [Language execution](https://github.com/littleorange666/orangejudge/blob/main/modules/executing.py): `modules/executing.py`
- **Sandbox service**
- [Judge logic](https://github.com/littleorange666/orangejudge/blob/main/modules/judge.py): `modules/judge.py`

### Shared services

- [Application data](https://github.com/littleorange666/orangejudge/blob/main/modules/datas.py): `modules/datas.py`
- [Domain models](https://github.com/littleorange666/orangejudge/blob/main/modules/objs.py): `modules/objs.py`
- [Configuration](https://github.com/littleorange666/orangejudge/blob/main/modules/config.py): `modules/config.py`
- [Shared utilities](https://github.com/littleorange666/orangejudge/blob/main/modules/tools.py): `modules/tools.py`
- [File locks](https://github.com/littleorange666/orangejudge/blob/main/modules/locks.py): `modules/locks.py`
- [Publications](https://github.com/littleorange666/orangejudge/blob/main/modules/pubs.py): `modules/pubs.py`

### Other components

- **User**

## Connections

- User → Flask application: uses
- Flask application → Web routes: registers routes (evidence: `main.py`)
- Web routes → Submission intake: submits code (evidence: `modules/routers/general.py`)
- Web routes → Application data: reads submissions (evidence: `modules/routers/general.py`)
- API routes → Submission intake: handles submissions (evidence: `modules/routers/api/general.py`)
- API routes → Contest management: handles contest actions (evidence: `modules/routers/api/general.py`)
- API routes → Judge tasks: requests rejudge (evidence: `modules/routers/api/general.py`)
- Contest routes → Contest management: manages contests (evidence: `modules/routers/api/contests.py`)
- Login routes → Accounts and login: authenticates (evidence: `modules/routers/login.py`)
- Accounts and login → Application data: reads and writes (evidence: `modules/login.py`)
- Submission intake → Application data: records submission (evidence: `modules/submitting.py`)
- Submission intake → Judge tasks: schedules judging (evidence: `modules/submitting.py`)
- Submission intake → Contest management: checks contest (evidence: `modules/submitting.py`)
- Judge tasks → Language execution: runs submissions (evidence: `modules/tasks.py`)
- Judge tasks → Application data: updates results (evidence: `modules/tasks.py`)
- Language execution → Sandbox service: runs code
- Judge tasks → Judge logic: uses judge results (evidence: `modules/tasks.py`)
- Problem authoring → Language execution: tests programs (evidence: `modules/problemsetting.py`)
- Problem authoring → Application data: persists problems (evidence: `modules/problemsetting.py`)
- Contest management → Application data: persists contest data (evidence: `modules/contests.py`)
- Language execution → Configuration: loads judge settings (evidence: `modules/executing.py`)
- Language execution → Shared utilities: uses utilities (evidence: `modules/executing.py`)
- Shared utilities → File locks: locks files (evidence: `modules/tools.py`)
- Judge tasks → Publications: publishes updates (evidence: `modules/tasks.py`)
- Flask application → Configuration: loads settings (evidence: `main.py`)
- Application data → Domain models: serializes domain data (evidence: `modules/datas.py`)
