# off-xero/pequenos-reyes architecture

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

- Interactive diagram: https://gitdiagram.com/off-xero/pequenos-reyes
- Repository: https://github.com/off-xero/pequenos-reyes

## Overview

Pequeños Reyes is an institutional school portal. Families browse published activities, sign in, select a child and submit an activity registration with simulated payment; staff publish activities and manage organizers, while management can handle payments. The React client communicates with a FastAPI REST API, whose domain services use PostgreSQL for transactional records and MongoDB for audit history. Other documented portal areas include announcements, documents, pre-enrollment and contact. Edges reflect the supplied excerpts, source index references and README; unsampled domain modules are represented at their existing directory paths.

Main entry points: [`HITO-3/backend/app/main.py`](https://github.com/off-xero/pequenos-reyes/blob/main/HITO-3/backend/app/main.py) (API application), [`HITO-2/frontend-react/src/pages/CalendarioSeccion.jsx`](https://github.com/off-xero/pequenos-reyes/blob/main/HITO-2/frontend-react/src/pages/CalendarioSeccion.jsx) (Activity calendar), [`HITO-3/backend/app/services/auth.py`](https://github.com/off-xero/pequenos-reyes/blob/main/HITO-3/backend/app/services/auth.py) (Session service), [`HITO-2/frontend-react/src/services/http.js`](https://github.com/off-xero/pequenos-reyes/blob/main/HITO-2/frontend-react/src/services/http.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React portal"]
  node_react_app["Portal shell<br/>[App.jsx]"]
  node_session_ui["Session state<br/>[SesionProvider.jsx]"]
  node_calendar_page["Activity calendar"]
  node_event_signup["Event registration"]
  node_event_admin["Activity publishing"]
  node_organizer_admin["Organizer management"]
  node_http_client["API client<br/>[http.js]"]
  node_other_sections["Portal sections"]
end

subgraph group_api["FastAPI API"]
  node_api_app["API application<br/>[main.py]"]
  node_event_routes["Event routes<br/>[eventos.py]"]
  node_signup_routes["Registration routes<br/>[inscripciones.py]"]
  node_auth_routes["Authentication and portal<br/>[auth.py]"]
  node_other_routes["Other domain routes"]
end

subgraph group_domain["Domain services"]
  node_access_control["Access control<br/>[permisos.py]"]
  node_auth_service["Session service<br/>[auth.py]"]
  node_event_service["Event service<br/>[eventos.py]"]
  node_registration_service["Registration and payments<br/>[inscripciones.py]"]
  node_audit_service["Audit service<br/>[auditoria.py]"]
end

subgraph group_storage["Persistence"]
  node_postgres_models["Domain records<br/>[models.py]"]
  node_postgres[("PostgreSQL<br/>[postgres.py]")]
  node_mongo[("MongoDB audit log<br/>[mongo.py]")]
end

subgraph group_integrations["External services"]
  node_weather["Weather provider"]
end

node_families(("Families and staff"))

node_families -->|"uses"| node_react_app
node_react_app -->|"mounts"| node_session_ui
node_react_app -->|"renders"| node_other_sections
node_families -->|"browses"| node_calendar_page
node_calendar_page -->|"renders"| node_event_signup
node_calendar_page -->|"renders"| node_event_admin
node_calendar_page -->|"renders"| node_organizer_admin
node_event_signup -->|"calls"| node_http_client
node_event_admin -->|"calls"| node_http_client
node_organizer_admin -->|"calls"| node_http_client
node_http_client -->|"sends API requests"| node_api_app
node_families -->|"uses"| node_other_sections
node_other_sections -.->|"requests forecast"| node_weather
node_api_app -->|"registers"| node_event_routes
node_api_app -->|"registers"| node_signup_routes
node_api_app -->|"registers"| node_auth_routes
node_api_app -->|"registers"| node_other_routes
node_event_routes -->|"delegates to"| node_event_service
node_signup_routes -->|"delegates to"| node_registration_service
node_auth_routes -->|"delegates to"| node_auth_service
node_event_service -->|"uses"| node_postgres_models
node_registration_service -->|"uses"| node_postgres_models
node_auth_service -->|"reads and writes"| node_postgres_models
node_auth_service -->|"records login events"| node_audit_service
node_auth_routes -->|"requires identity"| node_access_control
node_access_control -->|"validates tokens"| node_auth_service
node_postgres_models -->|"uses base"| node_postgres
node_audit_service -->|"writes audit log"| node_mongo
node_families -->|"uses announcements, documents, contact"| node_other_routes
node_families -->|"submits pre-enrollment"| node_other_routes
node_event_signup -->|"submits registration"| node_registration_service

click node_react_app "https://github.com/off-xero/pequenos-reyes/blob/main/HITO-2/frontend-react/src/App.jsx"
click node_session_ui "https://github.com/off-xero/pequenos-reyes/blob/main/HITO-2/frontend-react/src/context/SesionProvider.jsx"
click node_calendar_page "https://github.com/off-xero/pequenos-reyes/blob/main/HITO-2/frontend-react/src/pages/CalendarioSeccion.jsx"
click node_event_signup "https://github.com/off-xero/pequenos-reyes/blob/main/HITO-2/frontend-react/src/components/FlujoInscripcionEventos.jsx"
click node_event_admin "https://github.com/off-xero/pequenos-reyes/blob/main/HITO-2/frontend-react/src/components/GestionActividades.jsx"
click node_organizer_admin "https://github.com/off-xero/pequenos-reyes/blob/main/HITO-2/frontend-react/src/components/GestionOrganizadores.jsx"
click node_http_client "https://github.com/off-xero/pequenos-reyes/blob/main/HITO-2/frontend-react/src/services/http.js"
click node_other_sections "https://github.com/off-xero/pequenos-reyes/tree/main/HITO-2/frontend-react/src/pages"
click node_api_app "https://github.com/off-xero/pequenos-reyes/blob/main/HITO-3/backend/app/main.py"
click node_event_routes "https://github.com/off-xero/pequenos-reyes/blob/main/HITO-3/backend/app/api/eventos.py"
click node_signup_routes "https://github.com/off-xero/pequenos-reyes/blob/main/HITO-3/backend/app/api/inscripciones.py"
click node_auth_routes "https://github.com/off-xero/pequenos-reyes/blob/main/HITO-3/backend/app/api/auth.py"
click node_other_routes "https://github.com/off-xero/pequenos-reyes/tree/main/HITO-3/backend/app/api"
click node_access_control "https://github.com/off-xero/pequenos-reyes/blob/main/HITO-3/backend/app/core/permisos.py"
click node_auth_service "https://github.com/off-xero/pequenos-reyes/blob/main/HITO-3/backend/app/services/auth.py"
click node_event_service "https://github.com/off-xero/pequenos-reyes/blob/main/HITO-3/backend/app/services/eventos.py"
click node_registration_service "https://github.com/off-xero/pequenos-reyes/blob/main/HITO-3/backend/app/services/inscripciones.py"
click node_audit_service "https://github.com/off-xero/pequenos-reyes/blob/main/HITO-3/backend/app/services/auditoria.py"
click node_postgres_models "https://github.com/off-xero/pequenos-reyes/blob/main/HITO-3/backend/app/db/models.py"
click node_postgres "https://github.com/off-xero/pequenos-reyes/blob/main/HITO-3/backend/app/db/postgres.py"
click node_mongo "https://github.com/off-xero/pequenos-reyes/blob/main/HITO-3/backend/app/db/mongo.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_react_app,node_session_ui,node_calendar_page,node_event_signup,node_event_admin,node_organizer_admin,node_http_client,node_other_sections toneBlue
class node_api_app,node_event_routes,node_signup_routes,node_auth_routes,node_other_routes toneAmber
class node_access_control,node_auth_service,node_event_service,node_registration_service,node_audit_service toneMint
class node_postgres_models,node_postgres,node_mongo toneRose
class node_weather,node_families toneIndigo
```

## Components

### React portal

- [Portal shell](https://github.com/off-xero/pequenos-reyes/blob/main/HITO-2/frontend-react/src/App.jsx): `HITO-2/frontend-react/src/App.jsx`
- [Session state](https://github.com/off-xero/pequenos-reyes/blob/main/HITO-2/frontend-react/src/context/SesionProvider.jsx): `HITO-2/frontend-react/src/context/SesionProvider.jsx`
- [Activity calendar](https://github.com/off-xero/pequenos-reyes/blob/main/HITO-2/frontend-react/src/pages/CalendarioSeccion.jsx): `HITO-2/frontend-react/src/pages/CalendarioSeccion.jsx`
- [Event registration](https://github.com/off-xero/pequenos-reyes/blob/main/HITO-2/frontend-react/src/components/FlujoInscripcionEventos.jsx): `HITO-2/frontend-react/src/components/FlujoInscripcionEventos.jsx`
- [Activity publishing](https://github.com/off-xero/pequenos-reyes/blob/main/HITO-2/frontend-react/src/components/GestionActividades.jsx): `HITO-2/frontend-react/src/components/GestionActividades.jsx`
- [Organizer management](https://github.com/off-xero/pequenos-reyes/blob/main/HITO-2/frontend-react/src/components/GestionOrganizadores.jsx): `HITO-2/frontend-react/src/components/GestionOrganizadores.jsx`
- [API client](https://github.com/off-xero/pequenos-reyes/blob/main/HITO-2/frontend-react/src/services/http.js): `HITO-2/frontend-react/src/services/http.js`
- [Portal sections](https://github.com/off-xero/pequenos-reyes/tree/main/HITO-2/frontend-react/src/pages): `HITO-2/frontend-react/src/pages`

### FastAPI API

- [API application](https://github.com/off-xero/pequenos-reyes/blob/main/HITO-3/backend/app/main.py): `HITO-3/backend/app/main.py`
- [Event routes](https://github.com/off-xero/pequenos-reyes/blob/main/HITO-3/backend/app/api/eventos.py): `HITO-3/backend/app/api/eventos.py`
- [Registration routes](https://github.com/off-xero/pequenos-reyes/blob/main/HITO-3/backend/app/api/inscripciones.py): `HITO-3/backend/app/api/inscripciones.py`
- [Authentication and portal](https://github.com/off-xero/pequenos-reyes/blob/main/HITO-3/backend/app/api/auth.py): `HITO-3/backend/app/api/auth.py`
- [Other domain routes](https://github.com/off-xero/pequenos-reyes/tree/main/HITO-3/backend/app/api): `HITO-3/backend/app/api`

### Domain services

- [Access control](https://github.com/off-xero/pequenos-reyes/blob/main/HITO-3/backend/app/core/permisos.py): `HITO-3/backend/app/core/permisos.py`
- [Session service](https://github.com/off-xero/pequenos-reyes/blob/main/HITO-3/backend/app/services/auth.py): `HITO-3/backend/app/services/auth.py`
- [Event service](https://github.com/off-xero/pequenos-reyes/blob/main/HITO-3/backend/app/services/eventos.py): `HITO-3/backend/app/services/eventos.py`
- [Registration and payments](https://github.com/off-xero/pequenos-reyes/blob/main/HITO-3/backend/app/services/inscripciones.py): `HITO-3/backend/app/services/inscripciones.py`
- [Audit service](https://github.com/off-xero/pequenos-reyes/blob/main/HITO-3/backend/app/services/auditoria.py): `HITO-3/backend/app/services/auditoria.py`

### Persistence

- [Domain records](https://github.com/off-xero/pequenos-reyes/blob/main/HITO-3/backend/app/db/models.py): `HITO-3/backend/app/db/models.py`
- [PostgreSQL](https://github.com/off-xero/pequenos-reyes/blob/main/HITO-3/backend/app/db/postgres.py): `HITO-3/backend/app/db/postgres.py`
- [MongoDB audit log](https://github.com/off-xero/pequenos-reyes/blob/main/HITO-3/backend/app/db/mongo.py): `HITO-3/backend/app/db/mongo.py`

### External services

- **Weather provider**

### Other components

- **Families and staff**

## Connections

- Families and staff → Portal shell: uses (evidence: `README.md`)
- Portal shell → Session state: mounts (evidence: `HITO-2/frontend-react/src/App.jsx`)
- Portal shell → Portal sections: renders (evidence: `HITO-2/frontend-react/src/App.jsx`)
- Families and staff → Activity calendar: browses (evidence: `README.md`)
- Activity calendar → Event registration: renders (evidence: `HITO-2/frontend-react/src/pages/CalendarioSeccion.jsx`)
- Activity calendar → Activity publishing: renders (evidence: `HITO-2/frontend-react/src/pages/CalendarioSeccion.jsx`)
- Activity calendar → Organizer management: renders (evidence: `HITO-2/frontend-react/src/pages/CalendarioSeccion.jsx`)
- Event registration → API client: calls (evidence: `HITO-2/frontend-react/src/components/FlujoInscripcionEventos.jsx`)
- Activity publishing → API client: calls (evidence: `HITO-2/frontend-react/src/components/GestionActividades.jsx`)
- Organizer management → API client: calls (evidence: `HITO-2/frontend-react/src/components/GestionOrganizadores.jsx`)
- API client → API application: sends API requests (evidence: `README.md`)
- Families and staff → Portal sections: uses (evidence: `README.md`)
- Portal sections → Weather provider: requests forecast
- API application → Event routes: registers (evidence: `HITO-3/backend/app/main.py`)
- API application → Registration routes: registers (evidence: `HITO-3/backend/app/main.py`)
- API application → Authentication and portal: registers (evidence: `HITO-3/backend/app/main.py`)
- API application → Other domain routes: registers (evidence: `HITO-3/backend/app/main.py`)
- Event routes → Event service: delegates to (evidence: `HITO-3/backend/app/api/eventos.py`)
- Registration routes → Registration and payments: delegates to (evidence: `HITO-3/backend/app/api/inscripciones.py`)
- Authentication and portal → Session service: delegates to (evidence: `HITO-3/backend/app/api/auth.py`)
- Event service → Domain records: uses (evidence: `HITO-3/backend/app/services/eventos.py`)
- Registration and payments → Domain records: uses (evidence: `HITO-3/backend/app/api/inscripciones.py`)
- Session service → Domain records: reads and writes (evidence: `HITO-3/backend/app/services/auth.py`)
- Session service → Audit service: records login events (evidence: `HITO-3/backend/app/services/auth.py`)
- Authentication and portal → Access control: requires identity (evidence: `HITO-3/backend/app/api/auth.py`)
- Access control → Session service: validates tokens (evidence: `HITO-3/backend/app/core/permisos.py`)
- Domain records → PostgreSQL: uses base (evidence: `HITO-3/backend/app/db/models.py`)
- Audit service → MongoDB audit log: writes audit log (evidence: `HITO-3/backend/app/services/auditoria.py`)
- Families and staff → Other domain routes: uses announcements, documents, contact (evidence: `README.md`)
- Families and staff → Other domain routes: submits pre-enrollment (evidence: `README.md`)
- Event registration → Registration and payments: submits registration (evidence: `README.md`)
