# thesoumenmondal/codeforge-backend architecture

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

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

## Overview

CodeForge Backend is an API for a coding-practice platform with user accounts, problem and test-case management, asynchronous code evaluation, and community content. A submission flows from the API through submission handling into a queued evaluation job; a worker loads evaluation data, runs code in a language-specific container, and records the result. The tree also shows articles, posts, sheets, and profile capabilities. Some service, repository, and route implementations were not sampled, so their internal connections are omitted where wiring cannot be confirmed.

Main entry points: [`src/app.ts`](https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/app.ts) (Express app), [`src/common/worker/evaluation.worker.ts`](https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/common/worker/evaluation.worker.ts) (Evaluation worker), [`src/modules/submissions/submission.service.ts`](https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/modules/submissions/submission.service.ts) (Submissions), [`src/common/producer/submission.producer.ts`](https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/common/producer/submission.producer.ts) (Job producer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and identity"]
  node_app["Express app<br/>[app.ts]"]
  node_auth["Authentication<br/>[auth.service.ts]"]
  node_users["User profiles<br/>[user.service.ts]"]
end

subgraph group_practice["Practice and evaluation"]
  node_problems["Problems and tests<br/>[problem.service.ts]"]
  node_stubs["Code stubs"]
  node_submissions["Submissions"]
  node_producer["Job producer"]
  node_queue["Submission queue"]
end

subgraph group_community["Community content"]
  node_articles["Articles"]
  node_posts["Posts and images<br/>[post.service.ts]"]
  node_sheets["Problem sheets<br/>[sheet.service.ts]"]
end

subgraph group_runtime["Evaluation runtime"]
  node_worker["Evaluation worker"]
  node_evaluation["Evaluation data and results"]
  node_executor["Executor selection"]
  node_containers["Language containers"]
end

node_client(("API client"))
node_imagekit["ImageKit"]
node_docker["Docker"]
node_postgres[("PostgreSQL")]
node_redis[("Redis")]

node_client -->|"sends requests"| node_app
node_app -->|"routes auth"| node_auth
node_app -->|"routes users"| node_users
node_app -->|"routes articles"| node_articles
node_app -->|"routes posts"| node_posts
node_app -->|"routes sheets"| node_sheets
node_app -->|"routes problems"| node_problems
node_app -->|"routes submissions"| node_submissions
node_posts -.->|"uploads images"| node_imagekit
node_submissions -->|"requests evaluation"| node_producer
node_producer -->|"enqueues job"| node_queue
node_queue -->|"delivers job"| node_worker
node_worker -->|"loads and updates"| node_evaluation
node_worker -->|"selects executor"| node_executor
node_executor -->|"creates runner"| node_containers
node_containers -->|"runs code"| node_docker
node_worker -->|"connects queue"| node_redis

click node_app "https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/app.ts"
click node_auth "https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/modules/auth/auth.service.ts"
click node_users "https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/modules/users/user.service.ts"
click node_articles "https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/modules/articles/articles.services.ts"
click node_posts "https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/modules/post/post.service.ts"
click node_sheets "https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/modules/sheet/sheet.service.ts"
click node_problems "https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/modules/problems/problem.service.ts"
click node_stubs "https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/modules/problems/code-stub.service.ts"
click node_submissions "https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/modules/submissions/submission.service.ts"
click node_producer "https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/common/producer/submission.producer.ts"
click node_queue "https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/common/queue/submission-queue.ts"
click node_worker "https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/common/worker/evaluation.worker.ts"
click node_evaluation "https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/modules/evaluation/evaluation.service.ts"
click node_executor "https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/common/utils/executor-factory.ts"
click node_containers "https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/common/utils/container/create-container.ts"

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_app,node_auth,node_users,node_client toneBlue
class node_problems,node_stubs,node_submissions,node_producer,node_queue,node_postgres,node_redis toneAmber
class node_articles,node_posts,node_sheets toneMint
class node_worker,node_evaluation,node_executor,node_containers toneRose
class node_imagekit,node_docker toneIndigo
```

## Components

### API and identity

- [Express app](https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/app.ts): `src/app.ts`
- [Authentication](https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/modules/auth/auth.service.ts): `src/modules/auth/auth.service.ts`
- [User profiles](https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/modules/users/user.service.ts): `src/modules/users/user.service.ts`

### Practice and evaluation

- [Problems and tests](https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/modules/problems/problem.service.ts): `src/modules/problems/problem.service.ts`
- [Code stubs](https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/modules/problems/code-stub.service.ts): `src/modules/problems/code-stub.service.ts`
- [Submissions](https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/modules/submissions/submission.service.ts): `src/modules/submissions/submission.service.ts`
- [Job producer](https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/common/producer/submission.producer.ts): `src/common/producer/submission.producer.ts`
- [Submission queue](https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/common/queue/submission-queue.ts): `src/common/queue/submission-queue.ts`

### Community content

- [Articles](https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/modules/articles/articles.services.ts): `src/modules/articles/articles.services.ts`
- [Posts and images](https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/modules/post/post.service.ts): `src/modules/post/post.service.ts`
- [Problem sheets](https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/modules/sheet/sheet.service.ts): `src/modules/sheet/sheet.service.ts`

### Evaluation runtime

- [Evaluation worker](https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/common/worker/evaluation.worker.ts): `src/common/worker/evaluation.worker.ts`
- [Evaluation data and results](https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/modules/evaluation/evaluation.service.ts): `src/modules/evaluation/evaluation.service.ts`
- [Executor selection](https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/common/utils/executor-factory.ts): `src/common/utils/executor-factory.ts`
- [Language containers](https://github.com/thesoumenmondal/codeforge-backend/blob/main/src/common/utils/container/create-container.ts): `src/common/utils/container/create-container.ts`

### Other components

- **API client**
- **ImageKit**
- **Docker**
- **PostgreSQL**
- **Redis**

## Connections

- API client → Express app: sends requests
- Express app → Authentication: routes auth
- Express app → User profiles: routes users
- Express app → Articles: routes articles
- Express app → Posts and images: routes posts
- Express app → Problem sheets: routes sheets
- Express app → Problems and tests: routes problems
- Express app → Submissions: routes submissions
- Posts and images → ImageKit: uploads images
- Submissions → Job producer: requests evaluation
- Job producer → Submission queue: enqueues job
- Submission queue → Evaluation worker: delivers job
- Evaluation worker → Evaluation data and results: loads and updates
- Evaluation worker → Executor selection: selects executor
- Executor selection → Language containers: creates runner
- Language containers → Docker: runs code
- Evaluation worker → Redis: connects queue
