# dgusgus/sistema-educativo-backend architecture

> Architecture diagram of the GitHub repository dgusgus/sistema-educativo-backend, 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/dgusgus/sistema-educativo-backend
- Repository: https://github.com/dgusgus/sistema-educativo-backend

## Overview

This is an Express API for managing school operations: users and roles, people and enrollment, academic structures, attendance, evaluation, payments, and reports. The principal workflow is a client request entering the mounted API routes, passing authentication and role checks, reaching a domain controller, and reading or changing PostgreSQL data through Prisma. The graph also shows the documented boletín and spreadsheet-import capabilities. Several route/controller and controller/database links rely on SOURCE INDEX references; unsampled behavior is not expanded beyond those references.

Main entry points: [`src/routes`](https://github.com/dgusgus/sistema-educativo-backend/tree/main/src/routes) (API routes), [`src/lib/prisma.ts`](https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/lib/prisma.ts) (Prisma access), [`src/controllers/estudiante.controller.ts`](https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/controllers/estudiante.controller.ts) (People management), [`src/controllers/tutor.controller.ts`](https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/controllers/tutor.controller.ts) (Tutor management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and access"]
  node_app["Express application<br/>[app.ts]"]
  node_routes["API routes"]
  node_auth["Authentication<br/>[auth.middleware.ts]"]
  node_rbac["Role checks<br/>[rbac.middleware.ts]"]
end

subgraph group_people["People and enrollment"]
  node_peoplectl["People management"]
  node_tutorctl["Tutor management"]
  node_docentectl["Teacher management"]
  node_person["Person helper<br/>[persona.helper.ts]"]
end

subgraph group_school["Academic operations"]
  node_academicroots["Academic structure"]
  node_attendance["Attendance"]
end

subgraph group_reporting["Assessment and reporting"]
  node_assessment["Evaluation and grades"]
  node_bulletins["Bulletins and records"]
  node_bulletinservice["Bulletin calculations<br/>[boletin.service.ts]"]
  node_pdf["PDF output<br/>[pdf.ts]"]
end

subgraph group_shared["Shared data access"]
  node_excel["Spreadsheet import/export<br/>[excel.helper.ts]"]
  node_prisma["Prisma access<br/>[prisma.ts]"]
end

node_client(("API client"))
node_database[("PostgreSQL database")]

node_client -->|"sends requests"| node_app
node_app -->|"mounts routes"| node_routes
node_routes -->|"authenticates"| node_auth
node_routes -->|"checks roles"| node_rbac
node_routes -->|"dispatches"| node_bulletins
node_routes -->|"dispatches"| node_attendance
node_routes -->|"dispatches"| node_assessment
node_routes -->|"dispatches"| node_peoplectl
node_routes -->|"dispatches"| node_tutorctl
node_routes -->|"dispatches"| node_docentectl
node_app -->|"mounts domains"| node_academicroots
node_peoplectl -->|"creates profiles"| node_person
node_tutorctl -->|"creates profiles"| node_person
node_peoplectl -->|"imports sheets"| node_excel
node_tutorctl -->|"imports sheets"| node_excel
node_bulletins -->|"requests calculations"| node_bulletinservice
node_bulletins -->|"generates PDFs"| node_pdf
node_peoplectl -->|"reads and writes"| node_prisma
node_tutorctl -->|"reads and writes"| node_prisma
node_docentectl -->|"reads and writes"| node_prisma
node_attendance -->|"reads and writes"| node_prisma
node_assessment -->|"reads and writes"| node_prisma
node_bulletins -->|"reads data"| node_prisma
node_bulletinservice -->|"queries data"| node_prisma
node_auth -->|"checks account"| node_prisma
node_prisma -->|"queries"| node_database

click node_app "https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/app.ts"
click node_routes "https://github.com/dgusgus/sistema-educativo-backend/tree/main/src/routes"
click node_auth "https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/middlewares/auth.middleware.ts"
click node_rbac "https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/middlewares/rbac.middleware.ts"
click node_peoplectl "https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/controllers/estudiante.controller.ts"
click node_tutorctl "https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/controllers/tutor.controller.ts"
click node_docentectl "https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/controllers/docente.controller.ts"
click node_person "https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/lib/persona.helper.ts"
click node_academicroots "https://github.com/dgusgus/sistema-educativo-backend/tree/main/src/routes"
click node_attendance "https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/controllers/asistencia.controller.ts"
click node_assessment "https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/controllers/evaluacion.controller.ts"
click node_bulletins "https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/controllers/boletin.controller.ts"
click node_bulletinservice "https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/services/boletin.service.ts"
click node_pdf "https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/lib/pdf.ts"
click node_excel "https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/lib/excel.helper.ts"
click node_prisma "https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/lib/prisma.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_app,node_routes,node_auth,node_rbac,node_client toneBlue
class node_peoplectl,node_tutorctl,node_docentectl,node_person,node_database toneAmber
class node_academicroots,node_attendance toneMint
class node_assessment,node_bulletins,node_bulletinservice,node_pdf toneRose
class node_excel,node_prisma toneIndigo
```

## Components

### API and access

- [Express application](https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/app.ts): `src/app.ts`
- [API routes](https://github.com/dgusgus/sistema-educativo-backend/tree/main/src/routes): `src/routes`
- [Authentication](https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/middlewares/auth.middleware.ts): `src/middlewares/auth.middleware.ts`
- [Role checks](https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/middlewares/rbac.middleware.ts): `src/middlewares/rbac.middleware.ts`

### People and enrollment

- [People management](https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/controllers/estudiante.controller.ts): `src/controllers/estudiante.controller.ts`
- [Tutor management](https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/controllers/tutor.controller.ts): `src/controllers/tutor.controller.ts`
- [Teacher management](https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/controllers/docente.controller.ts): `src/controllers/docente.controller.ts`
- [Person helper](https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/lib/persona.helper.ts): `src/lib/persona.helper.ts`

### Academic operations

- [Academic structure](https://github.com/dgusgus/sistema-educativo-backend/tree/main/src/routes): `src/routes`
- [Attendance](https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/controllers/asistencia.controller.ts): `src/controllers/asistencia.controller.ts`

### Assessment and reporting

- [Evaluation and grades](https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/controllers/evaluacion.controller.ts): `src/controllers/evaluacion.controller.ts`
- [Bulletins and records](https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/controllers/boletin.controller.ts): `src/controllers/boletin.controller.ts`
- [Bulletin calculations](https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/services/boletin.service.ts): `src/services/boletin.service.ts`
- [PDF output](https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/lib/pdf.ts): `src/lib/pdf.ts`

### Shared data access

- [Spreadsheet import/export](https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/lib/excel.helper.ts): `src/lib/excel.helper.ts`
- [Prisma access](https://github.com/dgusgus/sistema-educativo-backend/blob/main/src/lib/prisma.ts): `src/lib/prisma.ts`

### Other components

- **API client**
- **PostgreSQL database**

## Connections

- API client → Express application: sends requests (evidence: `src/app.ts`)
- Express application → API routes: mounts routes (evidence: `src/app.ts`)
- API routes → Authentication: authenticates (evidence: `src/routes/boletin.routes.ts`)
- API routes → Role checks: checks roles (evidence: `src/routes/boletin.routes.ts`)
- API routes → Bulletins and records: dispatches (evidence: `src/routes/boletin.routes.ts`)
- API routes → Attendance: dispatches (evidence: `src/routes/asistencia.routes.ts`)
- API routes → Evaluation and grades: dispatches (evidence: `src/routes/evaluacion.routes.ts`)
- API routes → People management: dispatches (evidence: `src/routes/estudiante.routes.ts`)
- API routes → Tutor management: dispatches (evidence: `src/routes/tutor.routes.ts`)
- API routes → Teacher management: dispatches (evidence: `src/routes/docente.routes.ts`)
- Express application → Academic structure: mounts domains (evidence: `src/app.ts`)
- People management → Person helper: creates profiles (evidence: `src/controllers/estudiante.controller.ts`)
- Tutor management → Person helper: creates profiles (evidence: `src/controllers/tutor.controller.ts`)
- People management → Spreadsheet import/export: imports sheets (evidence: `src/controllers/estudiante.controller.ts`)
- Tutor management → Spreadsheet import/export: imports sheets (evidence: `src/controllers/tutor.controller.ts`)
- Bulletins and records → Bulletin calculations: requests calculations (evidence: `src/controllers/boletin.controller.ts`)
- Bulletins and records → PDF output: generates PDFs (evidence: `src/controllers/boletin.controller.ts`)
- People management → Prisma access: reads and writes (evidence: `src/controllers/estudiante.controller.ts`)
- Tutor management → Prisma access: reads and writes (evidence: `src/controllers/tutor.controller.ts`)
- Teacher management → Prisma access: reads and writes (evidence: `src/controllers/docente.controller.ts`)
- Attendance → Prisma access: reads and writes (evidence: `src/controllers/asistencia.controller.ts`)
- Evaluation and grades → Prisma access: reads and writes (evidence: `src/controllers/evaluacion.controller.ts`)
- Bulletins and records → Prisma access: reads data (evidence: `src/controllers/boletin.controller.ts`)
- Bulletin calculations → Prisma access: queries data (evidence: `src/services/boletin.service.ts`)
- Authentication → Prisma access: checks account (evidence: `src/middlewares/auth.middleware.ts`)
- Prisma access → PostgreSQL database: queries (evidence: `src/lib/prisma.ts`)
