# hose-ro/sicat architecture

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

## Overview

1. **Repository shape**
   - This is a two-tier monorepo for SICAT: a **React/Vite frontend** and a **NestJS backend**.
   - The backend owns business rules and persistence; the frontend is a role-based client that consumes the API.

2. **Backend application boundary**
   - The backend is organized as NestJS feature modules under `src/`, each exposing its own controller/service pair.
   - `AppModule` is the composition root, and `PrismaService` is the shared persistence boundary to PostgreSQL via Prisma.

3. **Core domain modules**
   - The main business areas are split into modules for **usuarios, carreras, materias, grupos, academias, aulas, horarios, retícula, clases, asistencias, tareas, inscripciones, solicitudes, notificaciones, and reportes**.
   - This suggests a school-management workflow centered on academic structure, scheduling, attendance tracking, assignments, and notifications.

4. **Identity and access control**
   - Authentication is handled in `auth/` with **JWT strategy/guard support** and a **roles guard/decorator** for authorization.
   - This likely gates admin/docente/alumno capabilities across the API and maps to the role-specific frontend pages.

5. **Scheduling and academic structure**
   - `reticula`, `grupos`, `materias`, `academias`, `horarios`, and `aulas` form the planning layer.
   - `horarios` includes conflict-validation utilities and assignment DTOs for docente/aula, indicating the backend enforces schedule consistency rather than leaving it to the client.

6. **Teaching workflow**
   - `clases` appears to model live class sessions, with utilities and an `iniciar-clase` DTO.
   - `asistencias` depends on class/schedule context to register, update, and “pass list,” tying attendance to a specific session rather than a generic record.

7. **Assignments and submissions**
   - `tareas` is a substantial module with create, deliver, review, grade, and bulk-review DTOs.
   - The presence of `tareas.storage.ts` and `tareas.archive.ts` indicates some separation between assignment metadata and file/archive handling, so the backend likely manages both database records and stored submission artifacts.

8. **Student enrollment and requests**
   - `inscripciones` and `solicitudes` cover student-facing enrollment/request flows.
   - These modules likely mediate approval-based actions rather than direct writes, which fits the role-based architecture and workflow approvals.

9. **Persistence model**
   - Prisma migrations show the schema evolved over time to add Google identity linkage, aula, academia, attendance/task/notification expansion, and schedule-attendance relationships.
   - Seed scripts for materias and retículas indicate the system starts with predefined academic catalog data, not just user-generated records.

10. **Frontend application boundary**
    - The frontend is a Vite React app with Tailwind-based UI components and a shared layout system.
    - It uses an API client (`src/api/axios.js`) plus feature stores under `src/store/`, suggesting client state is organized by domain rather than one global monolith.

11. **Role-specific UI flows**
    - The UI is split into **admin**, **docente**, and **alumno** page groups, which mirrors the backend authorization model.
    - Admin views manage academias, grupos, horarios; docentes handle passing attendance, requests, and tasks; alumnos view inscriptions, task details, and attendance.

12. **Notifications and user experience**
    - Notifications exist as both a backend module and frontend components/store, with a dedicated history page and bell UI.
    - The frontend also includes PWA support: service worker, manifest, install prompt, and icon-generation scripts, so the client is intended to behave like an installable app.

13. **Shared frontend building blocks**
    - Common UI primitives live under `components/ui`, while app-wide elements such as `BaseLayout`, `PageHeader`, and `NotificacionesBell` provide consistent navigation and chrome.
    - This makes the frontend architecture a page + component + store composition rather than a heavily framework-driven state machine.

14. **Operational and deployment signals**
    - The repo includes `render.yaml` for backend deployment and `wrangler.jsonc` for the frontend, implying separate deployment targets for each tier.
    - Database setup is external PostgreSQL, and Prisma migrations/seeders are the main infrastructure-management mechanism inside the codebase.

