# mohamedabdelfattah022/codeforge architecture

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

- Interactive diagram: https://gitdiagram.com/mohamedabdelfattah022/codeforge
- Repository: https://github.com/mohamedabdelfattah022/codeforge

## Overview

CodeForge is an online judge for coding practice and ICPC-style contests. Users manage problems and test cases, submit code, and receive evaluation results; contest submissions also support standings. The map follows documented API, asynchronous judging, storage, and caching capabilities, while the excerpts show only selected handlers and service calls. Consequently, some subsystem links are documented at a high level, and unverified runtime connections are omitted or marked dashed.

Main entry points: [`src/CodeForge.Infrastructure/Repositories`](https://github.com/mohamedabdelfattah022/codeforge/tree/master/src/CodeForge.Infrastructure/Repositories) (Data repositories), [`src/CodeForge.Application/Submissions`](https://github.com/mohamedabdelfattah022/codeforge/tree/master/src/CodeForge.Application/Submissions) (Submission handling), [`src/CodeForge.Application/Testcases`](https://github.com/mohamedabdelfattah022/codeforge/tree/master/src/CodeForge.Application/Testcases) (Test case management), [`src/CodeForge.Application/Submissions/Services/SubmissionConsumerService.cs`](https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Application/Submissions/Services/SubmissionConsumerService.cs) (Submission consumer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API"]
  node_problem_api["Problem endpoints"]
  node_submission_api["Submission endpoints"]
  node_contest_api["Contest endpoints"]
  node_tag_api["Tag endpoints<br/>[TagsController.cs]"]
  node_testcase_api["Test case endpoints"]
  node_user_api["User endpoints<br/>[UsersController.cs]"]
end

subgraph group_application["Application workflows"]
  node_problem_workflow["Problem management<br/>[Problems]"]
  node_tag_workflow["Tag management<br/>[Tags]"]
  node_testcase_workflow["Test case management<br/>[Testcases]"]
  node_identity["User and roles<br/>[Users]"]
end

subgraph group_judging["Judging and contests"]
  node_submission_workflow["Submission handling<br/>[Submissions]"]
  node_judge_worker["Submission consumer"]
  node_code_runner["Code execution<br/>[run.py]"]
  node_contest_workflow["Contest management<br/>[Contests]"]
  node_standing_updates["Standing updates"]
end

subgraph group_data["Persistence and storage"]
  node_repositories["Data repositories<br/>[Repositories]"]
  node_database[("SQL data store")]
  node_file_service["File storage service<br/>[SupabaseService.cs]"]
end

subgraph group_integrations["External services"]
  node_queue_service["Message producer and consumer<br/>[MessageProducer.cs]"]
  node_rabbitmq["RabbitMQ"]
  node_supabase["Supabase storage"]
  node_redis[("Redis cache")]
end

node_user(("User"))

node_user -->|"manages problems"| node_problem_api
node_user -->|"submits code"| node_submission_api
node_user -->|"competes in"| node_contest_api
node_user -->|"organizes problems"| node_tag_api
node_user -->|"manages test cases"| node_testcase_api
node_user -->|"uses accounts"| node_user_api
node_problem_api -->|"dispatches commands"| node_problem_workflow
node_submission_api -.->|"dispatches commands"| node_submission_workflow
node_contest_api -->|"dispatches requests"| node_contest_workflow
node_tag_api -->|"dispatches requests"| node_tag_workflow
node_testcase_api -.->|"dispatches requests"| node_testcase_workflow
node_user_api -.->|"dispatches requests"| node_identity
node_submission_workflow -.->|"queues submissions"| node_queue_service
node_queue_service -.->|"sends messages"| node_rabbitmq
node_rabbitmq -.->|"delivers submissions"| node_judge_worker
node_judge_worker -.->|"runs code"| node_code_runner
node_judge_worker -.->|"records verdicts"| node_submission_workflow
node_submission_workflow -.->|"persists submissions"| node_repositories
node_problem_workflow -.->|"persists problems"| node_repositories
node_tag_workflow -.->|"persists tags"| node_repositories
node_testcase_workflow -->|"loads test cases"| node_repositories
node_testcase_workflow -->|"reads test files"| node_file_service
node_file_service -.->|"reads and writes files"| node_supabase
node_repositories -.->|"reads and writes"| node_database
node_contest_workflow -->|"loads contest data"| node_repositories
node_contest_workflow -.->|"updates standings"| node_standing_updates
node_standing_updates -->|"caches standings"| node_redis
node_standing_updates -->|"loads contest results"| node_repositories
node_identity -.->|"stores user accounts"| node_database

click node_problem_api "https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Api/Controllers/ProblemsController.cs"
click node_submission_api "https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Api/Controllers/SubmissionsController.cs"
click node_contest_api "https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Api/Controllers/ContestsController.cs"
click node_tag_api "https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Api/Controllers/TagsController.cs"
click node_testcase_api "https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Api/Controllers/TestcasesController.cs"
click node_user_api "https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Api/Controllers/UsersController.cs"
click node_problem_workflow "https://github.com/mohamedabdelfattah022/codeforge/tree/master/src/CodeForge.Application/Problems"
click node_tag_workflow "https://github.com/mohamedabdelfattah022/codeforge/tree/master/src/CodeForge.Application/Tags"
click node_testcase_workflow "https://github.com/mohamedabdelfattah022/codeforge/tree/master/src/CodeForge.Application/Testcases"
click node_submission_workflow "https://github.com/mohamedabdelfattah022/codeforge/tree/master/src/CodeForge.Application/Submissions"
click node_judge_worker "https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Application/Submissions/Services/SubmissionConsumerService.cs"
click node_code_runner "https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Application/Submissions/scripts/run.py"
click node_contest_workflow "https://github.com/mohamedabdelfattah022/codeforge/tree/master/src/CodeForge.Application/Contests"
click node_standing_updates "https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Infrastructure/Services/StandingUpdateService.cs"
click node_identity "https://github.com/mohamedabdelfattah022/codeforge/tree/master/src/CodeForge.Application/Users"
click node_repositories "https://github.com/mohamedabdelfattah022/codeforge/tree/master/src/CodeForge.Infrastructure/Repositories"
click node_database "https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Infrastructure/Contexts/CodeForgeDbContext.cs"
click node_file_service "https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Infrastructure/Services/SupabaseService.cs"
click node_queue_service "https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Infrastructure/Messaging/MessageProducer.cs"
click node_redis "https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Infrastructure/Services/RedisCacheService.cs"

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_problem_api,node_submission_api,node_contest_api,node_tag_api,node_testcase_api,node_user_api,node_user toneBlue
class node_problem_workflow,node_tag_workflow,node_testcase_workflow,node_identity toneAmber
class node_submission_workflow,node_judge_worker,node_code_runner,node_contest_workflow,node_standing_updates toneMint
class node_repositories,node_database,node_file_service toneRose
class node_queue_service,node_rabbitmq,node_supabase,node_redis toneIndigo
```

## Components

### API

- [Problem endpoints](https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Api/Controllers/ProblemsController.cs): `src/CodeForge.Api/Controllers/ProblemsController.cs`
- [Submission endpoints](https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Api/Controllers/SubmissionsController.cs): `src/CodeForge.Api/Controllers/SubmissionsController.cs`
- [Contest endpoints](https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Api/Controllers/ContestsController.cs): `src/CodeForge.Api/Controllers/ContestsController.cs`
- [Tag endpoints](https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Api/Controllers/TagsController.cs): `src/CodeForge.Api/Controllers/TagsController.cs`
- [Test case endpoints](https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Api/Controllers/TestcasesController.cs): `src/CodeForge.Api/Controllers/TestcasesController.cs`
- [User endpoints](https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Api/Controllers/UsersController.cs): `src/CodeForge.Api/Controllers/UsersController.cs`

### Application workflows

- [Problem management](https://github.com/mohamedabdelfattah022/codeforge/tree/master/src/CodeForge.Application/Problems): `src/CodeForge.Application/Problems`
- [Tag management](https://github.com/mohamedabdelfattah022/codeforge/tree/master/src/CodeForge.Application/Tags): `src/CodeForge.Application/Tags`
- [Test case management](https://github.com/mohamedabdelfattah022/codeforge/tree/master/src/CodeForge.Application/Testcases): `src/CodeForge.Application/Testcases`
- [User and roles](https://github.com/mohamedabdelfattah022/codeforge/tree/master/src/CodeForge.Application/Users): `src/CodeForge.Application/Users`

### Judging and contests

- [Submission handling](https://github.com/mohamedabdelfattah022/codeforge/tree/master/src/CodeForge.Application/Submissions): `src/CodeForge.Application/Submissions`
- [Submission consumer](https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Application/Submissions/Services/SubmissionConsumerService.cs): `src/CodeForge.Application/Submissions/Services/SubmissionConsumerService.cs`
- [Code execution](https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Application/Submissions/scripts/run.py): `src/CodeForge.Application/Submissions/scripts/run.py`
- [Contest management](https://github.com/mohamedabdelfattah022/codeforge/tree/master/src/CodeForge.Application/Contests): `src/CodeForge.Application/Contests`
- [Standing updates](https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Infrastructure/Services/StandingUpdateService.cs): `src/CodeForge.Infrastructure/Services/StandingUpdateService.cs`

### Persistence and storage

- [Data repositories](https://github.com/mohamedabdelfattah022/codeforge/tree/master/src/CodeForge.Infrastructure/Repositories): `src/CodeForge.Infrastructure/Repositories`
- [SQL data store](https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Infrastructure/Contexts/CodeForgeDbContext.cs): `src/CodeForge.Infrastructure/Contexts/CodeForgeDbContext.cs`
- [File storage service](https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Infrastructure/Services/SupabaseService.cs): `src/CodeForge.Infrastructure/Services/SupabaseService.cs`

### External services

- [Message producer and consumer](https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Infrastructure/Messaging/MessageProducer.cs): `src/CodeForge.Infrastructure/Messaging/MessageProducer.cs`
- **RabbitMQ**
- **Supabase storage**
- [Redis cache](https://github.com/mohamedabdelfattah022/codeforge/blob/master/src/CodeForge.Infrastructure/Services/RedisCacheService.cs): `src/CodeForge.Infrastructure/Services/RedisCacheService.cs`

### Other components

- **User**

## Connections

- User → Problem endpoints: manages problems
- User → Submission endpoints: submits code
- User → Contest endpoints: competes in
- User → Tag endpoints: organizes problems
- User → Test case endpoints: manages test cases
- User → User endpoints: uses accounts
- Problem endpoints → Problem management: dispatches commands
- Submission endpoints → Submission handling: dispatches commands (evidence: `src/CodeForge.Api/Controllers/SubmissionsController.cs`)
- Contest endpoints → Contest management: dispatches requests (evidence: `src/CodeForge.Api/Controllers/ContestsController.cs`)
- Tag endpoints → Tag management: dispatches requests (evidence: `src/CodeForge.Api/Controllers/TagsController.cs`)
- Test case endpoints → Test case management: dispatches requests (evidence: `src/CodeForge.Api/Controllers/TestcasesController.cs`)
- User endpoints → User and roles: dispatches requests
- Submission handling → Message producer and consumer: queues submissions
- Message producer and consumer → RabbitMQ: sends messages
- RabbitMQ → Submission consumer: delivers submissions
- Submission consumer → Code execution: runs code
- Submission consumer → Submission handling: records verdicts
- Submission handling → Data repositories: persists submissions
- Problem management → Data repositories: persists problems
- Tag management → Data repositories: persists tags
- Test case management → Data repositories: loads test cases (evidence: `src/CodeForge.Application/Testcases/Queries/GetTestcases/GetTestcasesQueryHandler.cs`)
- Test case management → File storage service: reads test files (evidence: `src/CodeForge.Application/Testcases/Queries/GetTestcases/GetTestcasesQueryHandler.cs`)
- File storage service → Supabase storage: reads and writes files
- Data repositories → SQL data store: reads and writes
- Contest management → Data repositories: loads contest data (evidence: `src/CodeForge.Application/Contests/Queries/GetAllContests/GetContestsQueryHandler.cs`)
- Contest management → Standing updates: updates standings (evidence: `src/CodeForge.Infrastructure/Services/StandingUpdateService.cs`)
- Standing updates → Redis cache: caches standings (evidence: `src/CodeForge.Infrastructure/Services/StandingUpdateService.cs`)
- Standing updates → Data repositories: loads contest results (evidence: `src/CodeForge.Infrastructure/Services/StandingUpdateService.cs`)
- User and roles → SQL data store: stores user accounts
