# dsdipu/mentralink architecture

> Architecture diagram of the GitHub repository dsdipu/mentralink, 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/dsdipu/mentralink
- Repository: https://github.com/dsdipu/mentralink

## Overview

MentraLink is a role-based academic mentorship platform. Students, mentors, and administrators enter through the React application, authenticate, and use role-specific workflows for groups, sessions, attendance, evaluations, feedback, and learning content; administrators also manage users and system activity. The frontend communicates with the Express API, which organizes these capabilities into route and controller modules and persists domain records in MongoDB. The README documents Cloudinary media storage and JWT-based security. Some feature-specific backend wiring is unsampled, so those links are represented at the documented subsystem level.

Main entry points: [`backend/src/controllers/auth.controller.js`](https://github.com/dsdipu/mentralink/blob/develop/backend/src/controllers/auth.controller.js) (Account workflows), [`backend/src/app.js`](https://github.com/dsdipu/mentralink/blob/develop/backend/src/app.js) (REST API), [`backend/src/models`](https://github.com/dsdipu/mentralink/tree/develop/backend/src/models) (Domain models), [`Frontend/src/App.jsx`](https://github.com/dsdipu/mentralink/blob/develop/Frontend/src/App.jsx) (React app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_app["React app<br/>[App.jsx]"]
  node_routes["Role-based routes<br/>[AppRoutes.jsx]"]
  node_authcontext["Auth context<br/>[AuthContext.jsx]"]
  node_roleviews["Role dashboards"]
  node_publiccontent["Public resources"]
  node_authservice["Auth client<br/>[authService.js]"]
  node_apiservices["Feature clients"]
end

subgraph group_backend["API and domain"]
  node_api["REST API<br/>[app.js]"]
  node_domainroutes["Domain endpoints"]
  node_domaincontrollers["Mentorship workflows"]
  node_rating["Rating aggregation<br/>[rating.service.js]"]
end

subgraph group_identity["Identity and access"]
  node_authroutes["Auth endpoints<br/>[auth.routes.js]"]
  node_authcontroller["Account workflows<br/>[auth.controller.js]"]
  node_access["Access middleware"]
  node_turnstile["Turnstile verification"]
end

subgraph group_data["State and integrations"]
  node_models["Domain models"]
  node_mongodb[("MongoDB")]
  node_cloudinary[("Cloudinary media")]
  node_email["Email delivery"]
end

node_users(("Students, mentors, admins"))

node_users -->|"use"| node_app
node_app -->|"renders"| node_routes
node_routes -->|"routes"| node_roleviews
node_routes -->|"routes"| node_publiccontent
node_app -->|"provides auth"| node_authcontext
node_roleviews -->|"request data"| node_apiservices
node_publiccontent -->|"request content"| node_apiservices
node_authcontext -->|"uses"| node_authservice
node_authservice -->|"HTTP requests"| node_api
node_apiservices -->|"HTTP requests"| node_api
node_api -->|"mounts"| node_authroutes
node_api -->|"mounts"| node_domainroutes
node_authroutes -->|"dispatches"| node_authcontroller
node_authroutes -->|"protects"| node_access
node_domainroutes -->|"dispatches"| node_domaincontrollers
node_domainroutes -->|"protects"| node_access
node_authcontroller -->|"reads/writes"| node_models
node_domaincontrollers -->|"reads/writes"| node_models
node_rating -->|"reads evaluations"| node_models
node_models -->|"persist records"| node_mongodb
node_authcontroller -.->|"verifies login"| node_turnstile
node_authcontroller -.->|"sends reset code"| node_email
node_domaincontrollers -.->|"stores media"| node_cloudinary

click node_app "https://github.com/dsdipu/mentralink/blob/develop/Frontend/src/App.jsx"
click node_routes "https://github.com/dsdipu/mentralink/blob/develop/Frontend/src/routes/AppRoutes.jsx"
click node_authcontext "https://github.com/dsdipu/mentralink/blob/develop/Frontend/src/context/AuthContext.jsx"
click node_roleviews "https://github.com/dsdipu/mentralink/tree/develop/Frontend/src/pages"
click node_publiccontent "https://github.com/dsdipu/mentralink/tree/develop/Frontend/src/pages/public"
click node_authservice "https://github.com/dsdipu/mentralink/blob/develop/Frontend/src/services/authService.js"
click node_apiservices "https://github.com/dsdipu/mentralink/tree/develop/Frontend/src/services"
click node_api "https://github.com/dsdipu/mentralink/blob/develop/backend/src/app.js"
click node_authroutes "https://github.com/dsdipu/mentralink/blob/develop/backend/src/routes/auth.routes.js"
click node_authcontroller "https://github.com/dsdipu/mentralink/blob/develop/backend/src/controllers/auth.controller.js"
click node_access "https://github.com/dsdipu/mentralink/tree/develop/backend/src/middleware"
click node_domainroutes "https://github.com/dsdipu/mentralink/tree/develop/backend/src/routes"
click node_domaincontrollers "https://github.com/dsdipu/mentralink/tree/develop/backend/src/controllers"
click node_rating "https://github.com/dsdipu/mentralink/blob/develop/backend/src/services/rating.service.js"
click node_models "https://github.com/dsdipu/mentralink/tree/develop/backend/src/models"

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_routes,node_authcontext,node_roleviews,node_publiccontent,node_authservice,node_apiservices toneBlue
class node_api,node_domainroutes,node_domaincontrollers,node_rating toneAmber
class node_authroutes,node_authcontroller,node_access,node_turnstile toneMint
class node_models,node_mongodb,node_cloudinary,node_email toneRose
class node_users toneIndigo
```

## Components

### Web application

- [React app](https://github.com/dsdipu/mentralink/blob/develop/Frontend/src/App.jsx): `Frontend/src/App.jsx`
- [Role-based routes](https://github.com/dsdipu/mentralink/blob/develop/Frontend/src/routes/AppRoutes.jsx): `Frontend/src/routes/AppRoutes.jsx`
- [Auth context](https://github.com/dsdipu/mentralink/blob/develop/Frontend/src/context/AuthContext.jsx): `Frontend/src/context/AuthContext.jsx`
- [Role dashboards](https://github.com/dsdipu/mentralink/tree/develop/Frontend/src/pages): `Frontend/src/pages`
- [Public resources](https://github.com/dsdipu/mentralink/tree/develop/Frontend/src/pages/public): `Frontend/src/pages/public`
- [Auth client](https://github.com/dsdipu/mentralink/blob/develop/Frontend/src/services/authService.js): `Frontend/src/services/authService.js`
- [Feature clients](https://github.com/dsdipu/mentralink/tree/develop/Frontend/src/services): `Frontend/src/services`

### API and domain

- [REST API](https://github.com/dsdipu/mentralink/blob/develop/backend/src/app.js): `backend/src/app.js`
- [Domain endpoints](https://github.com/dsdipu/mentralink/tree/develop/backend/src/routes): `backend/src/routes`
- [Mentorship workflows](https://github.com/dsdipu/mentralink/tree/develop/backend/src/controllers): `backend/src/controllers`
- [Rating aggregation](https://github.com/dsdipu/mentralink/blob/develop/backend/src/services/rating.service.js): `backend/src/services/rating.service.js`

### Identity and access

- [Auth endpoints](https://github.com/dsdipu/mentralink/blob/develop/backend/src/routes/auth.routes.js): `backend/src/routes/auth.routes.js`
- [Account workflows](https://github.com/dsdipu/mentralink/blob/develop/backend/src/controllers/auth.controller.js): `backend/src/controllers/auth.controller.js`
- [Access middleware](https://github.com/dsdipu/mentralink/tree/develop/backend/src/middleware): `backend/src/middleware`
- **Turnstile verification**

### State and integrations

- [Domain models](https://github.com/dsdipu/mentralink/tree/develop/backend/src/models): `backend/src/models`
- **MongoDB**
- **Cloudinary media**
- **Email delivery**

### Other components

- **Students, mentors, admins**

## Connections

- Students, mentors, admins → React app: use
- React app → Role-based routes: renders
- Role-based routes → Role dashboards: routes
- Role-based routes → Public resources: routes
- React app → Auth context: provides auth
- Role dashboards → Feature clients: request data
- Public resources → Feature clients: request content
- Auth context → Auth client: uses
- Auth client → REST API: HTTP requests
- Feature clients → REST API: HTTP requests
- REST API → Auth endpoints: mounts
- REST API → Domain endpoints: mounts
- Auth endpoints → Account workflows: dispatches
- Auth endpoints → Access middleware: protects
- Domain endpoints → Mentorship workflows: dispatches
- Domain endpoints → Access middleware: protects
- Account workflows → Domain models: reads/writes
- Mentorship workflows → Domain models: reads/writes
- Rating aggregation → Domain models: reads evaluations
- Domain models → MongoDB: persist records
- Account workflows → Turnstile verification: verifies login
- Account workflows → Email delivery: sends reset code
- Mentorship workflows → Cloudinary media: stores media
