# subrata-2002/learning-plat architecture

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

- Interactive diagram: https://gitdiagram.com/subrata-2002/learning-plat
- Repository: https://github.com/subrata-2002/learning-plat

## Overview

1. **Overall shape**
   - This is a two-tier e-learning system: a **React/Vite frontend** in `client/` and a **Node.js backend** in `server/`.
   - The main architectural boundary is **browser UI vs. API server**. The frontend handles interaction and rendering; the backend owns question registration and data persistence.

2. **Frontend subsystem**
   - `client/src/main.jsx`, `App.jsx`, and the page components form a single-page application.
   - Pages include `Home`, `Courses`, `Texteditor`, `MyText`, and `Error`, which suggests the UI is split into **landing/search**, **course browsing**, and **question authoring/preview** views.

3. **Frontend data access**
   - `client/src/utils/newRequest.js` is the likely API client wrapper used by the UI to talk to the backend.
   - That makes the frontend mostly a **thin presentation layer** with network calls centralized in one utility rather than spread across pages.

4. **Authoring flow**
   - The readme indicates admins register questions by selecting a **goal**, then associating a **course**, then choosing a **topic**.
   - This implies a hierarchical UI flow: **goal → course → topic → question content/options/solution**.

5. **Question content model**
   - The platform supports multiple question types: **numerical, trigonometric, and calculus-based**.
   - The readme also mentions **hints** and **solutions**, so the question entity is richer than just prompt/answer; it likely stores guidance and explanatory content for students.

6. **Backend subsystem**
   - `server/index.js` is the backend entry point and likely wires together the web server, middleware, database connection, and routes.
   - `server/routes/questionreg.route.js` and `server/routes/regqstn.js` indicate the backend is organized around **question registration endpoints** rather than a broad service surface.

7. **Domain/data layer**
   - The model files `course.model.js`, `goal.model.js`, `topic.model.js`, and `qstn.model.js` define the core domain objects.
   - The model naming strongly suggests a **database-backed domain layer** with separate collections/tables for the educational taxonomy and the registered questions.

8. **Data relationships**
   - The important data dependency is that a question is not standalone: it is linked to a **goal**, a **course**, and a **topic**.
   - For diagramming, treat these as reference entities feeding into the question record, with the question as the central persisted object.

9. **Student-facing usage**
   - The readme describes search functionality for students to find questions by need, which implies the backend also serves **query/filter access** to the stored question set.
   - Student access is therefore read-heavy, while admin registration is write-heavy.

10. **Non-functional/UI tooling**
   - The client uses **Vite** for frontend bundling and SCSS/CSS for styling (`Home.scss`, `Courses.scss`).
   - The repository does not show a separate auth, messaging, or job subsystem, so the architecture appears intentionally small and focused on **content management for learning questions**.