Main entry points: [`backend/src/app.module.ts`](https://github.com/hose-ro/sicat/blob/main/backend/src/app.module.ts) (AppModule), [`frontend/src/App.jsx`](https://github.com/hose-ro/sicat/blob/main/frontend/src/App.jsx) (React App), [`frontend/src/store`](https://github.com/hose-ro/sicat/tree/main/frontend/src/store) (Stores), [`backend/src/prisma.service.ts`](https://github.com/hose-ro/sicat/blob/main/backend/src/prisma.service.ts) (PrismaService)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_backend["Backend"]
  node_backend_app["AppModule<br/>nest composition root<br/>[app.module.ts]"]
  node_backend_auth["Auth<br/>jwt access"]
  node_backend_prisma[("PrismaService<br/>persistence gateway<br/>[prisma.service.ts]")]
  node_backend_usuarios["Usuarios<br/>identity module"]
  node_backend_academics{{"Academic core<br/>domain modules"}}
  node_backend_schedule["Scheduling<br/>planning module"]
  node_backend_clases["Clases<br/>session module"]
  node_backend_asistencias["Asistencias<br/>attendance module"]
  node_backend_tareas["Tareas<br/>assignments"]
  node_backend_inscripciones["Inscripciones<br/>enrollment flow"]
  node_backend_solicitudes["Solicitudes<br/>workflow module"]
  node_backend_notificaciones["Notificaciones<br/>notification module"]
  node_backend_reportes["Reportes<br/>reporting module"]
end

subgraph group_frontend["Frontend"]
  node_frontend_app["React App<br/>vite client<br/>[App.jsx]"]
  node_frontend_api["API client<br/>axios client<br/>[axios.js]"]
  node_frontend_shell["App shell<br/>layout ui<br/>[BaseLayout.jsx]"]
  node_frontend_state{{"Stores<br/>client state"}}
  node_frontend_admin["Admin pages<br/>role UI"]
  node_frontend_docente["Docente pages<br/>role UI"]
  node_frontend_alumno["Alumno pages<br/>role UI"]
  node_frontend_notify["Notifications UI<br/>bell/history"]
  node_frontend_pwa["PWA support<br/>installable client"]
end

node_backend_app -->|"imports"| node_backend_auth
node_backend_app -->|"imports"| node_backend_usuarios
node_backend_app -->|"imports"| node_backend_academics
node_backend_app -->|"imports"| node_backend_schedule
node_backend_app -->|"imports"| node_backend_clases
node_backend_app -->|"imports"| node_backend_asistencias
node_backend_app -->|"imports"| node_backend_tareas
node_backend_app -->|"imports"| node_backend_inscripciones
node_backend_app -->|"imports"| node_backend_solicitudes
node_backend_app -->|"imports"| node_backend_notificaciones
node_backend_app -->|"imports"| node_backend_reportes
node_backend_auth -->|"authenticates"| node_backend_usuarios
node_backend_usuarios -->|"persists via"| node_backend_prisma
node_backend_academics -->|"persists via"| node_backend_prisma
node_backend_schedule -->|"persists via"| node_backend_prisma
node_backend_schedule -->|"depends on"| node_backend_academics
node_backend_clases -->|"depends on"| node_backend_schedule
node_backend_asistencias -->|"depends on"| node_backend_clases
node_backend_tareas -->|"persists via"| node_backend_prisma
node_backend_inscripciones -->|"depends on"| node_backend_academics
node_backend_notificaciones -->|"persists via"| node_backend_prisma
node_frontend_app -->|"uses"| node_frontend_shell
node_frontend_app -->|"calls"| node_frontend_api
node_frontend_app -->|"coordinates"| node_frontend_state
node_frontend_app -->|"routes to"| node_frontend_admin
node_frontend_app -->|"routes to"| node_frontend_docente
node_frontend_app -->|"routes to"| node_frontend_alumno
node_frontend_app -->|"uses"| node_frontend_notify
node_frontend_app -->|"supports"| node_frontend_pwa
node_frontend_state -->|"fetches via"| node_frontend_api
node_frontend_admin -->|"reads/writes"| node_frontend_state
node_frontend_docente -->|"reads/writes"| node_frontend_state
node_frontend_alumno -->|"reads/writes"| node_frontend_state
node_frontend_notify -->|"reads"| node_frontend_state

click node_backend_app "https://github.com/hose-ro/sicat/blob/main/backend/src/app.module.ts"
click node_backend_auth "https://github.com/hose-ro/sicat/tree/main/backend/src/auth"
click node_backend_prisma "https://github.com/hose-ro/sicat/blob/main/backend/src/prisma.service.ts"
click node_backend_usuarios "https://github.com/hose-ro/sicat/tree/main/backend/src/usuarios"
click node_backend_academics "https://github.com/hose-ro/sicat/tree/main/backend/src"
click node_backend_schedule "https://github.com/hose-ro/sicat/tree/main/backend/src/horarios"
click node_backend_clases "https://github.com/hose-ro/sicat/tree/main/backend/src/clases"
click node_backend_asistencias "https://github.com/hose-ro/sicat/tree/main/backend/src/asistencias"
click node_backend_tareas "https://github.com/hose-ro/sicat/tree/main/backend/src/tareas"
click node_backend_inscripciones "https://github.com/hose-ro/sicat/tree/main/backend/src/inscripciones"
click node_backend_solicitudes "https://github.com/hose-ro/sicat/tree/main/backend/src/solicitudes"
click node_backend_notificaciones "https://github.com/hose-ro/sicat/tree/main/backend/src/notificaciones"
click node_backend_reportes "https://github.com/hose-ro/sicat/tree/main/backend/src/reportes"
click node_frontend_app "https://github.com/hose-ro/sicat/blob/main/frontend/src/App.jsx"
click node_frontend_api "https://github.com/hose-ro/sicat/blob/main/frontend/src/api/axios.js"
click node_frontend_shell "https://github.com/hose-ro/sicat/blob/main/frontend/src/components/layout/BaseLayout.jsx"
click node_frontend_state "https://github.com/hose-ro/sicat/tree/main/frontend/src/store"
click node_frontend_admin "https://github.com/hose-ro/sicat/tree/main/frontend/src/pages/admin"
click node_frontend_docente "https://github.com/hose-ro/sicat/tree/main/frontend/src/pages/docente"
click node_frontend_alumno "https://github.com/hose-ro/sicat/tree/main/frontend/src/pages/alumno"
click node_frontend_notify "https://github.com/hose-ro/sicat/blob/main/frontend/src/components/shared/NotificacionesBell.jsx"
click node_frontend_pwa "https://github.com/hose-ro/sicat/blob/main/frontend/public/manifest.webmanifest"

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_backend_app,node_backend_auth,node_backend_prisma,node_backend_usuarios,node_backend_academics,node_backend_schedule,node_backend_clases,node_backend_asistencias,node_backend_tareas,node_backend_inscripciones,node_backend_solicitudes,node_backend_notificaciones,node_backend_reportes toneBlue
class node_frontend_app,node_frontend_api,node_frontend_shell,node_frontend_state,node_frontend_admin,node_frontend_docente,node_frontend_alumno,node_frontend_notify,node_frontend_pwa toneAmber
```

## Components

### Backend

NestJS API, domain modules, and persistence.

- [AppModule](https://github.com/hose-ro/sicat/blob/main/backend/src/app.module.ts): nest composition root · Bootstraps the API and wires feature modules together. · `backend/src/app.module.ts`
- [Auth](https://github.com/hose-ro/sicat/tree/main/backend/src/auth): jwt access · Login, registration, JWT strategy/guard, and role-based authorization. · `backend/src/auth`
- [PrismaService](https://github.com/hose-ro/sicat/blob/main/backend/src/prisma.service.ts): persistence gateway · Shared Prisma boundary to PostgreSQL and database access across modules. · `backend/src/prisma.service.ts`
- [Usuarios](https://github.com/hose-ro/sicat/tree/main/backend/src/usuarios): identity module · User management and account data. · `backend/src/usuarios`
- [Academic core](https://github.com/hose-ro/sicat/tree/main/backend/src): domain modules · Carreras, materias, academias, retícula, grupos, unidades, and aulas as the academic structure layer. · `backend/src`
- [Scheduling](https://github.com/hose-ro/sicat/tree/main/backend/src/horarios): planning module · Horarios with conflict validation plus docente/aula assignment. · `backend/src/horarios`
- [Clases](https://github.com/hose-ro/sicat/tree/main/backend/src/clases): session module · Live class sessions and start-class workflow. · `backend/src/clases`
- [Asistencias](https://github.com/hose-ro/sicat/tree/main/backend/src/asistencias): attendance module · Attendance registration, updates, and passing the list for a class session. · `backend/src/asistencias`
- [Tareas](https://github.com/hose-ro/sicat/tree/main/backend/src/tareas): assignments · Assignment creation, delivery, review, grading, and artifact storage/archive handling. · `backend/src/tareas`
- [Inscripciones](https://github.com/hose-ro/sicat/tree/main/backend/src/inscripciones): enrollment flow · Student enrollment requests and approval-oriented submission flow. · `backend/src/inscripciones`
- [Solicitudes](https://github.com/hose-ro/sicat/tree/main/backend/src/solicitudes): workflow module · Generic request handling used by role-based approval flows. · `backend/src/solicitudes`
- [Notificaciones](https://github.com/hose-ro/sicat/tree/main/backend/src/notificaciones): notification module · Notification creation, delivery, and history support. · `backend/src/notificaciones`
- [Reportes](https://github.com/hose-ro/sicat/tree/main/backend/src/reportes): reporting module · Reporting endpoints and summary views over academic data. · `backend/src/reportes`

### Frontend

React/Vite client, role-based pages, and shared UI.

- [React App](https://github.com/hose-ro/sicat/blob/main/frontend/src/App.jsx): vite client · Main frontend composition with routing, layout, and UI shell. · `frontend/src/App.jsx`
- [API client](https://github.com/hose-ro/sicat/blob/main/frontend/src/api/axios.js): axios client · Shared HTTP client used by feature stores and pages. · `frontend/src/api/axios.js`
- [App shell](https://github.com/hose-ro/sicat/blob/main/frontend/src/components/layout/BaseLayout.jsx): layout ui · BaseLayout, PageHeader, navigation, branding, and shared UI primitives. · `frontend/src/components/layout/BaseLayout.jsx`
- [Stores](https://github.com/hose-ro/sicat/tree/main/frontend/src/store): client state · Domain-oriented stores for auth, grupos, horarios, tareas, inscripciones, asistencia, clase, and notificaciones. · `frontend/src/store`
- [Admin pages](https://github.com/hose-ro/sicat/tree/main/frontend/src/pages/admin): role UI · Academias, grupos, and horarios management screens. · `frontend/src/pages/admin`
- [Docente pages](https://github.com/hose-ro/sicat/tree/main/frontend/src/pages/docente): role UI · Passing attendance, handling solicitudes, and managing tareas. · `frontend/src/pages/docente`
- [Alumno pages](https://github.com/hose-ro/sicat/tree/main/frontend/src/pages/alumno): role UI · Enrollment, task detail, and attendance views for students. · `frontend/src/pages/alumno`
- [Notifications UI](https://github.com/hose-ro/sicat/blob/main/frontend/src/components/shared/NotificacionesBell.jsx): bell/history · Frontend notification bell, history page, and notification helpers. · `frontend/src/components/shared/NotificacionesBell.jsx`
- [PWA support](https://github.com/hose-ro/sicat/blob/main/frontend/public/manifest.webmanifest): installable client · Service worker, manifest, install prompt, and icon generation scripts. · `frontend/public/manifest.webmanifest`

## Connections

- AppModule → Auth: imports · Composition root includes authentication.
- AppModule → Usuarios: imports · User module participates in the API.
- AppModule → Academic core: imports · Core academic modules are wired into the app.
- AppModule → Scheduling: imports · Scheduling is part of the main API surface.
- AppModule → Clases: imports · Class-session module is registered.
- AppModule → Asistencias: imports · Attendance module is registered.
- AppModule → Tareas: imports · Assignments module is registered.
- AppModule → Inscripciones: imports · Enrollment flows are registered.
- AppModule → Solicitudes: imports · Request workflows are registered.
- AppModule → Notificaciones: imports · Notification module is registered.
- AppModule → Reportes: imports · Reporting module is registered.
- Auth → Usuarios: authenticates · Login and registration act on user accounts.
- Usuarios → PrismaService: persists via · Users are stored through Prisma.
- Academic core → PrismaService: persists via · Academic structure modules share the database gateway.
- Scheduling → PrismaService: persists via · Schedules and assignments are persisted through Prisma.
- Scheduling → Academic core: depends on · Schedules are built from groups, materias, and aulas.
- Clases → Scheduling: depends on · Class sessions are tied to scheduled context.
- Asistencias → Clases: depends on · Attendance is recorded per class session.
- Tareas → PrismaService: persists via · Assignments and submissions are stored through Prisma.
- Inscripciones → Academic core: depends on · Enrollment requests reference academic structure.
- Notificaciones → PrismaService: persists via · Notifications are stored and queried from the database.
- React App → App shell: uses · App is wrapped by shared layout and UI chrome.
- React App → API client: calls · Pages and stores use the shared HTTP client.
- React App → Stores: coordinates · Feature screens are backed by domain stores.
- React App → Admin pages: routes to · Admin role pages are part of the app.
- React App → Docente pages: routes to · Docente role pages are part of the app.
- React App → Alumno pages: routes to · Alumno role pages are part of the app.
- React App → Notifications UI: uses · Notifications are surfaced in the shell and pages.
- React App → PWA support: supports · Client includes installable app behavior.
- Stores → API client: fetches via · Stores orchestrate API requests.
- Admin pages → Stores: reads/writes · Admin screens work through shared domain stores.
- Docente pages → Stores: reads/writes · Teacher screens work through shared domain stores.
- Alumno pages → Stores: reads/writes · Student screens work through shared domain stores.
- Notifications UI → Stores: reads · Notification UI reflects notification store state.
