# jinllo/p3.1c architecture

> Architecture diagram of the GitHub repository jinllo/p3.1c, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jinllo/p3.1c
- Repository: https://github.com/jinllo/p3.1c

## Overview

Libro de Clases Virtual is a school-attendance management system with a FastAPI backend and web and mobile clients. Users authenticate and then manage students, courses, attendance, reports, calendar events, and notifications; administrators also manage users and roles. The backend exposes these capabilities through API routers and stores domain records in a relational database. The README documents product features not all sampled in source; edges for those capabilities cite the README, while source-level wiring is limited to the excerpts and index shown.

Main entry points: [`backend/app/main.py`](https://github.com/jinllo/p3.1c/blob/master/backend/app/main.py) (FastAPI application), [`backend/app/core/database.py`](https://github.com/jinllo/p3.1c/blob/master/backend/app/core/database.py) (Relational database), [`backend/app/api/auth.py`](https://github.com/jinllo/p3.1c/blob/master/backend/app/api/auth.py) (Authentication API), [`backend/app/api/attendance.py`](https://github.com/jinllo/p3.1c/blob/master/backend/app/api/attendance.py) (Attendance API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["User clients"]
  node_webapp["Web application<br/>[App.tsx]"]
  node_mobileapp["Mobile application"]
end

subgraph group_identity["Identity and access"]
  node_web_auth["Web session<br/>[AuthContext.tsx]"]
  node_mobile_auth["Mobile session<br/>[AuthContext.tsx]"]
  node_firebase["Firebase auth<br/>[firebaseAuth.ts]"]
  node_auth_api["Authentication API<br/>[auth.py]"]
  node_permissions["Role permissions<br/>[permissions.py]"]
end

subgraph group_school["School operations"]
  node_student_ui["Student management<br/>[StudentsPage.tsx]"]
  node_course_ui["Course management<br/>[CoursesPage.tsx]"]
  node_attendance_ui["Attendance entry<br/>[AttendancePage.tsx]"]
  node_calendar_ui["School calendar<br/>[CalendarPage.tsx]"]
  node_students_api["Student API<br/>[students.py]"]
  node_courses_api["Course API<br/>[courses.py]"]
  node_attendance_api["Attendance API<br/>[attendance.py]"]
  node_attendance_service["Attendance service"]
  node_calendar_api["Calendar API<br/>[calendar.py]"]
end

subgraph group_insights["Reports and alerts"]
  node_reports_ui["Reports and metrics"]
  node_reports_api["Reports API<br/>[reports.py]"]
  node_export["PDF and Excel export<br/>[export_service.py]"]
  node_dashboard_api["Dashboard metrics<br/>[dashboard.py]"]
  node_notifications_ui["Notifications center"]
  node_notifications_api["Notifications API<br/>[notifications.py]"]
  node_notification_service["Absence alerts"]
end

subgraph group_platform["API and data"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_data_models["Domain records<br/>[__init__.py]"]
  node_database[("Relational database<br/>[database.py]")]
end

node_users(("School users"))

node_users -->|"uses"| node_webapp
node_users -.->|"uses"| node_mobileapp
node_webapp -->|"provides session"| node_web_auth
node_web_auth -->|"requests login"| node_auth_api
node_mobileapp -.->|"authenticates"| node_mobile_auth
node_mobile_auth -->|"delegates sign-in"| node_firebase
node_mobile_auth -->|"exchanges token"| node_auth_api
node_auth_api -->|"reads and writes"| node_database
node_api_app -->|"registers router"| node_auth_api
node_api_app -->|"registers router"| node_students_api
node_api_app -->|"registers router"| node_attendance_api
node_api_app -->|"registers router"| node_courses_api
node_api_app -->|"registers router"| node_calendar_api
node_api_app -->|"registers router"| node_reports_api
node_api_app -->|"registers router"| node_notifications_api
node_api_app -->|"registers router"| node_dashboard_api
node_student_ui -.->|"manages students"| node_students_api
node_course_ui -.->|"manages courses"| node_courses_api
node_attendance_ui -->|"records attendance"| node_attendance_api
node_attendance_api -->|"delegates attendance"| node_attendance_service
node_attendance_api -.->|"stores records"| node_database
node_calendar_ui -.->|"manages events"| node_calendar_api
node_reports_ui -.->|"requests reports"| node_reports_api
node_reports_api -.->|"exports files"| node_export
node_dashboard_api -.->|"computes metrics"| node_database
node_notifications_ui -.->|"manages alerts"| node_notifications_api
node_notifications_api -.->|"dispatches alerts"| node_notification_service
node_notification_service -->|"reads records"| node_database
node_students_api -.->|"reads and writes"| node_database
node_courses_api -.->|"reads and writes"| node_database
node_calendar_api -.->|"reads and writes"| node_database
node_reports_api -.->|"queries records"| node_database
node_attendance_service -->|"uses domain models"| node_data_models
node_api_app -->|"creates tables"| node_database
node_permissions -.->|"enforces roles"| node_auth_api

click node_webapp "https://github.com/jinllo/p3.1c/blob/master/frontend/src/App.tsx"
click node_mobileapp "https://github.com/jinllo/p3.1c/tree/master/mobile-app/app/(tabs)"
click node_web_auth "https://github.com/jinllo/p3.1c/blob/master/frontend/src/context/AuthContext.tsx"
click node_mobile_auth "https://github.com/jinllo/p3.1c/blob/master/mobile-app/src/context/AuthContext.tsx"
click node_firebase "https://github.com/jinllo/p3.1c/blob/master/mobile-app/src/services/firebaseAuth.ts"
click node_auth_api "https://github.com/jinllo/p3.1c/blob/master/backend/app/api/auth.py"
click node_permissions "https://github.com/jinllo/p3.1c/blob/master/backend/app/core/permissions.py"
click node_student_ui "https://github.com/jinllo/p3.1c/blob/master/frontend/src/pages/StudentsPage.tsx"
click node_course_ui "https://github.com/jinllo/p3.1c/blob/master/frontend/src/pages/CoursesPage.tsx"
click node_attendance_ui "https://github.com/jinllo/p3.1c/blob/master/frontend/src/pages/AttendancePage.tsx"
click node_calendar_ui "https://github.com/jinllo/p3.1c/blob/master/frontend/src/pages/CalendarPage.tsx"
click node_students_api "https://github.com/jinllo/p3.1c/blob/master/backend/app/api/students.py"
click node_courses_api "https://github.com/jinllo/p3.1c/blob/master/backend/app/api/courses.py"
click node_attendance_api "https://github.com/jinllo/p3.1c/blob/master/backend/app/api/attendance.py"
click node_attendance_service "https://github.com/jinllo/p3.1c/blob/master/backend/app/services/attendance_service.py"
click node_calendar_api "https://github.com/jinllo/p3.1c/blob/master/backend/app/api/calendar.py"
click node_reports_ui "https://github.com/jinllo/p3.1c/blob/master/frontend/src/pages/MonthlyReportPage.tsx"
click node_reports_api "https://github.com/jinllo/p3.1c/blob/master/backend/app/api/reports.py"
click node_export "https://github.com/jinllo/p3.1c/blob/master/backend/export_service.py"
click node_dashboard_api "https://github.com/jinllo/p3.1c/blob/master/backend/app/api/dashboard.py"
click node_notifications_ui "https://github.com/jinllo/p3.1c/blob/master/frontend/src/pages/NotificationsPage.tsx"
click node_notifications_api "https://github.com/jinllo/p3.1c/blob/master/backend/app/api/notifications.py"
click node_notification_service "https://github.com/jinllo/p3.1c/blob/master/backend/app/services/notification_service.py"
click node_api_app "https://github.com/jinllo/p3.1c/blob/master/backend/app/main.py"
click node_data_models "https://github.com/jinllo/p3.1c/blob/master/backend/app/models/__init__.py"
click node_database "https://github.com/jinllo/p3.1c/blob/master/backend/app/core/database.py"

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_webapp,node_mobileapp,node_users toneBlue
class node_web_auth,node_mobile_auth,node_firebase,node_auth_api,node_permissions toneAmber
class node_student_ui,node_course_ui,node_attendance_ui,node_calendar_ui,node_students_api,node_courses_api,node_attendance_api,node_attendance_service,node_calendar_api toneMint
class node_reports_ui,node_reports_api,node_export,node_dashboard_api,node_notifications_ui,node_notifications_api,node_notification_service toneRose
class node_api_app,node_data_models,node_database toneIndigo
```

## Components

### User clients

- [Web application](https://github.com/jinllo/p3.1c/blob/master/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Mobile application](https://github.com/jinllo/p3.1c/tree/master/mobile-app/app/(tabs)): `mobile-app/app/(tabs)`

### Identity and access

- [Web session](https://github.com/jinllo/p3.1c/blob/master/frontend/src/context/AuthContext.tsx): `frontend/src/context/AuthContext.tsx`
- [Mobile session](https://github.com/jinllo/p3.1c/blob/master/mobile-app/src/context/AuthContext.tsx): `mobile-app/src/context/AuthContext.tsx`
- [Firebase auth](https://github.com/jinllo/p3.1c/blob/master/mobile-app/src/services/firebaseAuth.ts): `mobile-app/src/services/firebaseAuth.ts`
- [Authentication API](https://github.com/jinllo/p3.1c/blob/master/backend/app/api/auth.py): `backend/app/api/auth.py`
- [Role permissions](https://github.com/jinllo/p3.1c/blob/master/backend/app/core/permissions.py): `backend/app/core/permissions.py`

### School operations

- [Student management](https://github.com/jinllo/p3.1c/blob/master/frontend/src/pages/StudentsPage.tsx): `frontend/src/pages/StudentsPage.tsx`
- [Course management](https://github.com/jinllo/p3.1c/blob/master/frontend/src/pages/CoursesPage.tsx): `frontend/src/pages/CoursesPage.tsx`
- [Attendance entry](https://github.com/jinllo/p3.1c/blob/master/frontend/src/pages/AttendancePage.tsx): `frontend/src/pages/AttendancePage.tsx`
- [School calendar](https://github.com/jinllo/p3.1c/blob/master/frontend/src/pages/CalendarPage.tsx): `frontend/src/pages/CalendarPage.tsx`
- [Student API](https://github.com/jinllo/p3.1c/blob/master/backend/app/api/students.py): `backend/app/api/students.py`
- [Course API](https://github.com/jinllo/p3.1c/blob/master/backend/app/api/courses.py): `backend/app/api/courses.py`
- [Attendance API](https://github.com/jinllo/p3.1c/blob/master/backend/app/api/attendance.py): `backend/app/api/attendance.py`
- [Attendance service](https://github.com/jinllo/p3.1c/blob/master/backend/app/services/attendance_service.py): `backend/app/services/attendance_service.py`
- [Calendar API](https://github.com/jinllo/p3.1c/blob/master/backend/app/api/calendar.py): `backend/app/api/calendar.py`

### Reports and alerts

- [Reports and metrics](https://github.com/jinllo/p3.1c/blob/master/frontend/src/pages/MonthlyReportPage.tsx): `frontend/src/pages/MonthlyReportPage.tsx`
- [Reports API](https://github.com/jinllo/p3.1c/blob/master/backend/app/api/reports.py): `backend/app/api/reports.py`
- [PDF and Excel export](https://github.com/jinllo/p3.1c/blob/master/backend/export_service.py): `backend/export_service.py`
- [Dashboard metrics](https://github.com/jinllo/p3.1c/blob/master/backend/app/api/dashboard.py): `backend/app/api/dashboard.py`
- [Notifications center](https://github.com/jinllo/p3.1c/blob/master/frontend/src/pages/NotificationsPage.tsx): `frontend/src/pages/NotificationsPage.tsx`
- [Notifications API](https://github.com/jinllo/p3.1c/blob/master/backend/app/api/notifications.py): `backend/app/api/notifications.py`
- [Absence alerts](https://github.com/jinllo/p3.1c/blob/master/backend/app/services/notification_service.py): `backend/app/services/notification_service.py`

### API and data

- [FastAPI application](https://github.com/jinllo/p3.1c/blob/master/backend/app/main.py): `backend/app/main.py`
- [Domain records](https://github.com/jinllo/p3.1c/blob/master/backend/app/models/__init__.py): `backend/app/models/__init__.py`
- [Relational database](https://github.com/jinllo/p3.1c/blob/master/backend/app/core/database.py): `backend/app/core/database.py`

### Other components

- **School users**

## Connections

- School users → Web application: uses (evidence: `frontend/src/App.tsx`)
- School users → Mobile application: uses
- Web application → Web session: provides session (evidence: `frontend/src/App.tsx`)
- Web session → Authentication API: requests login (evidence: `frontend/src/context/AuthContext.tsx`)
- Mobile application → Mobile session: authenticates
- Mobile session → Firebase auth: delegates sign-in (evidence: `mobile-app/src/context/AuthContext.tsx`)
- Mobile session → Authentication API: exchanges token (evidence: `mobile-app/src/context/AuthContext.tsx`)
- Authentication API → Relational database: reads and writes (evidence: `backend/app/api/auth.py`)
- FastAPI application → Authentication API: registers router (evidence: `backend/app/main.py`)
- FastAPI application → Student API: registers router (evidence: `backend/app/main.py`)
- FastAPI application → Attendance API: registers router (evidence: `backend/app/main.py`)
- FastAPI application → Course API: registers router (evidence: `backend/app/main.py`)
- FastAPI application → Calendar API: registers router (evidence: `backend/app/main.py`)
- FastAPI application → Reports API: registers router (evidence: `backend/app/main.py`)
- FastAPI application → Notifications API: registers router (evidence: `backend/app/main.py`)
- FastAPI application → Dashboard metrics: registers router (evidence: `backend/app/main.py`)
- Student management → Student API: manages students
- Course management → Course API: manages courses
- Attendance entry → Attendance API: records attendance (evidence: `frontend/src/pages/AttendancePage.tsx`)
- Attendance API → Attendance service: delegates attendance (evidence: `backend/app/services/attendance_service.py`)
- Attendance API → Relational database: stores records
- School calendar → Calendar API: manages events
- Reports and metrics → Reports API: requests reports
- Reports API → PDF and Excel export: exports files
- Dashboard metrics → Relational database: computes metrics
- Notifications center → Notifications API: manages alerts
- Notifications API → Absence alerts: dispatches alerts
- Absence alerts → Relational database: reads records (evidence: `backend/app/services/notification_service.py`)
- Student API → Relational database: reads and writes
- Course API → Relational database: reads and writes
- Calendar API → Relational database: reads and writes
- Reports API → Relational database: queries records
- Attendance service → Domain records: uses domain models (evidence: `backend/app/services/attendance_service.py`)
- FastAPI application → Relational database: creates tables (evidence: `backend/app/main.py`)
- Role permissions → Authentication API: enforces roles
