# lervez5/smarts architecture

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

- Interactive diagram: https://gitdiagram.com/lervez5/smarts
- Repository: https://github.com/lervez5/smarts

## Overview

School OS is a single-school operating system delivered through Admin, Student, Teacher, and Parent portals backed by an Express/Prisma API. The principal workflow is a user entering a role-specific portal, making an authenticated API request, and receiving school-domain data or results. The API also exposes distinct academic, attendance, learning, finance, and communication capabilities. API routing, authentication, scope enforcement, and persistence are shown where excerpts support them; several domain modules are represented from the documented product and file tree, so their internal call relationships are not inferred.

Main entry points: [`services/api/src/routes.ts`](https://github.com/lervez5/smarts/blob/main/services/api/src/routes.ts) (API router), [`services/api/src/infrastructure/database/index.ts`](https://github.com/lervez5/smarts/blob/main/services/api/src/infrastructure/database/index.ts) (Prisma database client), [`services/api/src/modules/auth/controller.ts`](https://github.com/lervez5/smarts/blob/main/services/api/src/modules/auth/controller.ts) (Authentication), [`apps/admin/src/app/(shell)/admin/page.tsx`](https://github.com/lervez5/smarts/blob/main/apps/admin/src/app/(shell)/admin/page.tsx) (Admin portal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portals["User Portals"]
  node_admin["Admin portal<br/>[page.tsx]"]
  node_student["Student portal<br/>[page.tsx]"]
  node_teacher["Teacher portal<br/>[page.tsx]"]
  node_parent["Parent portal<br/>[page.tsx]"]
end

subgraph group_api["API Access"]
  node_api_routes["API router<br/>[routes.ts]"]
  node_auth["Authentication<br/>[controller.ts]"]
  node_access["Auth and permissions<br/>[rbac.ts]"]
  node_scope["School scope<br/>[scope.ts]"]
end

subgraph group_school["School Operations"]
  node_academics["Academic allocation<br/>[service.ts]"]
  node_results["Grading and results<br/>[results-entry.ts]"]
  node_learning["Courses and LMS<br/>[service.ts]"]
  node_attendance["Attendance"]
  node_finance["Finance"]
  node_school_services["Other school services"]
end

subgraph group_platform["Shared Platform"]
  node_database["Prisma database client<br/>[index.ts]"]
end

node_user(("School user"))
node_mongo[("MongoDB")]

node_user -->|"uses"| node_admin
node_user -->|"uses"| node_student
node_user -->|"uses"| node_teacher
node_user -->|"uses"| node_parent
node_admin -->|"requests API"| node_api_routes
node_student -->|"requests API"| node_api_routes
node_teacher -->|"requests API"| node_api_routes
node_parent -->|"requests API"| node_api_routes
node_api_routes -->|"mounts"| node_auth
node_api_routes -->|"mounts"| node_academics
node_api_routes -->|"mounts"| node_results
node_api_routes -->|"mounts"| node_learning
node_api_routes -->|"mounts"| node_attendance
node_api_routes -->|"mounts"| node_finance
node_api_routes -->|"mounts"| node_school_services
node_auth -->|"queries"| node_database
node_auth -->|"sets auth cookies"| node_access
node_academics -->|"reads and writes"| node_database
node_results -->|"reads and writes"| node_database
node_scope -->|"resolves membership"| node_database
node_database -->|"connects through Prisma"| node_mongo

click node_admin "https://github.com/lervez5/smarts/blob/main/apps/admin/src/app/(shell)/admin/page.tsx"
click node_student "https://github.com/lervez5/smarts/blob/main/apps/student/src/app/(shell)/dashboard/page.tsx"
click node_teacher "https://github.com/lervez5/smarts/blob/main/apps/teacher/src/app/(shell)/dashboard/page.tsx"
click node_parent "https://github.com/lervez5/smarts/blob/main/apps/parent/src/app/(shell)/dashboard/page.tsx"
click node_api_routes "https://github.com/lervez5/smarts/blob/main/services/api/src/routes.ts"
click node_auth "https://github.com/lervez5/smarts/blob/main/services/api/src/modules/auth/controller.ts"
click node_access "https://github.com/lervez5/smarts/blob/main/services/api/src/middleware/rbac.ts"
click node_scope "https://github.com/lervez5/smarts/blob/main/services/api/src/modules/settings/scope.ts"
click node_academics "https://github.com/lervez5/smarts/blob/main/services/api/src/modules/academics/allocation/service.ts"
click node_results "https://github.com/lervez5/smarts/blob/main/services/api/src/modules/academics/results-entry.ts"
click node_learning "https://github.com/lervez5/smarts/blob/main/services/api/src/modules/courses/service.ts"
click node_attendance "https://github.com/lervez5/smarts/tree/main/services/api/src/modules/attendance"
click node_finance "https://github.com/lervez5/smarts/tree/main/services/api/src/modules/finance"
click node_school_services "https://github.com/lervez5/smarts/tree/main/services/api/src/modules/communication"
click node_database "https://github.com/lervez5/smarts/blob/main/services/api/src/infrastructure/database/index.ts"

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_admin,node_student,node_teacher,node_parent,node_user toneBlue
class node_api_routes,node_auth,node_access,node_scope,node_mongo toneAmber
class node_academics,node_results,node_learning,node_attendance,node_finance,node_school_services toneMint
class node_database toneRose
```

## Components

### User Portals

- [Admin portal](https://github.com/lervez5/smarts/blob/main/apps/admin/src/app/(shell)/admin/page.tsx): `apps/admin/src/app/(shell)/admin/page.tsx`
- [Student portal](https://github.com/lervez5/smarts/blob/main/apps/student/src/app/(shell)/dashboard/page.tsx): `apps/student/src/app/(shell)/dashboard/page.tsx`
- [Teacher portal](https://github.com/lervez5/smarts/blob/main/apps/teacher/src/app/(shell)/dashboard/page.tsx): `apps/teacher/src/app/(shell)/dashboard/page.tsx`
- [Parent portal](https://github.com/lervez5/smarts/blob/main/apps/parent/src/app/(shell)/dashboard/page.tsx): `apps/parent/src/app/(shell)/dashboard/page.tsx`

### API Access

- [API router](https://github.com/lervez5/smarts/blob/main/services/api/src/routes.ts): `services/api/src/routes.ts`
- [Authentication](https://github.com/lervez5/smarts/blob/main/services/api/src/modules/auth/controller.ts): `services/api/src/modules/auth/controller.ts`
- [Auth and permissions](https://github.com/lervez5/smarts/blob/main/services/api/src/middleware/rbac.ts): `services/api/src/middleware/rbac.ts`
- [School scope](https://github.com/lervez5/smarts/blob/main/services/api/src/modules/settings/scope.ts): `services/api/src/modules/settings/scope.ts`

### School Operations

- [Academic allocation](https://github.com/lervez5/smarts/blob/main/services/api/src/modules/academics/allocation/service.ts): `services/api/src/modules/academics/allocation/service.ts`
- [Grading and results](https://github.com/lervez5/smarts/blob/main/services/api/src/modules/academics/results-entry.ts): `services/api/src/modules/academics/results-entry.ts`
- [Courses and LMS](https://github.com/lervez5/smarts/blob/main/services/api/src/modules/courses/service.ts): `services/api/src/modules/courses/service.ts`
- [Attendance](https://github.com/lervez5/smarts/tree/main/services/api/src/modules/attendance): `services/api/src/modules/attendance`
- [Finance](https://github.com/lervez5/smarts/tree/main/services/api/src/modules/finance): `services/api/src/modules/finance`
- [Other school services](https://github.com/lervez5/smarts/tree/main/services/api/src/modules/communication): `services/api/src/modules/communication`

### Shared Platform

- [Prisma database client](https://github.com/lervez5/smarts/blob/main/services/api/src/infrastructure/database/index.ts): `services/api/src/infrastructure/database/index.ts`

### Other components

- **School user**
- **MongoDB**

## Connections

- School user → Admin portal: uses (evidence: `README.md`)
- School user → Student portal: uses (evidence: `README.md`)
- School user → Teacher portal: uses (evidence: `README.md`)
- School user → Parent portal: uses (evidence: `README.md`)
- Admin portal → API router: requests API (evidence: `README.md`)
- Student portal → API router: requests API (evidence: `README.md`)
- Teacher portal → API router: requests API (evidence: `README.md`)
- Parent portal → API router: requests API (evidence: `README.md`)
- API router → Authentication: mounts (evidence: `services/api/src/routes.ts`)
- API router → Academic allocation: mounts (evidence: `services/api/src/routes.ts`)
- API router → Grading and results: mounts (evidence: `services/api/src/routes.ts`)
- API router → Courses and LMS: mounts (evidence: `services/api/src/routes.ts`)
- API router → Attendance: mounts (evidence: `services/api/src/routes.ts`)
- API router → Finance: mounts (evidence: `services/api/src/routes.ts`)
- API router → Other school services: mounts (evidence: `services/api/src/routes.ts`)
- Authentication → Prisma database client: queries (evidence: `services/api/src/modules/auth/controller.ts`)
- Authentication → Auth and permissions: sets auth cookies (evidence: `services/api/src/modules/auth/controller.ts`)
- Academic allocation → Prisma database client: reads and writes (evidence: `services/api/src/modules/academics/allocation/service.ts`)
- Grading and results → Prisma database client: reads and writes (evidence: `services/api/src/modules/academics/results-entry.ts`)
- School scope → Prisma database client: resolves membership (evidence: `services/api/src/modules/settings/scope.ts`)
- Prisma database client → MongoDB: connects through Prisma (evidence: `README.md`)
