# mayanmanit/codex_ai_project architecture

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

- Interactive diagram: https://gitdiagram.com/mayanmanit/codex_ai_project
- Repository: https://github.com/mayanmanit/codex_ai_project

## Overview

CodeX is a coding-practice and pattern-mastery app. A learner chooses an evaluable problem, submits Python or Java code, and receives a server-side Judge0 verdict; the backend saves the attempt, updates mastery, records feedback and mistakes, and recommends further practice. Separate workflows expose progress analytics and due revisions. The graph includes documented frontend/API connections and sampled backend calls; unsampled subsystems are represented only where the README establishes their capabilities, so some links are intentionally omitted.

Main entry points: [`backend/app/routes/submissions.py`](https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/routes/submissions.py) (Submission workflow), [`backend/app/services/recommendation.py`](https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/services/recommendation.py) (Practice selection), [`backend/app/main.py`](https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/main.py) (FastAPI app), [`backend/app/database.py`](https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/database.py) (Database session)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_learner_ui["Learner interface"]
  node_practice_page["Practice page<br/>[page.tsx]"]
  node_dashboard_page["Progress dashboard<br/>[page.tsx]"]
  node_recommendations_page["Recommendations page<br/>[page.tsx]"]
  node_revisions_page["Revisions page<br/>[page.tsx]"]
  node_frontend_api["Frontend API client<br/>[api.ts]"]
end

subgraph group_api["API workflows"]
  node_api_app["FastAPI app<br/>[main.py]"]
  node_submission_route["Submission workflow<br/>[submissions.py]"]
  node_catalog_routes["Learner and problem routes"]
  node_analytics_routes["Progress and mastery routes<br/>[progress.py]"]
  node_recommendation_route["Recommendation route<br/>[recommendations.py]"]
  node_revision_route["Revision route<br/>[revisions.py]"]
  node_schemas["Request and response schemas"]
end

subgraph group_learning["Learning services"]
  node_evaluator["Code evaluator<br/>[evaluator.py]"]
  node_feedback["Feedback generation<br/>[feedback.py]"]
  node_mastery_service["Mastery updates<br/>[mastery.py]"]
  node_mistake_service["Mistake recording<br/>[mistake.py]"]
  node_recommendation_service["Practice selection<br/>[recommendation.py]"]
  node_revision_service["Revision selection<br/>[revision.py]"]
  node_progress_service["Progress analytics<br/>[progress.py]"]
end

subgraph group_persistence["Persistence"]
  node_database["Database session<br/>[database.py]"]
  node_learner_model["Learner records<br/>[user.py]"]
  node_problem_model["Problem catalog<br/>[problem.py]"]
  node_submission_model["Submission records<br/>[submission.py]"]
  node_mastery_model["Pattern mastery records<br/>[mastery.py]"]
  node_mistake_model["Mistake records<br/>[mistake.py]"]
  node_pattern_model["Pattern catalog<br/>[pattern.py]"]
end

node_learner(("Learner"))
node_sql_store[("SQL database")]
node_judge0["Judge0 sandbox"]

node_learner -->|"practices on"| node_practice_page
node_practice_page -->|"requests through"| node_frontend_api
node_frontend_api -->|"calls backend"| node_api_app
node_learner -->|"views progress"| node_dashboard_page
node_dashboard_page -->|"requests through"| node_frontend_api
node_learner -->|"views suggestions"| node_recommendations_page
node_recommendations_page -->|"requests through"| node_frontend_api
node_learner -->|"views revisions"| node_revisions_page
node_revisions_page -->|"requests through"| node_frontend_api
node_api_app -->|"registers route"| node_submission_route
node_api_app -->|"registers routes"| node_catalog_routes
node_api_app -->|"registers route"| node_analytics_routes
node_api_app -->|"registers route"| node_recommendation_route
node_api_app -->|"registers route"| node_revision_route
node_submission_route -->|"evaluates code"| node_evaluator
node_evaluator -->|"sends code"| node_judge0
node_submission_route -->|"generates feedback"| node_feedback
node_submission_route -->|"updates mastery"| node_mastery_service
node_submission_route -->|"records mistakes"| node_mistake_service
node_submission_route -->|"selects next problem"| node_recommendation_service
node_recommendation_route -->|"requests selection"| node_recommendation_service
node_revision_route -->|"requests revisions"| node_revision_service
node_analytics_routes -.->|"computes progress"| node_progress_service
node_submission_route -->|"opens session"| node_database
node_catalog_routes -->|"opens session"| node_database
node_analytics_routes -->|"opens session"| node_database
node_recommendation_route -->|"opens session"| node_database
node_revision_route -->|"opens session"| node_database
node_database -->|"connects to"| node_sql_store
node_submission_route -->|"persists attempt"| node_submission_model
node_submission_route -->|"loads problem"| node_problem_model
node_submission_route -->|"checks learner"| node_learner_model
node_mastery_service -->|"updates record"| node_mastery_model
node_mistake_service -->|"creates record"| node_mistake_model
node_recommendation_service -->|"reads mastery"| node_mastery_model
node_recommendation_service -->|"selects problem"| node_problem_model
node_recommendation_service -->|"reads history"| node_submission_model
node_recommendation_service -->|"reads patterns"| node_pattern_model
node_revision_service -->|"reuses selection logic"| node_recommendation_service
node_revision_service -->|"checks due mastery"| node_mastery_model
node_revision_service -->|"chooses problem"| node_problem_model
node_submission_route -->|"validates response"| node_schemas
node_recommendation_route -->|"formats response"| node_schemas
node_revision_route -->|"formats response"| node_schemas

