# zizur8/alafe-rcs architecture

> Architecture diagram of the GitHub repository zizur8/alafe-rcs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zizur8/alafe-rcs
- Repository: https://github.com/zizur8/alafe-rcs

## Overview

ALAFE is a multi-tenant scheduling and business-management product: users sign in to a workspace, manage agendas, clients, and events, and administer access and settings. The React SPA is the user-facing entry point; its feature services use a centralized HTTP client, while the ASP.NET API routes requests through controllers into domain services and SQL-backed persistence. The README also identifies catalogues, movements, and reports as capabilities; reports are explicitly on stand-by. Relationships not demonstrated by the excerpts or source index are omitted or marked unverified.

Main entry points: [`backend/Data/AlafeDbContext.cs`](https://github.com/zizur8/alafe-rcs/blob/main/backend/Data/AlafeDbContext.cs) (EF Core context), [`frontend/src/App.tsx`](https://github.com/zizur8/alafe-rcs/blob/main/frontend/src/App.tsx) (SPA routing), [`backend/Program.cs`](https://github.com/zizur8/alafe-rcs/blob/main/backend/Program.cs) (REST API), [`backend/Services/EventoService.cs`](https://github.com/zizur8/alafe-rcs/blob/main/backend/Services/EventoService.cs) (Event lifecycle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend experience"]
  node_app["SPA routing<br/>[App.tsx]"]
  node_auth_ui["Authentication state<br/>[AuthContext.tsx]"]
  node_workspace["Workspace context"]
  node_agenda_ui["Agenda workspace<br/>[AgendaPage.tsx]"]
  node_clients_ui["Client management<br/>[ClientsModule.tsx]"]
  node_event_hook["Agenda event state"]
  node_client_api["Client API adapter<br/>[clientesService.ts]"]
  node_event_api["Event API adapter<br/>[eventosService.ts]"]
  node_http["HTTP client<br/>[apiClient.ts]"]
end

subgraph group_api["API and domain"]
  node_backend_api["REST API<br/>[Program.cs]"]
  node_auth_controller["Authentication routes<br/>[AuthController.cs]"]
  node_event_controller["Event routes"]
  node_client_controller["Client routes"]
  node_user_controller["User administration routes"]
  node_event_service["Event lifecycle<br/>[EventoService.cs]"]
  node_client_service["Client management service<br/>[ClienteService.cs]"]
  node_user_service["User administration service<br/>[UsuarioService.cs]"]
  node_catalogue_service["Catalogues<br/>[CatalogoService.cs]"]
  node_movement_service["Financial movements"]
  node_reports["Reports &#40;stand-by&#41;<br/>[ReportsModule.tsx]"]
  node_activity_query["Client activity query"]
end

subgraph group_security["Identity and access"]
  node_auth_service["Authentication service<br/>[AuthService.cs]"]
  node_access["Agenda access control"]
  node_jwt["JWT token service<br/>[JwtTokenService.cs]"]
end

subgraph group_data["Persistence"]
  node_dbcontext["EF Core context<br/>[AlafeDbContext.cs]"]
  node_domain_models["Workspace and domain entities"]
  node_seeder["Database seeding<br/>[DatabaseSeeder.cs]"]
end

node_user(("Workspace user"))
node_sql[("SQL Server")]

node_user -->|"uses"| node_app
node_app -->|"uses context"| node_auth_ui
node_app -->|"uses context"| node_workspace
node_app -->|"routes to"| node_agenda_ui
node_app -.->|"routes to"| node_clients_ui
node_event_hook -->|"uses"| node_http
node_event_hook -->|"calls"| node_event_api
node_clients_ui -->|"calls"| node_client_api
node_client_api -.->|"uses"| node_http
node_event_api -.->|"uses"| node_http
node_http -.->|"sends HTTP"| node_backend_api
node_backend_api -.->|"routes requests"| node_auth_controller
node_backend_api -.->|"routes requests"| node_event_controller
node_backend_api -.->|"routes requests"| node_client_controller
node_backend_api -.->|"routes requests"| node_user_controller
node_auth_controller -->|"calls"| node_auth_service
node_event_controller -->|"calls"| node_event_service
node_client_controller -->|"calls"| node_client_service
node_user_controller -->|"calls"| node_user_service
node_auth_service -->|"reads and writes"| node_dbcontext
node_auth_service -->|"issues tokens"| node_jwt
node_auth_service -->|"queries agendas"| node_access
node_event_service -->|"reads and writes"| node_dbcontext
node_event_service -->|"checks access"| node_access
node_event_service -->|"persists events"| node_domain_models
node_client_service -.->|"uses query"| node_activity_query
node_activity_query -->|"queries data"| node_dbcontext
node_activity_query -->|"filters agendas"| node_access
node_dbcontext -->|"maps entities"| node_domain_models
node_dbcontext -.->|"persists data"| node_sql
node_seeder -->|"seeds data"| node_dbcontext
node_seeder -->|"creates records"| node_domain_models

click node_app "https://github.com/zizur8/alafe-rcs/blob/main/frontend/src/App.tsx"
click node_auth_ui "https://github.com/zizur8/alafe-rcs/blob/main/frontend/src/context/AuthContext.tsx"
click node_workspace "https://github.com/zizur8/alafe-rcs/blob/main/frontend/src/context/WorkspaceContext.tsx"
click node_agenda_ui "https://github.com/zizur8/alafe-rcs/blob/main/frontend/src/pages/AgendaPage.tsx"
click node_clients_ui "https://github.com/zizur8/alafe-rcs/blob/main/frontend/src/components/modules/ClientsModule.tsx"
click node_event_hook "https://github.com/zizur8/alafe-rcs/blob/main/frontend/src/features/eventos/useEventosAgenda.ts"
click node_client_api "https://github.com/zizur8/alafe-rcs/blob/main/frontend/src/features/clientes/clientesService.ts"
click node_event_api "https://github.com/zizur8/alafe-rcs/blob/main/frontend/src/features/eventos/eventosService.ts"
click node_http "https://github.com/zizur8/alafe-rcs/blob/main/frontend/src/services/apiClient.ts"
click node_backend_api "https://github.com/zizur8/alafe-rcs/blob/main/backend/Program.cs"
click node_auth_controller "https://github.com/zizur8/alafe-rcs/blob/main/backend/Controllers/AuthController.cs"
click node_event_controller "https://github.com/zizur8/alafe-rcs/blob/main/backend/Controllers/EventosController.cs"
click node_client_controller "https://github.com/zizur8/alafe-rcs/blob/main/backend/Controllers/ClientesController.cs"
click node_user_controller "https://github.com/zizur8/alafe-rcs/blob/main/backend/Controllers/UsuariosController.cs"
click node_auth_service "https://github.com/zizur8/alafe-rcs/blob/main/backend/Services/AuthService.cs"
click node_event_service "https://github.com/zizur8/alafe-rcs/blob/main/backend/Services/EventoService.cs"
click node_client_service "https://github.com/zizur8/alafe-rcs/blob/main/backend/Services/ClienteService.cs"
click node_user_service "https://github.com/zizur8/alafe-rcs/blob/main/backend/Services/UsuarioService.cs"
click node_catalogue_service "https://github.com/zizur8/alafe-rcs/blob/main/backend/Services/CatalogoService.cs"
click node_movement_service "https://github.com/zizur8/alafe-rcs/blob/main/backend/Services/MovimientoService.cs"
click node_reports "https://github.com/zizur8/alafe-rcs/blob/main/frontend/src/components/modules/ReportsModule.tsx"
click node_access "https://github.com/zizur8/alafe-rcs/blob/main/backend/Security/AgendaAccessService.cs"
click node_jwt "https://github.com/zizur8/alafe-rcs/blob/main/backend/Security/JwtTokenService.cs"
click node_activity_query "https://github.com/zizur8/alafe-rcs/blob/main/backend/Services/Queries/ClientActivityQuery.cs"
click node_dbcontext "https://github.com/zizur8/alafe-rcs/blob/main/backend/Data/AlafeDbContext.cs"
click node_domain_models "https://github.com/zizur8/alafe-rcs/tree/main/backend/Models"
click node_seeder "https://github.com/zizur8/alafe-rcs/blob/main/backend/Data/Seed/DatabaseSeeder.cs"

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_auth_ui,node_workspace,node_agenda_ui,node_clients_ui,node_event_hook,node_client_api,node_event_api,node_http,node_user toneBlue
class node_backend_api,node_auth_controller,node_event_controller,node_client_controller,node_user_controller,node_event_service,node_client_service,node_user_service,node_catalogue_service,node_movement_service,node_reports,node_activity_query,node_sql toneAmber
class node_auth_service,node_access,node_jwt toneMint
class node_dbcontext,node_domain_models,node_seeder toneRose
```

## Components

### Frontend experience

- [SPA routing](https://github.com/zizur8/alafe-rcs/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Authentication state](https://github.com/zizur8/alafe-rcs/blob/main/frontend/src/context/AuthContext.tsx): `frontend/src/context/AuthContext.tsx`
- [Workspace context](https://github.com/zizur8/alafe-rcs/blob/main/frontend/src/context/WorkspaceContext.tsx): `frontend/src/context/WorkspaceContext.tsx`
- [Agenda workspace](https://github.com/zizur8/alafe-rcs/blob/main/frontend/src/pages/AgendaPage.tsx): `frontend/src/pages/AgendaPage.tsx`
- [Client management](https://github.com/zizur8/alafe-rcs/blob/main/frontend/src/components/modules/ClientsModule.tsx): `frontend/src/components/modules/ClientsModule.tsx`
- [Agenda event state](https://github.com/zizur8/alafe-rcs/blob/main/frontend/src/features/eventos/useEventosAgenda.ts): `frontend/src/features/eventos/useEventosAgenda.ts`
- [Client API adapter](https://github.com/zizur8/alafe-rcs/blob/main/frontend/src/features/clientes/clientesService.ts): `frontend/src/features/clientes/clientesService.ts`
- [Event API adapter](https://github.com/zizur8/alafe-rcs/blob/main/frontend/src/features/eventos/eventosService.ts): `frontend/src/features/eventos/eventosService.ts`
- [HTTP client](https://github.com/zizur8/alafe-rcs/blob/main/frontend/src/services/apiClient.ts): `frontend/src/services/apiClient.ts`

### API and domain

- [REST API](https://github.com/zizur8/alafe-rcs/blob/main/backend/Program.cs): `backend/Program.cs`
- [Authentication routes](https://github.com/zizur8/alafe-rcs/blob/main/backend/Controllers/AuthController.cs): `backend/Controllers/AuthController.cs`
- [Event routes](https://github.com/zizur8/alafe-rcs/blob/main/backend/Controllers/EventosController.cs): `backend/Controllers/EventosController.cs`
- [Client routes](https://github.com/zizur8/alafe-rcs/blob/main/backend/Controllers/ClientesController.cs): `backend/Controllers/ClientesController.cs`
- [User administration routes](https://github.com/zizur8/alafe-rcs/blob/main/backend/Controllers/UsuariosController.cs): `backend/Controllers/UsuariosController.cs`
- [Event lifecycle](https://github.com/zizur8/alafe-rcs/blob/main/backend/Services/EventoService.cs): `backend/Services/EventoService.cs`
- [Client management service](https://github.com/zizur8/alafe-rcs/blob/main/backend/Services/ClienteService.cs): `backend/Services/ClienteService.cs`
- [User administration service](https://github.com/zizur8/alafe-rcs/blob/main/backend/Services/UsuarioService.cs): `backend/Services/UsuarioService.cs`
- [Catalogues](https://github.com/zizur8/alafe-rcs/blob/main/backend/Services/CatalogoService.cs): `backend/Services/CatalogoService.cs`
- [Financial movements](https://github.com/zizur8/alafe-rcs/blob/main/backend/Services/MovimientoService.cs): `backend/Services/MovimientoService.cs`
- [Reports (stand-by)](https://github.com/zizur8/alafe-rcs/blob/main/frontend/src/components/modules/ReportsModule.tsx): `frontend/src/components/modules/ReportsModule.tsx`
- [Client activity query](https://github.com/zizur8/alafe-rcs/blob/main/backend/Services/Queries/ClientActivityQuery.cs): `backend/Services/Queries/ClientActivityQuery.cs`

### Identity and access

- [Authentication service](https://github.com/zizur8/alafe-rcs/blob/main/backend/Services/AuthService.cs): `backend/Services/AuthService.cs`
- [Agenda access control](https://github.com/zizur8/alafe-rcs/blob/main/backend/Security/AgendaAccessService.cs): `backend/Security/AgendaAccessService.cs`
- [JWT token service](https://github.com/zizur8/alafe-rcs/blob/main/backend/Security/JwtTokenService.cs): `backend/Security/JwtTokenService.cs`

### Persistence

- [EF Core context](https://github.com/zizur8/alafe-rcs/blob/main/backend/Data/AlafeDbContext.cs): `backend/Data/AlafeDbContext.cs`
- [Workspace and domain entities](https://github.com/zizur8/alafe-rcs/tree/main/backend/Models): `backend/Models`
- [Database seeding](https://github.com/zizur8/alafe-rcs/blob/main/backend/Data/Seed/DatabaseSeeder.cs): `backend/Data/Seed/DatabaseSeeder.cs`

### Other components

- **Workspace user**
- **SQL Server**

## Connections

- Workspace user → SPA routing: uses (evidence: `frontend/src/App.tsx`)
- SPA routing → Authentication state: uses context (evidence: `frontend/src/App.tsx`)
- SPA routing → Workspace context: uses context (evidence: `frontend/src/App.tsx`)
- SPA routing → Agenda workspace: routes to (evidence: `frontend/src/App.tsx`)
- SPA routing → Client management: routes to
- Agenda event state → HTTP client: uses (evidence: `frontend/src/features/eventos/useEventosAgenda.ts`)
- Agenda event state → Event API adapter: calls (evidence: `frontend/src/features/eventos/useEventosAgenda.ts`)
- Client management → Client API adapter: calls (evidence: `frontend/src/components/modules/ClientsModule.tsx`)
- Client API adapter → HTTP client: uses (evidence: `frontend/src/features/clientes/clientesService.ts`)
- Event API adapter → HTTP client: uses
- HTTP client → REST API: sends HTTP
- REST API → Authentication routes: routes requests
- REST API → Event routes: routes requests
- REST API → Client routes: routes requests
- REST API → User administration routes: routes requests
- Authentication routes → Authentication service: calls (evidence: `backend/Controllers/AuthController.cs`)
- Event routes → Event lifecycle: calls (evidence: `backend/Controllers/EventosController.cs`)
- Client routes → Client management service: calls (evidence: `backend/Controllers/ClientesController.cs`)
- User administration routes → User administration service: calls (evidence: `backend/Controllers/UsuariosController.cs`)
- Authentication service → EF Core context: reads and writes (evidence: `backend/Services/AuthService.cs`)
- Authentication service → JWT token service: issues tokens (evidence: `backend/Services/AuthService.cs`)
- Authentication service → Agenda access control: queries agendas (evidence: `backend/Services/AuthService.cs`)
- Event lifecycle → EF Core context: reads and writes (evidence: `backend/Services/EventoService.cs`)
- Event lifecycle → Agenda access control: checks access (evidence: `backend/Services/EventoService.cs`)
- Event lifecycle → Workspace and domain entities: persists events (evidence: `backend/Services/EventoService.cs`)
- Client management service → Client activity query: uses query
- Client activity query → EF Core context: queries data (evidence: `backend/Services/Queries/ClientActivityQuery.cs`)
- Client activity query → Agenda access control: filters agendas (evidence: `backend/Services/Queries/ClientActivityQuery.cs`)
- EF Core context → Workspace and domain entities: maps entities (evidence: `backend/Data/AlafeDbContext.cs`)
- EF Core context → SQL Server: persists data
- Database seeding → EF Core context: seeds data (evidence: `backend/Data/Seed/DatabaseSeeder.cs`)
- Database seeding → Workspace and domain entities: creates records (evidence: `backend/Data/Seed/DatabaseSeeder.cs`)