Main entry points: [`client/src/App.jsx`](https://github.com/subrata-2002/learning-plat/blob/main/client/src/App.jsx) (App), [`server/routes/questionreg.route.js`](https://github.com/subrata-2002/learning-plat/blob/main/server/routes/questionreg.route.js) (Question Reg), [`client/src/utils/newRequest.js`](https://github.com/subrata-2002/learning-plat/blob/main/client/src/utils/newRequest.js) (API Client), [`server/models/qstn.model.js`](https://github.com/subrata-2002/learning-plat/blob/main/server/models/qstn.model.js) (Question)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client"]
  node_client_main(("Main<br/>entry<br/>[main.jsx]"))
  node_client_app["App<br/>spa shell<br/>[App.jsx]"]
  node_page_home["Home<br/>page<br/>[Home.jsx]"]
  node_page_courses["Courses<br/>page<br/>[Courses.jsx]"]
  node_page_texteditor["Editor<br/>page<br/>[Texteditor.jsx]"]
  node_page_mytext["My Text<br/>page<br/>[MyText.jsx]"]
  node_page_error["Error<br/>page<br/>[Error.jsx]"]
  node_client_request["API Client<br/>http helper<br/>[newRequest.js]"]
end

subgraph group_server["Server"]
  node_server_entry(("Server<br/>api entry<br/>[index.js]"))
  node_route_questionreg["Question Reg<br/>route module"]
  node_route_regqstn["Reg Qstn<br/>route module<br/>[regqstn.js]"]
  node_flow_search["Search/Read<br/>usage flow"]
end

subgraph group_domain["Domain"]
  node_model_question[("Question<br/>model<br/>[qstn.model.js]")]
  node_model_goal[("Goal<br/>model<br/>[goal.model.js]")]
  node_model_course[("Course<br/>model<br/>[course.model.js]")]
  node_model_topic[("Topic<br/>model<br/>[topic.model.js]")]
  node_flow_taxonomy{{"Goal→Course→Topic<br/>domain flow"}}
  node_flow_content["Hints & Solution<br/>content model"]
end

node_client_main -->|"mounts"| node_client_app
node_client_app -->|"renders"| node_page_home
node_client_app -->|"renders"| node_page_courses
node_client_app -->|"renders"| node_page_texteditor
node_client_app -->|"renders"| node_page_mytext
node_client_app -->|"fallback"| node_page_error
node_page_home -->|"fetches"| node_client_request
node_page_courses -->|"fetches"| node_client_request
node_page_texteditor -->|"posts"| node_client_request
node_page_mytext -->|"fetches"| node_client_request
node_client_request -->|"calls"| node_server_entry
node_server_entry -->|"mounts"| node_route_questionreg
node_server_entry -->|"mounts"| node_route_regqstn
node_route_questionreg -->|"writes/reads"| node_model_question
node_route_questionreg -->|"references"| node_model_goal
node_route_questionreg -->|"references"| node_model_course
node_route_questionreg -->|"references"| node_model_topic
node_route_regqstn -->|"reads"| node_model_question
node_flow_taxonomy -.->|"includes"| node_model_goal
node_flow_taxonomy -.->|"includes"| node_model_course
node_flow_taxonomy -.->|"includes"| node_model_topic
node_flow_taxonomy -.->|"classifies"| node_model_question
node_flow_content -.->|"enriches"| node_model_question
node_flow_search -.->|"queries"| node_route_regqstn

click node_client_main "https://github.com/subrata-2002/learning-plat/blob/main/client/src/main.jsx"
click node_client_app "https://github.com/subrata-2002/learning-plat/blob/main/client/src/App.jsx"
click node_page_home "https://github.com/subrata-2002/learning-plat/blob/main/client/src/pages/Home.jsx"
click node_page_courses "https://github.com/subrata-2002/learning-plat/blob/main/client/src/pages/Courses.jsx"
click node_page_texteditor "https://github.com/subrata-2002/learning-plat/blob/main/client/src/pages/Texteditor.jsx"
click node_page_mytext "https://github.com/subrata-2002/learning-plat/blob/main/client/src/pages/MyText.jsx"
click node_page_error "https://github.com/subrata-2002/learning-plat/blob/main/client/src/pages/Error.jsx"
click node_client_request "https://github.com/subrata-2002/learning-plat/blob/main/client/src/utils/newRequest.js"
click node_server_entry "https://github.com/subrata-2002/learning-plat/blob/main/server/index.js"
click node_route_questionreg "https://github.com/subrata-2002/learning-plat/blob/main/server/routes/questionreg.route.js"
click node_route_regqstn "https://github.com/subrata-2002/learning-plat/blob/main/server/routes/regqstn.js"
click node_model_question "https://github.com/subrata-2002/learning-plat/blob/main/server/models/qstn.model.js"
click node_model_goal "https://github.com/subrata-2002/learning-plat/blob/main/server/models/goal.model.js"
click node_model_course "https://github.com/subrata-2002/learning-plat/blob/main/server/models/course.model.js"
click node_model_topic "https://github.com/subrata-2002/learning-plat/blob/main/server/models/topic.model.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_client_main,node_client_app,node_page_home,node_page_courses,node_page_texteditor,node_page_mytext,node_page_error,node_client_request toneBlue
class node_server_entry,node_route_questionreg,node_route_regqstn,node_flow_search toneAmber
class node_model_question,node_model_goal,node_model_course,node_model_topic,node_flow_taxonomy,node_flow_content toneMint
```

## Components

### Client

React/Vite single-page UI

- [Main](https://github.com/subrata-2002/learning-plat/blob/main/client/src/main.jsx): entry · Bootstraps the React app · `client/src/main.jsx`
- [App](https://github.com/subrata-2002/learning-plat/blob/main/client/src/App.jsx): spa shell · Top-level UI composition and routing · `client/src/App.jsx`
- [Home](https://github.com/subrata-2002/learning-plat/blob/main/client/src/pages/Home.jsx): page · Landing and search entry view · `client/src/pages/Home.jsx`
- [Courses](https://github.com/subrata-2002/learning-plat/blob/main/client/src/pages/Courses.jsx): page · Course browsing and selection view · `client/src/pages/Courses.jsx`
- [Editor](https://github.com/subrata-2002/learning-plat/blob/main/client/src/pages/Texteditor.jsx): page · Question authoring and editing view · `client/src/pages/Texteditor.jsx`
- [My Text](https://github.com/subrata-2002/learning-plat/blob/main/client/src/pages/MyText.jsx): page · Saved text or preview view · `client/src/pages/MyText.jsx`
- [Error](https://github.com/subrata-2002/learning-plat/blob/main/client/src/pages/Error.jsx): page · Fallback error view · `client/src/pages/Error.jsx`
- [API Client](https://github.com/subrata-2002/learning-plat/blob/main/client/src/utils/newRequest.js): http helper · Centralized backend request wrapper · `client/src/utils/newRequest.js`

### Server

Node API and persistence

- [Server](https://github.com/subrata-2002/learning-plat/blob/main/server/index.js): api entry · Starts the API server and wires middleware · `server/index.js`
- [Question Reg](https://github.com/subrata-2002/learning-plat/blob/main/server/routes/questionreg.route.js): route module · Question registration endpoints · `server/routes/questionreg.route.js`
- [Reg Qstn](https://github.com/subrata-2002/learning-plat/blob/main/server/routes/regqstn.js): route module · Additional question registration or query routes · `server/routes/regqstn.js`
- **Search/Read**: usage flow · Student-facing question lookup and filtering

### Domain

Question taxonomy and records

- [Question](https://github.com/subrata-2002/learning-plat/blob/main/server/models/qstn.model.js): model · Persisted question record · `server/models/qstn.model.js`
- [Goal](https://github.com/subrata-2002/learning-plat/blob/main/server/models/goal.model.js): model · Learning goal taxonomy · `server/models/goal.model.js`
- [Course](https://github.com/subrata-2002/learning-plat/blob/main/server/models/course.model.js): model · Course taxonomy · `server/models/course.model.js`
- [Topic](https://github.com/subrata-2002/learning-plat/blob/main/server/models/topic.model.js): model · Topic taxonomy under course/goal · `server/models/topic.model.js`
- **Goal→Course→Topic**: domain flow · Hierarchy used to classify questions
- **Hints & Solution**: content model · Rich question content stored with the prompt

## Connections

- Main → App: mounts · React bootstraps the app shell
- App → Home: renders · Primary landing/search view
- App → Courses: renders · Course browsing view
- App → Editor: renders · Admin authoring view
- App → My Text: renders · Saved text/preview view
- App → Error: fallback · Displays errors or unmatched routes
- Home → API Client: fetches · Home view queries backend data
- Courses → API Client: fetches · Course view loads server data
- Editor → API Client: posts · Authoring submits question data
- My Text → API Client: fetches · Preview or saved content retrieval
- API Client → Server: calls · Browser API traffic reaches the server
- Server → Question Reg: mounts · Registers question-related routes
- Server → Reg Qstn: mounts · Registers additional API routes
- Question Reg → Question: writes/reads · Handles question persistence
- Question Reg → Goal: references · Uses goal taxonomy during registration
- Question Reg → Course: references · Uses course taxonomy during registration
- Question Reg → Topic: references · Uses topic taxonomy during registration
- Reg Qstn → Question: reads · Supports question lookup or registration
- Goal→Course→Topic → Goal: includes · Goal is top-level taxonomy entity
- Goal→Course→Topic → Course: includes · Course sits below goal
- Goal→Course→Topic → Topic: includes · Topic sits below course
- Goal→Course→Topic → Question: classifies · Questions are attached to the taxonomy
- Hints & Solution → Question: enriches · Hints and solutions are stored with questions
- Search/Read → Reg Qstn: queries · Student search and filtering hit read endpoints
