# alok-codes21/mini-project architecture

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

- Interactive diagram: https://gitdiagram.com/alok-codes21/mini-project
- Repository: https://github.com/alok-codes21/mini-project

## Overview

This is a stateless mathematical-learning backend with an additional terminal interface. The main workflow is a client POSTing a matrix or number-conversion question; the API dispatches it to handwritten algorithms that produce a result and instructional trace, then returns JSON. Practice checking reuses those algorithms to locate likely mistakes. Shared trace utilities shape the learning steps, while styling adds optional presentation metadata. The README documents these capabilities; some API wiring is visible only through the source index, so the graph omits unverified internal details.

Main entry points: [`src/app.js`](https://github.com/alok-codes21/mini-project/blob/main/src/app.js) (Express API), [`src/algorithms/matrix.js`](https://github.com/alok-codes21/mini-project/blob/main/src/algorithms/matrix.js) (Matrix operations), [`src/algorithms/number-system.js`](https://github.com/alok-codes21/mini-project/blob/main/src/algorithms/number-system.js) (Base conversion), [`src/cli.js`](https://github.com/alok-codes21/mini-project/blob/main/src/cli.js) (CLI runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["API runtime"]
  node_server["HTTP server<br/>[server.js]"]
  node_api["Express API<br/>[app.js]"]
  node_config["Runtime config<br/>[config.js]"]
  node_openapi["API description<br/>[openapi.json]"]
end

subgraph group_learning["Learning algorithms"]
  node_matrix["Matrix operations<br/>[matrix.js]"]
  node_conversion["Base conversion<br/>[number-system.js]"]
  node_practice["Practice checking<br/>[practice.js]"]
  node_trace["Trace utilities<br/>[common.js]"]
end

subgraph group_presentation["Presentation interfaces"]
  node_terminal["CLI runner<br/>[cli.js]"]
  node_styling["Response styling<br/>[style.js]"]
end

node_client(("API client"))

node_client -->|"sends requests"| node_server
node_server -->|"loads settings"| node_config
node_server -->|"starts"| node_api
node_api -->|"loads settings"| node_config
node_api -->|"dispatches matrix"| node_matrix
node_api -->|"dispatches conversion"| node_conversion
node_api -->|"dispatches practice"| node_practice
node_api -->|"parses detail"| node_trace
node_matrix -->|"builds steps"| node_trace
node_conversion -->|"builds steps"| node_trace
node_practice -->|"checks matrix work"| node_matrix
node_practice -->|"checks conversions"| node_conversion
node_api -->|"adds style hints"| node_styling
node_api -->|"serves description"| node_openapi
node_terminal -->|"runs operations"| node_matrix
node_terminal -->|"runs conversion"| node_conversion
node_terminal -->|"renders output"| node_styling

click node_server "https://github.com/alok-codes21/mini-project/blob/main/src/server.js"
click node_api "https://github.com/alok-codes21/mini-project/blob/main/src/app.js"
click node_config "https://github.com/alok-codes21/mini-project/blob/main/src/config.js"
click node_matrix "https://github.com/alok-codes21/mini-project/blob/main/src/algorithms/matrix.js"
click node_conversion "https://github.com/alok-codes21/mini-project/blob/main/src/algorithms/number-system.js"
click node_practice "https://github.com/alok-codes21/mini-project/blob/main/src/algorithms/practice.js"
click node_trace "https://github.com/alok-codes21/mini-project/blob/main/src/common.js"
click node_terminal "https://github.com/alok-codes21/mini-project/blob/main/src/cli.js"
click node_styling "https://github.com/alok-codes21/mini-project/blob/main/src/style.js"
click node_openapi "https://github.com/alok-codes21/mini-project/blob/main/docs/openapi.json"

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_server,node_api,node_config,node_openapi,node_client toneBlue
class node_matrix,node_conversion,node_practice,node_trace toneAmber
class node_terminal,node_styling toneMint
```

## Components

### API runtime

- [HTTP server](https://github.com/alok-codes21/mini-project/blob/main/src/server.js): `src/server.js`
- [Express API](https://github.com/alok-codes21/mini-project/blob/main/src/app.js): `src/app.js`
- [Runtime config](https://github.com/alok-codes21/mini-project/blob/main/src/config.js): `src/config.js`
- [API description](https://github.com/alok-codes21/mini-project/blob/main/docs/openapi.json): `docs/openapi.json`

### Learning algorithms

- [Matrix operations](https://github.com/alok-codes21/mini-project/blob/main/src/algorithms/matrix.js): `src/algorithms/matrix.js`
- [Base conversion](https://github.com/alok-codes21/mini-project/blob/main/src/algorithms/number-system.js): `src/algorithms/number-system.js`
- [Practice checking](https://github.com/alok-codes21/mini-project/blob/main/src/algorithms/practice.js): `src/algorithms/practice.js`
- [Trace utilities](https://github.com/alok-codes21/mini-project/blob/main/src/common.js): `src/common.js`

### Presentation interfaces

- [CLI runner](https://github.com/alok-codes21/mini-project/blob/main/src/cli.js): `src/cli.js`
- [Response styling](https://github.com/alok-codes21/mini-project/blob/main/src/style.js): `src/style.js`

### Other components

- **API client**

## Connections

- API client → HTTP server: sends requests (evidence: `README.md`)
- HTTP server → Runtime config: loads settings (evidence: `src/server.js`)
- HTTP server → Express API: starts (evidence: `src/server.js`)
- Express API → Runtime config: loads settings (evidence: `src/app.js`)
- Express API → Matrix operations: dispatches matrix (evidence: `src/app.js`)
- Express API → Base conversion: dispatches conversion (evidence: `src/app.js`)
- Express API → Practice checking: dispatches practice (evidence: `src/app.js`)
- Express API → Trace utilities: parses detail (evidence: `src/app.js`)
- Matrix operations → Trace utilities: builds steps (evidence: `src/algorithms/matrix.js`)
- Base conversion → Trace utilities: builds steps (evidence: `src/algorithms/number-system.js`)
- Practice checking → Matrix operations: checks matrix work (evidence: `src/algorithms/practice.js`)
- Practice checking → Base conversion: checks conversions (evidence: `src/algorithms/practice.js`)
- Express API → Response styling: adds style hints (evidence: `src/app.js`)
- Express API → API description: serves description (evidence: `src/app.js`)
- CLI runner → Matrix operations: runs operations (evidence: `src/cli.js`)
- CLI runner → Base conversion: runs conversion (evidence: `src/cli.js`)
- CLI runner → Response styling: renders output (evidence: `src/cli.js`)
