# kak0yt0-che1/rolab-crm architecture

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

- Interactive diagram: https://gitdiagram.com/kak0yt0-che1/rolab-crm
- Repository: https://github.com/kak0yt0-che1/rolab-crm

## Overview

ROLAB is a lesson-management CRM for schools and kindergartens. Admins and teachers use the browser interface to manage schedules and classes; teachers record lesson outcomes and attendance, while administrators also manage organizations, staff, children, payments, and reports. Payment calculation combines client and teacher rates with attendance and lesson prices. The diagram follows the documented API and README capabilities; most route implementations and the teacher-facing UI were not sampled, so uncertain internal call links are omitted.

Main entry points: [`server.js`](https://github.com/kak0yt0-che1/rolab-crm/blob/main/server.js) (Express server), [`database/connection.js`](https://github.com/kak0yt0-che1/rolab-crm/blob/main/database/connection.js) (MongoDB connection), [`routes/payments.js`](https://github.com/kak0yt0-che1/rolab-crm/blob/main/routes/payments.js) (Payments and settlements), [`models`](https://github.com/kak0yt0-che1/rolab-crm/tree/main/models) (Domain records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Browser interface"]
  node_adminui["Admin interface<br/>[admin.js]"]
  node_apihelper["API client<br/>[api.js]"]
end

subgraph group_access["API and access"]
  node_server["Express server<br/>[server.js]"]
  node_authmiddleware["JWT access control<br/>[auth.js]"]
  node_authroutes["Login and account<br/>[auth.js]"]
end

subgraph group_operations["Teaching operations"]
  node_companyroutes["Organizations<br/>[companies.js]"]
  node_teacherroutes["Teachers and rates<br/>[teachers.js]"]
  node_childrenroutes["Children<br/>[children.js]"]
  node_scheduleroutes["Schedule<br/>[schedule.js]"]
  node_drafts["Schedule drafts<br/>[scheduleDrafts.js]"]
  node_lessonroutes["Lessons and substitutions<br/>[lessons.js]"]
  node_attendance["Attendance<br/>[attendance.js]"]
end

subgraph group_finance["Finance and reporting"]
  node_payments["Payments and settlements<br/>[payments.js]"]
  node_billing["Payment rules<br/>[payment.js]"]
  node_reports["Reports and exports<br/>[reports.js]"]
end

subgraph group_data["Persistence"]
  node_dbconn["MongoDB connection<br/>[connection.js]"]
  node_userstore[("User records<br/>[User.js]")]
  node_companystore[("Company records<br/>[Company.js]")]
  node_lessonstore[("Lesson records<br/>[Lesson.js]")]
  node_attendance_store[("Attendance records<br/>[Attendance.js]")]
  node_otherstores[("Domain records")]
end

node_admin(("Administrator"))
node_teacher(("Teacher"))

node_admin -->|"uses"| node_adminui
node_teacher -->|"uses"| node_apihelper
node_adminui -->|"calls"| node_apihelper
node_apihelper -->|"sends requests"| node_server
node_server -->|"dispatches"| node_authroutes
node_server -->|"dispatches"| node_companyroutes
node_server -->|"dispatches"| node_teacherroutes
node_server -->|"dispatches"| node_childrenroutes
node_server -->|"dispatches"| node_scheduleroutes
node_server -->|"dispatches"| node_drafts
node_server -->|"dispatches"| node_lessonroutes
node_server -->|"dispatches"| node_attendance
node_server -->|"dispatches"| node_payments
node_server -->|"dispatches"| node_reports
node_server -->|"connects"| node_dbconn
node_authroutes -->|"checks identity"| node_authmiddleware
node_authroutes -->|"reads and updates"| node_userstore
node_companyroutes -->|"manages"| node_companystore
node_teacherroutes -->|"manages accounts"| node_userstore
node_childrenroutes -->|"manages children"| node_otherstores
node_scheduleroutes -->|"reads and writes"| node_otherstores
node_drafts -->|"manages drafts"| node_otherstores
node_lessonroutes -->|"manages lessons"| node_lessonstore
node_attendance -->|"records marks"| node_attendance_store
node_payments -->|"calculates amounts"| node_billing
node_payments -->|"reads lessons"| node_lessonstore
node_payments -->|"reads attendance"| node_attendance_store
node_payments -->|"reads and updates"| node_otherstores
node_reports -->|"uses calculations"| node_billing
node_reports -->|"reads lesson data"| node_lessonstore
node_dbconn -->|"persists"| node_userstore
node_dbconn -->|"persists"| node_companystore
node_dbconn -->|"persists"| node_lessonstore
node_dbconn -->|"persists"| node_attendance_store
node_dbconn -->|"persists"| node_otherstores

click node_adminui "https://github.com/kak0yt0-che1/rolab-crm/blob/main/public/js/admin.js"
click node_apihelper "https://github.com/kak0yt0-che1/rolab-crm/blob/main/public/js/api.js"
click node_server "https://github.com/kak0yt0-che1/rolab-crm/blob/main/server.js"
click node_authmiddleware "https://github.com/kak0yt0-che1/rolab-crm/blob/main/middleware/auth.js"
click node_authroutes "https://github.com/kak0yt0-che1/rolab-crm/blob/main/routes/auth.js"
click node_companyroutes "https://github.com/kak0yt0-che1/rolab-crm/blob/main/routes/companies.js"
click node_teacherroutes "https://github.com/kak0yt0-che1/rolab-crm/blob/main/routes/teachers.js"
click node_childrenroutes "https://github.com/kak0yt0-che1/rolab-crm/blob/main/routes/children.js"
click node_scheduleroutes "https://github.com/kak0yt0-che1/rolab-crm/blob/main/routes/schedule.js"
click node_drafts "https://github.com/kak0yt0-che1/rolab-crm/blob/main/routes/scheduleDrafts.js"
click node_lessonroutes "https://github.com/kak0yt0-che1/rolab-crm/blob/main/routes/lessons.js"
click node_attendance "https://github.com/kak0yt0-che1/rolab-crm/blob/main/routes/attendance.js"
click node_payments "https://github.com/kak0yt0-che1/rolab-crm/blob/main/routes/payments.js"
click node_billing "https://github.com/kak0yt0-che1/rolab-crm/blob/main/utils/payment.js"
click node_reports "https://github.com/kak0yt0-che1/rolab-crm/blob/main/routes/reports.js"
click node_dbconn "https://github.com/kak0yt0-che1/rolab-crm/blob/main/database/connection.js"
click node_userstore "https://github.com/kak0yt0-che1/rolab-crm/blob/main/models/User.js"
click node_companystore "https://github.com/kak0yt0-che1/rolab-crm/blob/main/models/Company.js"
click node_lessonstore "https://github.com/kak0yt0-che1/rolab-crm/blob/main/models/Lesson.js"
click node_attendance_store "https://github.com/kak0yt0-che1/rolab-crm/blob/main/models/Attendance.js"
click node_otherstores "https://github.com/kak0yt0-che1/rolab-crm/tree/main/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_adminui,node_apihelper toneBlue
class node_server,node_authmiddleware,node_authroutes toneAmber
class node_companyroutes,node_teacherroutes,node_childrenroutes,node_scheduleroutes,node_drafts,node_lessonroutes,node_attendance toneMint
class node_payments,node_billing,node_reports toneRose
class node_dbconn,node_userstore,node_companystore,node_lessonstore,node_attendance_store,node_otherstores,node_admin,node_teacher toneIndigo
```

## Components

### Browser interface

- [Admin interface](https://github.com/kak0yt0-che1/rolab-crm/blob/main/public/js/admin.js): `public/js/admin.js`
- [API client](https://github.com/kak0yt0-che1/rolab-crm/blob/main/public/js/api.js): `public/js/api.js`

### API and access

- [Express server](https://github.com/kak0yt0-che1/rolab-crm/blob/main/server.js): `server.js`
- [JWT access control](https://github.com/kak0yt0-che1/rolab-crm/blob/main/middleware/auth.js): `middleware/auth.js`
- [Login and account](https://github.com/kak0yt0-che1/rolab-crm/blob/main/routes/auth.js): `routes/auth.js`

### Teaching operations

- [Organizations](https://github.com/kak0yt0-che1/rolab-crm/blob/main/routes/companies.js): `routes/companies.js`
- [Teachers and rates](https://github.com/kak0yt0-che1/rolab-crm/blob/main/routes/teachers.js): `routes/teachers.js`
- [Children](https://github.com/kak0yt0-che1/rolab-crm/blob/main/routes/children.js): `routes/children.js`
- [Schedule](https://github.com/kak0yt0-che1/rolab-crm/blob/main/routes/schedule.js): `routes/schedule.js`
- [Schedule drafts](https://github.com/kak0yt0-che1/rolab-crm/blob/main/routes/scheduleDrafts.js): `routes/scheduleDrafts.js`
- [Lessons and substitutions](https://github.com/kak0yt0-che1/rolab-crm/blob/main/routes/lessons.js): `routes/lessons.js`
- [Attendance](https://github.com/kak0yt0-che1/rolab-crm/blob/main/routes/attendance.js): `routes/attendance.js`

### Finance and reporting

- [Payments and settlements](https://github.com/kak0yt0-che1/rolab-crm/blob/main/routes/payments.js): `routes/payments.js`
- [Payment rules](https://github.com/kak0yt0-che1/rolab-crm/blob/main/utils/payment.js): `utils/payment.js`
- [Reports and exports](https://github.com/kak0yt0-che1/rolab-crm/blob/main/routes/reports.js): `routes/reports.js`

### Persistence

- [MongoDB connection](https://github.com/kak0yt0-che1/rolab-crm/blob/main/database/connection.js): `database/connection.js`
- [User records](https://github.com/kak0yt0-che1/rolab-crm/blob/main/models/User.js): `models/User.js`
- [Company records](https://github.com/kak0yt0-che1/rolab-crm/blob/main/models/Company.js): `models/Company.js`
- [Lesson records](https://github.com/kak0yt0-che1/rolab-crm/blob/main/models/Lesson.js): `models/Lesson.js`
- [Attendance records](https://github.com/kak0yt0-che1/rolab-crm/blob/main/models/Attendance.js): `models/Attendance.js`
- [Domain records](https://github.com/kak0yt0-che1/rolab-crm/tree/main/models): `models`

### Other components

- **Administrator**
- **Teacher**

## Connections

- Administrator → Admin interface: uses
- Teacher → API client: uses
- Admin interface → API client: calls
- API client → Express server: sends requests
- Express server → Login and account: dispatches
- Express server → Organizations: dispatches
- Express server → Teachers and rates: dispatches
- Express server → Children: dispatches
- Express server → Schedule: dispatches
- Express server → Schedule drafts: dispatches
- Express server → Lessons and substitutions: dispatches
- Express server → Attendance: dispatches
- Express server → Payments and settlements: dispatches
- Express server → Reports and exports: dispatches
- Express server → MongoDB connection: connects
- Login and account → JWT access control: checks identity
- Login and account → User records: reads and updates
- Organizations → Company records: manages
- Teachers and rates → User records: manages accounts
- Children → Domain records: manages children
- Schedule → Domain records: reads and writes
- Schedule drafts → Domain records: manages drafts
- Lessons and substitutions → Lesson records: manages lessons
- Attendance → Attendance records: records marks
- Payments and settlements → Payment rules: calculates amounts
- Payments and settlements → Lesson records: reads lessons
- Payments and settlements → Attendance records: reads attendance
- Payments and settlements → Domain records: reads and updates
- Reports and exports → Payment rules: uses calculations
- Reports and exports → Lesson records: reads lesson data
- MongoDB connection → User records: persists
- MongoDB connection → Company records: persists
- MongoDB connection → Lesson records: persists
- MongoDB connection → Attendance records: persists
- MongoDB connection → Domain records: persists
