# d01r/algorithmplatform architecture

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

- Interactive diagram: https://gitdiagram.com/d01r/algorithmplatform
- Repository: https://github.com/d01r/algorithmplatform

## Overview

This is a web-based algorithms learning tool: users browse algorithm material and visualizations, submit code for compilation, and can authenticate; the server also generates Word reports. The client routes pages and calls user/compiler APIs, while the Express server dispatches requests to controllers and Sequelize models. The graph preserves the documented visualization, authentication, compilation, and reporting branches. Some API-client and external compiler wiring is unsampled, so those links are marked unverified rather than asserted as source-backed calls.

Main entry points: [`client/src/pages/AlgorithmPage/AlgorithmPage.jsx`](https://github.com/d01r/algorithmplatform/blob/main/client/src/pages/AlgorithmPage/AlgorithmPage.jsx) (Algorithm lessons), [`client/src/routes/AppRouter.jsx`](https://github.com/d01r/algorithmplatform/blob/main/client/src/routes/AppRouter.jsx) (Page routing), [`client/src/pages/MainPage/MainPage.jsx`](https://github.com/d01r/algorithmplatform/blob/main/client/src/pages/MainPage/MainPage.jsx) (Algorithm catalog), [`client/src/pages/CompilerPage/CompilerPage.jsx`](https://github.com/d01r/algorithmplatform/blob/main/client/src/pages/CompilerPage/CompilerPage.jsx) (Code editor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_app["Application shell<br/>[App.jsx]"]
  node_router["Page routing<br/>[AppRouter.jsx]"]
  node_compilerclient["Compiler API client<br/>[compilerAPI.js]"]
  node_userapi["User API client<br/>[userAPI.js]"]
  node_authpage["Sign-in and signup<br/>[AuthPage.jsx]"]
end

subgraph group_learning["Algorithm learning"]
  node_mainpage["Algorithm catalog<br/>[MainPage.jsx]"]
  node_algorithmspage["Algorithm lessons<br/>[AlgorithmPage.jsx]"]
  node_algorithmdata["Algorithm definitions<br/>[algorithms.js]"]
  node_sortview["Sort visualization<br/>[BarSort.jsx]"]
  node_searchview["Search visualization<br/>[BinarySearch.jsx]"]
  node_graphview["Graph visualization<br/>[GraphPaint.jsx]"]
  node_compilerpage["Code editor<br/>[CompilerPage.jsx]"]
  node_languages["Compiler languages"]
end

subgraph group_server["Server services"]
  node_userroutes["User endpoints<br/>[userRouter.js]"]
  node_compileroutes["Compiler endpoint<br/>[compilerRouter.js]"]
  node_reportroutes["Report endpoint"]
  node_compilercontroller["Compilation workflow"]
  node_compilerlogic["Server algorithms<br/>[algorithms.js]"]
  node_compileradapter["Compiler service adapter<br/>[compilerAPI.js]"]
  node_reportcontroller["Word report generation"]
end

subgraph group_identity["Identity and data"]
  node_usercontroller["Account operations<br/>[userController.js]"]
  node_authmiddleware["Token verification<br/>[authMiddleware.js]"]
  node_models[("Account and code records<br/>[models.js]")]
  node_database[("Database connection<br/>[db.js]")]
end

node_learner(("Learner"))
node_externalcompiler{{"Compiler service"}}

node_learner -->|"uses"| node_app
node_app -->|"renders"| node_router
node_learner -.->|"navigates"| node_router
node_router -->|"routes to"| node_mainpage
node_router -->|"routes to"| node_authpage
node_router -->|"routes to"| node_algorithmspage
node_router -->|"routes to"| node_compilerpage
node_mainpage -.->|"links algorithms"| node_algorithmspage
node_mainpage -->|"reads"| node_algorithmdata
node_mainpage -->|"renders cards"| node_algorithmspage
node_algorithmspage -->|"reads"| node_algorithmdata
node_algorithmspage -->|"renders"| node_sortview
node_algorithmspage -->|"renders"| node_searchview
node_algorithmspage -->|"renders"| node_graphview
node_compilerpage -->|"reads"| node_algorithmdata
node_compilerpage -->|"reads"| node_languages
node_compilerpage -->|"submits code"| node_compilerclient
node_compilerclient -.->|"sends request"| node_compileroutes
node_authpage -->|"submits credentials"| node_userapi
node_app -->|"checks session"| node_userapi
node_userapi -.->|"sends request"| node_userroutes
node_userroutes -->|"protects check"| node_authmiddleware
node_userroutes -->|"dispatches"| node_usercontroller
node_usercontroller -->|"reads and writes"| node_models
node_models -->|"connects through"| node_database
node_compileroutes -->|"protects endpoint"| node_authmiddleware
node_compileroutes -->|"dispatches"| node_compilercontroller
node_compilercontroller -->|"selects algorithm"| node_compilerlogic
node_compilercontroller -->|"runs code"| node_compileradapter
node_compileradapter -.->|"delegates"| node_externalcompiler
node_reportroutes -->|"protects endpoint"| node_authmiddleware
node_reportroutes -->|"dispatches"| node_reportcontroller
node_reportcontroller -->|"loads report data"| node_models
node_reportcontroller -->|"uses algorithm details"| node_compilerlogic

click node_app "https://github.com/d01r/algorithmplatform/blob/main/client/src/App.jsx"
click node_router "https://github.com/d01r/algorithmplatform/blob/main/client/src/routes/AppRouter.jsx"
click node_mainpage "https://github.com/d01r/algorithmplatform/blob/main/client/src/pages/MainPage/MainPage.jsx"
click node_algorithmspage "https://github.com/d01r/algorithmplatform/blob/main/client/src/pages/AlgorithmPage/AlgorithmPage.jsx"
click node_algorithmdata "https://github.com/d01r/algorithmplatform/blob/main/client/src/utils/algorithms.js"
click node_sortview "https://github.com/d01r/algorithmplatform/blob/main/client/src/components/BarSort/BarSort.jsx"
click node_searchview "https://github.com/d01r/algorithmplatform/blob/main/client/src/components/BinarySearch/BinarySearch.jsx"
click node_graphview "https://github.com/d01r/algorithmplatform/blob/main/client/src/components/GraphPaint/GraphPaint.jsx"
click node_compilerpage "https://github.com/d01r/algorithmplatform/blob/main/client/src/pages/CompilerPage/CompilerPage.jsx"
click node_languages "https://github.com/d01r/algorithmplatform/blob/main/client/src/utils/languagesCompiler.js"
click node_compilerclient "https://github.com/d01r/algorithmplatform/blob/main/client/src/services/compilerAPI.js"
click node_userapi "https://github.com/d01r/algorithmplatform/blob/main/client/src/services/userAPI.js"
click node_authpage "https://github.com/d01r/algorithmplatform/blob/main/client/src/pages/AuthPage/AuthPage.jsx"
click node_userroutes "https://github.com/d01r/algorithmplatform/blob/main/server/routes/userRouter.js"
click node_compileroutes "https://github.com/d01r/algorithmplatform/blob/main/server/routes/compilerRouter.js"
click node_reportroutes "https://github.com/d01r/algorithmplatform/blob/main/server/routes/reportWordRouter.js"
click node_usercontroller "https://github.com/d01r/algorithmplatform/blob/main/server/controllers/userController.js"
click node_authmiddleware "https://github.com/d01r/algorithmplatform/blob/main/server/middleware/authMiddleware.js"
click node_models "https://github.com/d01r/algorithmplatform/blob/main/server/models/models.js"
click node_database "https://github.com/d01r/algorithmplatform/blob/main/server/db.js"
click node_compilercontroller "https://github.com/d01r/algorithmplatform/blob/main/server/controllers/compilerController.js"
click node_compilerlogic "https://github.com/d01r/algorithmplatform/blob/main/server/utils/algorithms.js"
click node_compileradapter "https://github.com/d01r/algorithmplatform/blob/main/server/services/compilerAPI.js"
click node_reportcontroller "https://github.com/d01r/algorithmplatform/blob/main/server/controllers/reportWordController.js"

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_router,node_compilerclient,node_userapi,node_authpage toneBlue
class node_mainpage,node_algorithmspage,node_algorithmdata,node_sortview,node_searchview,node_graphview,node_compilerpage,node_languages toneAmber
class node_userroutes,node_compileroutes,node_reportroutes,node_compilercontroller,node_compilerlogic,node_compileradapter,node_reportcontroller toneMint
class node_usercontroller,node_authmiddleware,node_models,node_database toneRose
class node_learner,node_externalcompiler toneIndigo
```

## Components

### Client experience

- [Application shell](https://github.com/d01r/algorithmplatform/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Page routing](https://github.com/d01r/algorithmplatform/blob/main/client/src/routes/AppRouter.jsx): `client/src/routes/AppRouter.jsx`
- [Compiler API client](https://github.com/d01r/algorithmplatform/blob/main/client/src/services/compilerAPI.js): `client/src/services/compilerAPI.js`
- [User API client](https://github.com/d01r/algorithmplatform/blob/main/client/src/services/userAPI.js): `client/src/services/userAPI.js`
- [Sign-in and signup](https://github.com/d01r/algorithmplatform/blob/main/client/src/pages/AuthPage/AuthPage.jsx): `client/src/pages/AuthPage/AuthPage.jsx`

### Algorithm learning

- [Algorithm catalog](https://github.com/d01r/algorithmplatform/blob/main/client/src/pages/MainPage/MainPage.jsx): `client/src/pages/MainPage/MainPage.jsx`
- [Algorithm lessons](https://github.com/d01r/algorithmplatform/blob/main/client/src/pages/AlgorithmPage/AlgorithmPage.jsx): `client/src/pages/AlgorithmPage/AlgorithmPage.jsx`
- [Algorithm definitions](https://github.com/d01r/algorithmplatform/blob/main/client/src/utils/algorithms.js): `client/src/utils/algorithms.js`
- [Sort visualization](https://github.com/d01r/algorithmplatform/blob/main/client/src/components/BarSort/BarSort.jsx): `client/src/components/BarSort/BarSort.jsx`
- [Search visualization](https://github.com/d01r/algorithmplatform/blob/main/client/src/components/BinarySearch/BinarySearch.jsx): `client/src/components/BinarySearch/BinarySearch.jsx`
- [Graph visualization](https://github.com/d01r/algorithmplatform/blob/main/client/src/components/GraphPaint/GraphPaint.jsx): `client/src/components/GraphPaint/GraphPaint.jsx`
- [Code editor](https://github.com/d01r/algorithmplatform/blob/main/client/src/pages/CompilerPage/CompilerPage.jsx): `client/src/pages/CompilerPage/CompilerPage.jsx`
- [Compiler languages](https://github.com/d01r/algorithmplatform/blob/main/client/src/utils/languagesCompiler.js): `client/src/utils/languagesCompiler.js`

### Server services

- [User endpoints](https://github.com/d01r/algorithmplatform/blob/main/server/routes/userRouter.js): `server/routes/userRouter.js`
- [Compiler endpoint](https://github.com/d01r/algorithmplatform/blob/main/server/routes/compilerRouter.js): `server/routes/compilerRouter.js`
- [Report endpoint](https://github.com/d01r/algorithmplatform/blob/main/server/routes/reportWordRouter.js): `server/routes/reportWordRouter.js`
- [Compilation workflow](https://github.com/d01r/algorithmplatform/blob/main/server/controllers/compilerController.js): `server/controllers/compilerController.js`
- [Server algorithms](https://github.com/d01r/algorithmplatform/blob/main/server/utils/algorithms.js): `server/utils/algorithms.js`
- [Compiler service adapter](https://github.com/d01r/algorithmplatform/blob/main/server/services/compilerAPI.js): `server/services/compilerAPI.js`
- [Word report generation](https://github.com/d01r/algorithmplatform/blob/main/server/controllers/reportWordController.js): `server/controllers/reportWordController.js`

### Identity and data

- [Account operations](https://github.com/d01r/algorithmplatform/blob/main/server/controllers/userController.js): `server/controllers/userController.js`
- [Token verification](https://github.com/d01r/algorithmplatform/blob/main/server/middleware/authMiddleware.js): `server/middleware/authMiddleware.js`
- [Account and code records](https://github.com/d01r/algorithmplatform/blob/main/server/models/models.js): `server/models/models.js`
- [Database connection](https://github.com/d01r/algorithmplatform/blob/main/server/db.js): `server/db.js`

### Other components

- **Learner**
- **Compiler service**

## Connections

- Learner → Application shell: uses (evidence: `client/src/App.jsx`)
- Application shell → Page routing: renders (evidence: `client/src/App.jsx`)
- Learner → Page routing: navigates
- Page routing → Algorithm catalog: routes to
- Page routing → Sign-in and signup: routes to
- Page routing → Algorithm lessons: routes to
- Page routing → Code editor: routes to
- Algorithm catalog → Algorithm lessons: links algorithms
- Algorithm catalog → Algorithm definitions: reads (evidence: `client/src/pages/MainPage/MainPage.jsx`)
- Algorithm catalog → Algorithm lessons: renders cards (evidence: `client/src/pages/MainPage/MainPage.jsx`)
- Algorithm lessons → Algorithm definitions: reads (evidence: `client/src/pages/AlgorithmPage/AlgorithmPage.jsx`)
- Algorithm lessons → Sort visualization: renders (evidence: `client/src/pages/AlgorithmPage/AlgorithmPage.jsx`)
- Algorithm lessons → Search visualization: renders (evidence: `client/src/pages/AlgorithmPage/AlgorithmPage.jsx`)
- Algorithm lessons → Graph visualization: renders (evidence: `client/src/pages/AlgorithmPage/AlgorithmPage.jsx`)
- Code editor → Algorithm definitions: reads (evidence: `client/src/pages/CompilerPage/CompilerPage.jsx`)
- Code editor → Compiler languages: reads (evidence: `client/src/pages/CompilerPage/CompilerPage.jsx`)
- Code editor → Compiler API client: submits code (evidence: `client/src/pages/CompilerPage/CompilerPage.jsx`)
- Compiler API client → Compiler endpoint: sends request
- Sign-in and signup → User API client: submits credentials (evidence: `client/src/pages/AuthPage/AuthPage.jsx`)
- Application shell → User API client: checks session (evidence: `client/src/App.jsx`)
- User API client → User endpoints: sends request
- User endpoints → Token verification: protects check (evidence: `server/routes/userRouter.js`)
- User endpoints → Account operations: dispatches (evidence: `server/routes/userRouter.js`)
- Account operations → Account and code records: reads and writes (evidence: `server/controllers/userController.js`)
- Account and code records → Database connection: connects through (evidence: `server/models/models.js`)
- Compiler endpoint → Token verification: protects endpoint (evidence: `server/routes/compilerRouter.js`)
- Compiler endpoint → Compilation workflow: dispatches (evidence: `server/routes/compilerRouter.js`)
- Compilation workflow → Server algorithms: selects algorithm (evidence: `server/controllers/compilerController.js`)
- Compilation workflow → Compiler service adapter: runs code (evidence: `server/controllers/compilerController.js`)
- Compiler service adapter → Compiler service: delegates
- Report endpoint → Token verification: protects endpoint (evidence: `server/routes/reportWordRouter.js`)
- Report endpoint → Word report generation: dispatches (evidence: `server/routes/reportWordRouter.js`)
- Word report generation → Account and code records: loads report data (evidence: `server/controllers/reportWordController.js`)
- Word report generation → Server algorithms: uses algorithm details (evidence: `server/controllers/reportWordController.js`)
