# yoopuipui/cesfam-programa-infantil architecture

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

- Interactive diagram: https://gitdiagram.com/yoopuipui/cesfam-programa-infantil
- Repository: https://github.com/yoopuipui/cesfam-programa-infantil

## Overview

CESFAM Programa Infantil is a clinical-management system for health staff: staff sign in, manage child and caregiver records, record clinical controls, coordinate NANEAS workshops, and review reports. The React application routes users to these workflows and uses a shared API client; the Express backend exposes authenticated routes, controllers, and domain services backed by Prisma/PostgreSQL. Excel patient import is a distinct workflow, including a documented simulation mode. Some feature implementations were not sampled, so their backend links are shown only where the README or source index supports them; uncertain HTTP wiring is dashed.

Main entry points: [`frontend/src/App.tsx`](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/App.tsx) (Application routes), [`frontend/src/service/api.ts`](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/service/api.ts) (API client), [`backend/src/config/prisma.ts`](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/backend/src/config/prisma.ts) (Prisma client), [`backend/src/index.ts`](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/backend/src/index.ts) (Express server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Staff application"]
  node_app["Application routes<br/>[App.tsx]"]
  node_login["Sign in<br/>[Login.tsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_patients["Patient records<br/>[listaPacientes.tsx]"]
  node_patient_detail["Patient details<br/>[fichaPacientes.tsx]"]
  node_patient_edit["Edit patient<br/>[editarPaciente.tsx]"]
  node_patient_enroll["Patient enrollment"]
  node_excel_import["Excel import<br/>[importarExcel.tsx]"]
  node_controls["Clinical controls<br/>[crearControl.tsx]"]
  node_agenda["Control agenda"]
  node_workshops["Workshop management<br/>[Talleres.tsx]"]
  node_workshop_detail["Workshop sessions<br/>[detalleTaller.tsx]"]
  node_session_detail["Session detail<br/>[detalleSesion.tsx]"]
  node_reports["Reports<br/>[listaReportes.tsx]"]
  node_report_detail["Report detail"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_backend["API and domain"]
  node_server["Express server<br/>[index.ts]"]
  node_auth["Token verification<br/>[authMiddleware.ts]"]
  node_patient_routes["Patient routes<br/>[paciente.routes.ts]"]
  node_patient_controller["Patient controller"]
  node_patient_service["Patient service"]
  node_control_controller["Control controller"]
  node_control_service["Control service"]
  node_import_service["Excel import service"]
  node_workshop_controller["Workshop session controller"]
  node_workshop_service["Session service"]
  node_report_service["Reporting service"]
end

subgraph group_storage["Clinical persistence"]
  node_prisma["Prisma client<br/>[prisma.ts]"]
  node_postgres[("PostgreSQL")]
end

node_staff(("Health staff"))

node_staff -->|"uses"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_patients
node_app -->|"routes to"| node_patient_detail
node_app -->|"routes to"| node_patient_edit
node_app -->|"routes to"| node_patient_enroll
node_app -->|"routes to"| node_excel_import
node_app -->|"routes to"| node_controls
node_app -->|"routes to"| node_agenda
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_workshops
node_app -->|"routes to"| node_workshop_detail
node_app -->|"routes to"| node_session_detail
node_app -->|"routes to"| node_reports
node_app -->|"routes to"| node_report_detail
node_login -->|"requests"| node_api_client
node_dashboard -->|"requests"| node_api_client
node_patient_edit -->|"requests"| node_api_client
node_patient_enroll -->|"requests"| node_api_client
node_controls -->|"requests"| node_api_client
node_agenda -->|"requests"| node_api_client
node_workshop_detail -->|"requests"| node_api_client
node_session_detail -->|"requests"| node_api_client
node_reports -->|"requests"| node_api_client
node_report_detail -->|"requests"| node_api_client
node_api_client -.->|"HTTP requests"| node_server
node_server -->|"mounts"| node_patient_routes
node_patient_routes -->|"dispatches"| node_patient_controller
node_patient_routes -->|"verifies token"| node_auth
node_patient_controller -->|"calls"| node_patient_service
node_patient_controller -->|"normalizes text"| node_import_service
node_patient_service -->|"queries"| node_prisma
node_server -->|"mounts routes"| node_control_controller
node_control_controller -->|"calls"| node_control_service
node_control_service -->|"queries"| node_prisma
node_server -->|"mounts routes"| node_workshop_controller
node_workshop_controller -->|"calls"| node_workshop_service
node_workshop_service -->|"queries"| node_prisma
node_import_service -->|"writes patients"| node_prisma
node_server -->|"mounts reports"| node_report_service
node_report_service -->|"queries"| node_prisma
node_prisma -->|"persists records"| node_postgres

click node_app "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/App.tsx"
click node_login "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/login/Login.tsx"
click node_dashboard "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/dashboard/Dashboard.tsx"
click node_patients "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/pacientes/listaPacientes.tsx"
click node_patient_detail "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/pacientes/fichaPacientes.tsx"
click node_patient_edit "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/pacientes/editarPaciente.tsx"
click node_patient_enroll "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/pacientes/inscribirPaciente.tsx"
click node_excel_import "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/pacientes/importarExcel.tsx"
click node_controls "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/controles/crearControl.tsx"
click node_agenda "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/agenda/agendaControles.tsx"
click node_workshops "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/talleres/Talleres.tsx"
click node_workshop_detail "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/talleres/detalleTaller.tsx"
click node_session_detail "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/talleres/detalleSesion.tsx"
click node_reports "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/reportes/listaReportes.tsx"
click node_report_detail "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/reportes/detalleReportes.tsx"
click node_api_client "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/service/api.ts"
click node_server "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/backend/src/index.ts"
click node_auth "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/backend/src/middlewares/authMiddleware.ts"
click node_patient_routes "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/backend/src/routes/paciente.routes.ts"
click node_patient_controller "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/backend/src/controllers/paciente.controller.ts"
click node_patient_service "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/backend/src/services/paciente.service.ts"
click node_control_controller "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/backend/src/controllers/controlClinico.controller.ts"
click node_control_service "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/backend/src/services/controlClinico.service.ts"
click node_import_service "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/backend/src/services/importacion.service.ts"
click node_workshop_controller "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/backend/src/controllers/sesionTaller.controller.ts"
click node_workshop_service "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/backend/src/services/sesionTaller.service.ts"
click node_report_service "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/backend/src/services/reportes.service.ts"
click node_prisma "https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/backend/src/config/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_login,node_dashboard,node_patients,node_patient_detail,node_patient_edit,node_patient_enroll,node_excel_import,node_controls,node_agenda,node_workshops,node_workshop_detail,node_session_detail,node_reports,node_report_detail,node_api_client toneBlue
class node_server,node_auth,node_patient_routes,node_patient_controller,node_patient_service,node_control_controller,node_control_service,node_import_service,node_workshop_controller,node_workshop_service,node_report_service toneAmber
class node_prisma,node_postgres toneMint
class node_staff toneIndigo
```

## Components

### Staff application

- [Application routes](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Sign in](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/login/Login.tsx): `frontend/src/components/login/Login.tsx`
- [Dashboard](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/dashboard/Dashboard.tsx): `frontend/src/components/dashboard/Dashboard.tsx`
- [Patient records](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/pacientes/listaPacientes.tsx): `frontend/src/components/pacientes/listaPacientes.tsx`
- [Patient details](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/pacientes/fichaPacientes.tsx): `frontend/src/components/pacientes/fichaPacientes.tsx`
- [Edit patient](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/pacientes/editarPaciente.tsx): `frontend/src/components/pacientes/editarPaciente.tsx`
- [Patient enrollment](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/pacientes/inscribirPaciente.tsx): `frontend/src/components/pacientes/inscribirPaciente.tsx`
- [Excel import](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/pacientes/importarExcel.tsx): `frontend/src/components/pacientes/importarExcel.tsx`
- [Clinical controls](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/controles/crearControl.tsx): `frontend/src/components/controles/crearControl.tsx`
- [Control agenda](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/agenda/agendaControles.tsx): `frontend/src/components/agenda/agendaControles.tsx`
- [Workshop management](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/talleres/Talleres.tsx): `frontend/src/components/talleres/Talleres.tsx`
- [Workshop sessions](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/talleres/detalleTaller.tsx): `frontend/src/components/talleres/detalleTaller.tsx`
- [Session detail](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/talleres/detalleSesion.tsx): `frontend/src/components/talleres/detalleSesion.tsx`
- [Reports](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/reportes/listaReportes.tsx): `frontend/src/components/reportes/listaReportes.tsx`
- [Report detail](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/components/reportes/detalleReportes.tsx): `frontend/src/components/reportes/detalleReportes.tsx`
- [API client](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/frontend/src/service/api.ts): `frontend/src/service/api.ts`

### API and domain

- [Express server](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/backend/src/index.ts): `backend/src/index.ts`
- [Token verification](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/backend/src/middlewares/authMiddleware.ts): `backend/src/middlewares/authMiddleware.ts`
- [Patient routes](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/backend/src/routes/paciente.routes.ts): `backend/src/routes/paciente.routes.ts`
- [Patient controller](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/backend/src/controllers/paciente.controller.ts): `backend/src/controllers/paciente.controller.ts`
- [Patient service](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/backend/src/services/paciente.service.ts): `backend/src/services/paciente.service.ts`
- [Control controller](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/backend/src/controllers/controlClinico.controller.ts): `backend/src/controllers/controlClinico.controller.ts`
- [Control service](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/backend/src/services/controlClinico.service.ts): `backend/src/services/controlClinico.service.ts`
- [Excel import service](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/backend/src/services/importacion.service.ts): `backend/src/services/importacion.service.ts`
- [Workshop session controller](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/backend/src/controllers/sesionTaller.controller.ts): `backend/src/controllers/sesionTaller.controller.ts`
- [Session service](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/backend/src/services/sesionTaller.service.ts): `backend/src/services/sesionTaller.service.ts`
- [Reporting service](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/backend/src/services/reportes.service.ts): `backend/src/services/reportes.service.ts`

### Clinical persistence

- [Prisma client](https://github.com/yoopuipui/cesfam-programa-infantil/blob/main/backend/src/config/prisma.ts): `backend/src/config/prisma.ts`
- **PostgreSQL**

### Other components

- **Health staff**

## Connections

- Health staff → Application routes: uses (evidence: `README.md`)
- Application routes → Sign in: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Patient records: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Patient details: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Edit patient: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Patient enrollment: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Excel import: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Clinical controls: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Control agenda: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Dashboard: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Workshop management: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Workshop sessions: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Session detail: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Reports: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Report detail: routes to (evidence: `frontend/src/App.tsx`)
- Sign in → API client: requests (evidence: `frontend/src/components/login/Login.tsx`)
- Dashboard → API client: requests (evidence: `frontend/src/components/dashboard/Dashboard.tsx`)
- Edit patient → API client: requests (evidence: `frontend/src/components/pacientes/editarPaciente.tsx`)
- Patient enrollment → API client: requests (evidence: `frontend/src/components/pacientes/inscribirPaciente.tsx`)
- Clinical controls → API client: requests (evidence: `frontend/src/components/controles/crearControl.tsx`)
- Control agenda → API client: requests (evidence: `frontend/src/components/agenda/agendaControles.tsx`)
- Workshop sessions → API client: requests (evidence: `frontend/src/components/talleres/detalleTaller.tsx`)
- Session detail → API client: requests (evidence: `frontend/src/components/talleres/detalleSesion.tsx`)
- Reports → API client: requests (evidence: `frontend/src/components/reportes/listaReportes.tsx`)
- Report detail → API client: requests (evidence: `frontend/src/components/reportes/detalleReportes.tsx`)
- API client → Express server: HTTP requests
- Express server → Patient routes: mounts (evidence: `backend/src/index.ts`)
- Patient routes → Patient controller: dispatches (evidence: `backend/src/routes/paciente.routes.ts`)
- Patient routes → Token verification: verifies token (evidence: `backend/src/routes/paciente.routes.ts`)
- Patient controller → Patient service: calls (evidence: `backend/src/controllers/paciente.controller.ts`)
- Patient controller → Excel import service: normalizes text (evidence: `backend/src/controllers/paciente.controller.ts`)
- Patient service → Prisma client: queries (evidence: `backend/src/services/paciente.service.ts`)
- Express server → Control controller: mounts routes (evidence: `backend/src/index.ts`)
- Control controller → Control service: calls (evidence: `backend/src/controllers/controlClinico.controller.ts`)
- Control service → Prisma client: queries (evidence: `backend/src/services/controlClinico.service.ts`)
- Express server → Workshop session controller: mounts routes (evidence: `backend/src/index.ts`)
- Workshop session controller → Session service: calls (evidence: `backend/src/controllers/sesionTaller.controller.ts`)
- Session service → Prisma client: queries (evidence: `backend/src/services/sesionTaller.service.ts`)
- Excel import service → Prisma client: writes patients (evidence: `backend/src/services/importacion.service.ts`)
- Express server → Reporting service: mounts reports (evidence: `backend/src/index.ts`)
- Reporting service → Prisma client: queries (evidence: `backend/src/services/reportes.service.ts`)
- Prisma client → PostgreSQL: persists records (evidence: `README.md`)