click node_practice_page "https://github.com/mayanmanit/codex_ai_project/blob/main/frontend/app/practice/page.tsx"
click node_dashboard_page "https://github.com/mayanmanit/codex_ai_project/blob/main/frontend/app/dashboard/page.tsx"
click node_recommendations_page "https://github.com/mayanmanit/codex_ai_project/blob/main/frontend/app/recommendations/page.tsx"
click node_revisions_page "https://github.com/mayanmanit/codex_ai_project/blob/main/frontend/app/revisions/page.tsx"
click node_frontend_api "https://github.com/mayanmanit/codex_ai_project/blob/main/frontend/app/practice/api.ts"
click node_api_app "https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/main.py"
click node_submission_route "https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/routes/submissions.py"
click node_catalog_routes "https://github.com/mayanmanit/codex_ai_project/tree/main/backend/app/routes"
click node_analytics_routes "https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/routes/progress.py"
click node_recommendation_route "https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/routes/recommendations.py"
click node_revision_route "https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/routes/revisions.py"
click node_evaluator "https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/services/evaluator.py"
click node_feedback "https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/services/feedback.py"
click node_mastery_service "https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/services/mastery.py"
click node_mistake_service "https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/services/mistake.py"
click node_recommendation_service "https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/services/recommendation.py"
click node_revision_service "https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/services/revision.py"
click node_progress_service "https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/routes/progress.py"
click node_schemas "https://github.com/mayanmanit/codex_ai_project/tree/main/backend/app/schemas"
click node_database "https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/database.py"
click node_learner_model "https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/models/user.py"
click node_problem_model "https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/models/problem.py"
click node_submission_model "https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/models/submission.py"
click node_mastery_model "https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/models/mastery.py"
click node_mistake_model "https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/models/mistake.py"
click node_pattern_model "https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/models/pattern.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_practice_page,node_dashboard_page,node_recommendations_page,node_revisions_page,node_frontend_api toneBlue
class node_api_app,node_submission_route,node_catalog_routes,node_analytics_routes,node_recommendation_route,node_revision_route,node_schemas,node_sql_store toneAmber
class node_evaluator,node_feedback,node_mastery_service,node_mistake_service,node_recommendation_service,node_revision_service,node_progress_service toneMint
class node_database,node_learner_model,node_problem_model,node_submission_model,node_mastery_model,node_mistake_model,node_pattern_model toneRose
class node_learner,node_judge0 toneIndigo
```

## Components

### Learner interface

- [Practice page](https://github.com/mayanmanit/codex_ai_project/blob/main/frontend/app/practice/page.tsx): `frontend/app/practice/page.tsx`
- [Progress dashboard](https://github.com/mayanmanit/codex_ai_project/blob/main/frontend/app/dashboard/page.tsx): `frontend/app/dashboard/page.tsx`
- [Recommendations page](https://github.com/mayanmanit/codex_ai_project/blob/main/frontend/app/recommendations/page.tsx): `frontend/app/recommendations/page.tsx`
- [Revisions page](https://github.com/mayanmanit/codex_ai_project/blob/main/frontend/app/revisions/page.tsx): `frontend/app/revisions/page.tsx`
- [Frontend API client](https://github.com/mayanmanit/codex_ai_project/blob/main/frontend/app/practice/api.ts): `frontend/app/practice/api.ts`

### API workflows

- [FastAPI app](https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/main.py): `backend/app/main.py`
- [Submission workflow](https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/routes/submissions.py): `backend/app/routes/submissions.py`
- [Learner and problem routes](https://github.com/mayanmanit/codex_ai_project/tree/main/backend/app/routes): `backend/app/routes`
- [Progress and mastery routes](https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/routes/progress.py): `backend/app/routes/progress.py`
- [Recommendation route](https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/routes/recommendations.py): `backend/app/routes/recommendations.py`
- [Revision route](https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/routes/revisions.py): `backend/app/routes/revisions.py`
- [Request and response schemas](https://github.com/mayanmanit/codex_ai_project/tree/main/backend/app/schemas): `backend/app/schemas`

### Learning services

- [Code evaluator](https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/services/evaluator.py): `backend/app/services/evaluator.py`
- [Feedback generation](https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/services/feedback.py): `backend/app/services/feedback.py`
- [Mastery updates](https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/services/mastery.py): `backend/app/services/mastery.py`
- [Mistake recording](https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/services/mistake.py): `backend/app/services/mistake.py`
- [Practice selection](https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/services/recommendation.py): `backend/app/services/recommendation.py`
- [Revision selection](https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/services/revision.py): `backend/app/services/revision.py`
- [Progress analytics](https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/routes/progress.py): `backend/app/routes/progress.py`

### Persistence

- [Database session](https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/database.py): `backend/app/database.py`
- [Learner records](https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/models/user.py): `backend/app/models/user.py`
- [Problem catalog](https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/models/problem.py): `backend/app/models/problem.py`
- [Submission records](https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/models/submission.py): `backend/app/models/submission.py`
- [Pattern mastery records](https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/models/mastery.py): `backend/app/models/mastery.py`
- [Mistake records](https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/models/mistake.py): `backend/app/models/mistake.py`
- [Pattern catalog](https://github.com/mayanmanit/codex_ai_project/blob/main/backend/app/models/pattern.py): `backend/app/models/pattern.py`

### Other components

- **Learner**
- **SQL database**
- **Judge0 sandbox**

## Connections

- Learner → Practice page: practices on (evidence: `README.md`)
- Practice page → Frontend API client: requests through (evidence: `frontend/app/practice/page.tsx`)
- Frontend API client → FastAPI app: calls backend (evidence: `README.md`)
- Learner → Progress dashboard: views progress (evidence: `README.md`)
- Progress dashboard → Frontend API client: requests through (evidence: `frontend/app/dashboard/page.tsx`)
- Learner → Recommendations page: views suggestions (evidence: `README.md`)
- Recommendations page → Frontend API client: requests through (evidence: `frontend/app/recommendations/page.tsx`)
- Learner → Revisions page: views revisions (evidence: `README.md`)
- Revisions page → Frontend API client: requests through (evidence: `frontend/app/revisions/page.tsx`)
- FastAPI app → Submission workflow: registers route (evidence: `backend/app/main.py`)
- FastAPI app → Learner and problem routes: registers routes (evidence: `backend/app/main.py`)
- FastAPI app → Progress and mastery routes: registers route (evidence: `backend/app/main.py`)
- FastAPI app → Recommendation route: registers route (evidence: `backend/app/main.py`)
- FastAPI app → Revision route: registers route (evidence: `backend/app/main.py`)
- Submission workflow → Code evaluator: evaluates code (evidence: `backend/app/routes/submissions.py`)
- Code evaluator → Judge0 sandbox: sends code (evidence: `README.md`)
- Submission workflow → Feedback generation: generates feedback (evidence: `backend/app/routes/submissions.py`)
- Submission workflow → Mastery updates: updates mastery (evidence: `backend/app/routes/submissions.py`)
- Submission workflow → Mistake recording: records mistakes (evidence: `backend/app/routes/submissions.py`)
- Submission workflow → Practice selection: selects next problem (evidence: `backend/app/routes/submissions.py`)
- Recommendation route → Practice selection: requests selection (evidence: `backend/app/routes/recommendations.py`)
- Revision route → Revision selection: requests revisions (evidence: `backend/app/routes/revisions.py`)
- Progress and mastery routes → Progress analytics: computes progress (evidence: `backend/app/routes/progress.py`)
- Submission workflow → Database session: opens session (evidence: `backend/app/routes/submissions.py`)
- Learner and problem routes → Database session: opens session (evidence: `backend/app/routes/problems.py`)
- Progress and mastery routes → Database session: opens session (evidence: `backend/app/routes/progress.py`)
- Recommendation route → Database session: opens session (evidence: `backend/app/routes/recommendations.py`)
- Revision route → Database session: opens session (evidence: `backend/app/routes/revisions.py`)
- Database session → SQL database: connects to (evidence: `backend/app/database.py`)
- Submission workflow → Submission records: persists attempt (evidence: `backend/app/routes/submissions.py`)
- Submission workflow → Problem catalog: loads problem (evidence: `backend/app/routes/submissions.py`)
- Submission workflow → Learner records: checks learner (evidence: `backend/app/routes/submissions.py`)
- Mastery updates → Pattern mastery records: updates record (evidence: `backend/app/services/mastery.py`)
- Mistake recording → Mistake records: creates record (evidence: `backend/app/services/mistake.py`)
- Practice selection → Pattern mastery records: reads mastery (evidence: `backend/app/services/recommendation.py`)
- Practice selection → Problem catalog: selects problem (evidence: `backend/app/services/recommendation.py`)
- Practice selection → Submission records: reads history (evidence: `backend/app/services/recommendation.py`)
- Practice selection → Pattern catalog: reads patterns (evidence: `backend/app/services/recommendation.py`)
- Revision selection → Practice selection: reuses selection logic (evidence: `backend/app/services/revision.py`)
- Revision selection → Pattern mastery records: checks due mastery (evidence: `backend/app/services/revision.py`)
- Revision selection → Problem catalog: chooses problem (evidence: `backend/app/services/revision.py`)
- Submission workflow → Request and response schemas: validates response (evidence: `backend/app/routes/submissions.py`)
- Recommendation route → Request and response schemas: formats response (evidence: `backend/app/routes/recommendations.py`)
- Revision route → Request and response schemas: formats response (evidence: `backend/app/routes/revisions.py`)
