# nesantime/cfs-admin architecture

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

- Interactive diagram: https://gitdiagram.com/nesantime/cfs-admin
- Repository: https://github.com/nesantime/cfs-admin

## Overview

CFS-Admin is a web-based user and network-administration prototype with authentication, site and account management, contacts, chat, and videoconferencing. The user workflow starts in the browser, reaches FastAPI through the documented `/api/` proxy, and uses authenticated API routes backed by PostgreSQL. Authentication and authorization form a shared internal layer; the product also has distinct administration, contacts/chat, and video capabilities. The README documents the browser-to-API-to-database deployment, while source-index references and excerpts support the API routing and persistence links shown. Unsampled frontend wiring is not inferred.

Main entry points: [`backend/core/app.py`](https://github.com/nesantime/cfs-admin/blob/stable/backend/core/app.py) (FastAPI app), [`backend/db/controller.py`](https://github.com/nesantime/cfs-admin/blob/stable/backend/db/controller.py) (DB sessions), [`backend/api/videoconferencia.py`](https://github.com/nesantime/cfs-admin/blob/stable/backend/api/videoconferencia.py) (Videoconferencing), [`backend/api/login.py`](https://github.com/nesantime/cfs-admin/blob/stable/backend/api/login.py) (Auth routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_frontend["Web interface"]
  node_proxy["Apache proxy"]
end

subgraph group_api["API and access"]
  node_app["FastAPI app<br/>[app.py]"]
  node_auth["Auth routes<br/>[login.py]"]
  node_profile["Profile routes<br/>[perfil.py]"]
  node_access["Access control<br/>[deps.py]"]
  node_security["Token security<br/>[security.py]"]
end

subgraph group_admin["Administration"]
  node_accounts["User management<br/>[usuarios.py]"]
  node_sites["Site management<br/>[sedes.py]"]
  node_user_services["Service assignment"]
end

subgraph group_collaboration["Collaboration"]
  node_contacts["Contacts<br/>[contactos.py]"]
  node_chat["Chat<br/>[chat.py]"]
  node_video["Videoconferencing"]
  node_heartbeat["Presence<br/>[heartbeat.py]"]
end

subgraph group_storage["Persistence"]
  node_db_session["DB sessions<br/>[controller.py]"]
  node_employee_model["Employee model<br/>[empleado.py]"]
  node_site_model["Site model<br/>[sede.py]"]
  node_service_model["User services model"]
  node_contact_model["Contact model<br/>[contacto.py]"]
  node_message_model["Chat message model<br/>[mensaje_chat.py]"]
  node_room_model["Video room model<br/>[sala_videoconf.py]"]
  node_invitation_model["Invitation model"]
  node_postgres[("PostgreSQL")]
end

node_browser(("User"))

node_browser -->|"uses"| node_frontend
node_frontend -->|"requests API"| node_proxy
node_proxy -->|"proxies /api"| node_app
node_app -->|"registers routes"| node_auth
node_app -->|"registers routes"| node_profile
node_app -->|"registers routes"| node_accounts
node_app -->|"registers routes"| node_sites
node_app -->|"registers routes"| node_user_services
node_app -->|"registers routes"| node_contacts
node_app -->|"registers routes"| node_chat
node_app -->|"registers routes"| node_video
node_app -->|"registers routes"| node_heartbeat
node_auth -->|"creates tokens"| node_security
node_profile -->|"uses token functions"| node_security
node_access -->|"decodes tokens"| node_security
node_access -->|"gets session"| node_db_session
node_auth -->|"gets session"| node_db_session
node_accounts -->|"gets session"| node_db_session
node_sites -->|"gets session"| node_db_session
node_user_services -->|"gets session"| node_db_session
node_contacts -->|"gets session"| node_db_session
node_chat -->|"gets session"| node_db_session
node_video -->|"gets session"| node_db_session
node_heartbeat -->|"gets session"| node_db_session
node_db_session -->|"connects"| node_postgres
node_accounts -->|"queries"| node_employee_model
node_sites -->|"queries"| node_site_model
node_user_services -->|"queries"| node_service_model
node_contacts -->|"queries"| node_contact_model
node_chat -->|"queries"| node_message_model
node_video -->|"queries"| node_room_model
node_video -->|"queries"| node_invitation_model

click node_frontend "https://github.com/nesantime/cfs-admin/tree/stable/frontend"
click node_app "https://github.com/nesantime/cfs-admin/blob/stable/backend/core/app.py"
click node_auth "https://github.com/nesantime/cfs-admin/blob/stable/backend/api/login.py"
click node_profile "https://github.com/nesantime/cfs-admin/blob/stable/backend/api/perfil.py"
click node_access "https://github.com/nesantime/cfs-admin/blob/stable/backend/core/deps.py"
click node_security "https://github.com/nesantime/cfs-admin/blob/stable/backend/core/security.py"
click node_accounts "https://github.com/nesantime/cfs-admin/blob/stable/backend/api/usuarios.py"
click node_sites "https://github.com/nesantime/cfs-admin/blob/stable/backend/api/sedes.py"
click node_user_services "https://github.com/nesantime/cfs-admin/blob/stable/backend/api/servicios_usuario.py"
click node_contacts "https://github.com/nesantime/cfs-admin/blob/stable/backend/api/contactos.py"
click node_chat "https://github.com/nesantime/cfs-admin/blob/stable/backend/api/chat.py"
click node_video "https://github.com/nesantime/cfs-admin/blob/stable/backend/api/videoconferencia.py"
click node_heartbeat "https://github.com/nesantime/cfs-admin/blob/stable/backend/api/heartbeat.py"
click node_db_session "https://github.com/nesantime/cfs-admin/blob/stable/backend/db/controller.py"
click node_employee_model "https://github.com/nesantime/cfs-admin/blob/stable/backend/db/template/empleado.py"
click node_site_model "https://github.com/nesantime/cfs-admin/blob/stable/backend/db/template/sede.py"
click node_service_model "https://github.com/nesantime/cfs-admin/blob/stable/backend/db/template/servicio_usuario.py"
click node_contact_model "https://github.com/nesantime/cfs-admin/blob/stable/backend/db/template/contacto.py"
click node_message_model "https://github.com/nesantime/cfs-admin/blob/stable/backend/db/template/mensaje_chat.py"
click node_room_model "https://github.com/nesantime/cfs-admin/blob/stable/backend/db/template/sala_videoconf.py"
click node_invitation_model "https://github.com/nesantime/cfs-admin/blob/stable/backend/db/template/invitacion_videoconf.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_frontend,node_proxy,node_browser toneBlue
class node_app,node_auth,node_profile,node_access,node_security toneAmber
class node_accounts,node_sites,node_user_services toneMint
class node_contacts,node_chat,node_video,node_heartbeat toneRose
class node_db_session,node_employee_model,node_site_model,node_service_model,node_contact_model,node_message_model,node_room_model,node_invitation_model,node_postgres toneIndigo
```

## Components

### Web client

- [Web interface](https://github.com/nesantime/cfs-admin/tree/stable/frontend): `frontend`
- **Apache proxy**

### API and access

- [FastAPI app](https://github.com/nesantime/cfs-admin/blob/stable/backend/core/app.py): `backend/core/app.py`
- [Auth routes](https://github.com/nesantime/cfs-admin/blob/stable/backend/api/login.py): `backend/api/login.py`
- [Profile routes](https://github.com/nesantime/cfs-admin/blob/stable/backend/api/perfil.py): `backend/api/perfil.py`
- [Access control](https://github.com/nesantime/cfs-admin/blob/stable/backend/core/deps.py): `backend/core/deps.py`
- [Token security](https://github.com/nesantime/cfs-admin/blob/stable/backend/core/security.py): `backend/core/security.py`

### Administration

- [User management](https://github.com/nesantime/cfs-admin/blob/stable/backend/api/usuarios.py): `backend/api/usuarios.py`
- [Site management](https://github.com/nesantime/cfs-admin/blob/stable/backend/api/sedes.py): `backend/api/sedes.py`
- [Service assignment](https://github.com/nesantime/cfs-admin/blob/stable/backend/api/servicios_usuario.py): `backend/api/servicios_usuario.py`

### Collaboration

- [Contacts](https://github.com/nesantime/cfs-admin/blob/stable/backend/api/contactos.py): `backend/api/contactos.py`
- [Chat](https://github.com/nesantime/cfs-admin/blob/stable/backend/api/chat.py): `backend/api/chat.py`
- [Videoconferencing](https://github.com/nesantime/cfs-admin/blob/stable/backend/api/videoconferencia.py): `backend/api/videoconferencia.py`
- [Presence](https://github.com/nesantime/cfs-admin/blob/stable/backend/api/heartbeat.py): `backend/api/heartbeat.py`

### Persistence

- [DB sessions](https://github.com/nesantime/cfs-admin/blob/stable/backend/db/controller.py): `backend/db/controller.py`
- [Employee model](https://github.com/nesantime/cfs-admin/blob/stable/backend/db/template/empleado.py): `backend/db/template/empleado.py`
- [Site model](https://github.com/nesantime/cfs-admin/blob/stable/backend/db/template/sede.py): `backend/db/template/sede.py`
- [User services model](https://github.com/nesantime/cfs-admin/blob/stable/backend/db/template/servicio_usuario.py): `backend/db/template/servicio_usuario.py`
- [Contact model](https://github.com/nesantime/cfs-admin/blob/stable/backend/db/template/contacto.py): `backend/db/template/contacto.py`
- [Chat message model](https://github.com/nesantime/cfs-admin/blob/stable/backend/db/template/mensaje_chat.py): `backend/db/template/mensaje_chat.py`
- [Video room model](https://github.com/nesantime/cfs-admin/blob/stable/backend/db/template/sala_videoconf.py): `backend/db/template/sala_videoconf.py`
- [Invitation model](https://github.com/nesantime/cfs-admin/blob/stable/backend/db/template/invitacion_videoconf.py): `backend/db/template/invitacion_videoconf.py`
- **PostgreSQL**

### Other components

- **User**

## Connections

- User → Web interface: uses (evidence: `README.md`)
- Web interface → Apache proxy: requests API (evidence: `README.md`)
- Apache proxy → FastAPI app: proxies /api (evidence: `README.md`)
- FastAPI app → Auth routes: registers routes (evidence: `backend/core/app.py`)
- FastAPI app → Profile routes: registers routes (evidence: `backend/core/app.py`)
- FastAPI app → User management: registers routes (evidence: `backend/core/app.py`)
- FastAPI app → Site management: registers routes (evidence: `backend/core/app.py`)
- FastAPI app → Service assignment: registers routes (evidence: `backend/core/app.py`)
- FastAPI app → Contacts: registers routes (evidence: `backend/core/app.py`)
- FastAPI app → Chat: registers routes (evidence: `backend/core/app.py`)
- FastAPI app → Videoconferencing: registers routes (evidence: `backend/core/app.py`)
- FastAPI app → Presence: registers routes (evidence: `backend/core/app.py`)
- Auth routes → Token security: creates tokens (evidence: `backend/api/login.py`)
- Profile routes → Token security: uses token functions (evidence: `backend/api/perfil.py`)
- Access control → Token security: decodes tokens (evidence: `backend/core/deps.py`)
- Access control → DB sessions: gets session (evidence: `backend/core/deps.py`)
- Auth routes → DB sessions: gets session (evidence: `backend/api/login.py`)
- User management → DB sessions: gets session (evidence: `backend/api/usuarios.py`)
- Site management → DB sessions: gets session (evidence: `backend/api/sedes.py`)
- Service assignment → DB sessions: gets session (evidence: `backend/api/servicios_usuario.py`)
- Contacts → DB sessions: gets session (evidence: `backend/api/contactos.py`)
- Chat → DB sessions: gets session (evidence: `backend/api/chat.py`)
- Videoconferencing → DB sessions: gets session (evidence: `backend/api/videoconferencia.py`)
- Presence → DB sessions: gets session (evidence: `backend/api/heartbeat.py`)
- DB sessions → PostgreSQL: connects (evidence: `README.md`)
- User management → Employee model: queries (evidence: `backend/api/usuarios.py`)
- Site management → Site model: queries (evidence: `backend/api/sedes.py`)
- Service assignment → User services model: queries (evidence: `backend/api/servicios_usuario.py`)
- Contacts → Contact model: queries (evidence: `backend/api/contactos.py`)
- Chat → Chat message model: queries (evidence: `backend/api/chat.py`)
- Videoconferencing → Video room model: queries (evidence: `backend/api/videoconferencia.py`)
- Videoconferencing → Invitation model: queries (evidence: `backend/api/videoconferencia.py`)
