# manuelrisco/tf-pendientes architecture

> Architecture diagram of the GitHub repository manuelrisco/tf-pendientes, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/manuelrisco/tf-pendientes
- Repository: https://github.com/manuelrisco/tf-pendientes

## Overview

#### 1. Purpose and System Shape
This is a task-management and operational tracking system with a React/Vite single-page frontend and a PHP API backend. It supports authentication, task administration, user management, dashboards, movements/audit activity, catalogs, and reporting. Database artifacts are under `BD/bd.txt` and `BD/tf_pendientes.sql`.

#### 2. Application Entry Points
- Frontend bootstraps React from `frontend/src/main.jsx`, with application composition and routing likely rooted in `frontend/src/App.jsx`.
- PHP requests enter through `backend/index.php`; Apache rewrite behavior is defined by `backend/.htaccess`.
- API dispatch is centralized in `backend/core/Router.php`, separating HTTP entry handling from feature controllers.

#### 3. Frontend Shell, Session, and UI State
The SPA uses provider-level state for authentication and theme behavior:
- `frontend/src/context/AuthContext.jsx`
- `frontend/src/context/ThemeContext.jsx`
- `frontend/src/components/Layout/Layout.jsx`

The authenticated application shell is composed from layout/navigation elements such as `frontend/src/components/Sidebar/Sidebar.jsx` and `frontend/src/components/TopBar/TopBar.jsx`. The HTTP client boundary is `frontend/src/lib/axios.js`, which should be the principal frontend-to-API integration point.

#### 4. Feature Screens and Client Flows
Feature pages own their view-specific fetch/mutation orchestration through colocated hooks:
- Dashboard: `frontend/src/pages/Dashboard/Dashboard.jsx`, `frontend/src/pages/Dashboard/useDashboard.js`
- Task management: `frontend/src/pages/GestionTareas/GestionTareas.jsx`, `frontend/src/pages/GestionTareas/useGestionTareas.js`
- User administration: `frontend/src/pages/Usuarios/Usuarios.jsx`, `frontend/src/pages/Usuarios/useUsuarios.js`

Additional operational views are `frontend/src/pages/Movimientos/Movimientos.jsx` and `frontend/src/pages/Reportes/Reportes.jsx`. Login is isolated in `frontend/src/pages/Login/Login.jsx` and `frontend/src/pages/Login/useLogin.js`, forming the transition into authenticated state.

#### 5. API Controller and Authorization Layer
Controllers expose domain-oriented endpoints:
- Authentication and users: `backend/controllers/AuthController.php`, `backend/controllers/UsuarioController.php`
- Tasks and movements: `backend/controllers/TareaController.php`, `backend/controllers/MovimientosController.php`
- Dashboard, reports, and catalog values: `backend/controllers/DashboardController.php`, `backend/controllers/ReporteController.php`, `backend/controllers/CatalogoController.php`

Cross-cutting request boundaries are JWT issuance/verification in `backend/core/JwtHelper.php`, authorization enforcement in `backend/middleware/AuthMiddleware.php`, and normalized API output in `backend/core/Response.php`. The frontend session must carry credentials through its Axios boundary; protected API routes must pass middleware before controller execution.

#### 6. Persistence and Domain Model
Database connection configuration is centralized at `backend/config/database.php`. Controller operations are delegated to query/data-access models:
- Tasks and users: `backend/models/TareaModel.php`, `backend/models/UsuarioModel.php`
- Aggregations/reporting: `backend/models/DashboardModel.php`, `backend/models/ReporteModel.php`
- Reference data: `backend/models/CatalogoModel.php`

Domain entities define the system’s core records and reference dimensions: `backend/entities/Tarea.php`, `backend/entities/Movimiento.php`, `backend/entities/Usuario.php`, plus status, priority, role, and audit-related entities such as `backend/entities/Estado.php`, `backend/entities/Prioridad.php`, and `backend/entities/Bitacora.php`.

#### 7. Runtime and Infrastructure Boundaries
The frontend is a Vite-managed JavaScript/React runtime (`frontend/package.json`, `frontend/vite.config.js`). The backend is a Composer-managed PHP deployment (`backend/composer.json`) served through an Apache-compatible entry/rewrite setup. Its only evident infrastructure dependency is a relational database configured by `backend/config/database.php`; the repository does not show third-party SaaS integrations.

Main entry points: [`frontend/src/lib/axios.js`](https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/src/lib/axios.js) (Axios client), [`frontend/src/App.jsx`](https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/src/App.jsx) (App routing), [`frontend/src/components/Layout/Layout.jsx`](https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/src/components/Layout/Layout.jsx) (Authenticated layout), [`backend/controllers/TareaController.php`](https://github.com/manuelrisco/tf-pendientes/blob/main/backend/controllers/TareaController.php) (Domain controllers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React SPA"]
  node_vite{{"Vite runtime<br/>build runtime<br/>[vite.config.js]"}}
  node_spa_entry["SPA entry<br/>React bootstrap<br/>[main.jsx]"]
  node_app_router["App routing<br/>application shell<br/>[App.jsx]"]
  node_session_state["Session state<br/>auth provider<br/>[AuthContext.jsx]"]
  node_theme_state["Theme state<br/>theme provider<br/>[ThemeContext.jsx]"]
  node_authenticated_layout["Authenticated layout<br/>UI shell<br/>[Layout.jsx]"]
  node_api_client["Axios client<br/>HTTP boundary<br/>[axios.js]"]
  node_login["Login flow<br/>screen and hook<br/>[Login.jsx]"]
  node_dashboard["Dashboard<br/>screen and hook<br/>[Dashboard.jsx]"]
  node_task_management["Task management<br/>screen and hook<br/>[GestionTareas.jsx]"]
  node_user_admin["User administration<br/>screen and hook<br/>[Usuarios.jsx]"]
  node_operations_views["Movements and reports<br/>operational screens<br/>[Movimientos.jsx]"]
end

subgraph group_api["PHP API"]
  node_apache_entry["Apache API entry<br/>HTTP entry point<br/>[index.php]"]
  node_router["API router<br/>request dispatcher<br/>[Router.php]"]
  node_auth_boundary["JWT authorization<br/>middleware and token helper<br/>[AuthMiddleware.php]"]
  node_controllers["Domain controllers<br/>API controllers"]
  node_domain_entities["Domain entities<br/>record definitions<br/>[Tarea.php]"]
end

subgraph group_data["Persistence"]
  node_models["Data-access models<br/>query layer<br/>[TareaModel.php]"]
  node_database_config["Database connection<br/>connection configuration<br/>[database.php]"]
  node_relational_db[("Relational database<br/>task-tracking schema<br/>[tf_pendientes.sql]")]
end

node_vite -->|"serves"| node_spa_entry
node_spa_entry -->|"mounts"| node_app_router
node_app_router -->|"uses"| node_session_state
node_app_router -->|"uses"| node_theme_state
node_app_router -->|"routes to"| node_login
node_app_router -->|"routes authenticated users to"| node_authenticated_layout
node_authenticated_layout -->|"hosts"| node_dashboard
node_authenticated_layout -->|"hosts"| node_task_management
node_authenticated_layout -->|"hosts"| node_user_admin
node_authenticated_layout -->|"hosts"| node_operations_views
node_login -->|"authenticates through"| node_api_client
node_dashboard -->|"loads data through"| node_api_client
node_task_management -->|"mutates through"| node_api_client
node_user_admin -->|"manages through"| node_api_client
node_operations_views -->|"queries through"| node_api_client
node_api_client -->|"HTTP requests"| node_apache_entry
node_apache_entry -->|"dispatches"| node_router
node_router -->|"protects routes with"| node_auth_boundary
node_auth_boundary -->|"authorizes"| node_controllers
node_router -.->|"dispatches public routes to"| node_controllers
node_controllers -->|"delegates queries to"| node_models
node_controllers -->|"uses"| node_domain_entities
node_models -->|"connects via"| node_database_config
node_database_config -->|"connects to"| node_relational_db

click node_vite "https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/vite.config.js"
click node_spa_entry "https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/src/main.jsx"
click node_app_router "https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/src/App.jsx"
click node_session_state "https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/src/context/AuthContext.jsx"
click node_theme_state "https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/src/context/ThemeContext.jsx"
click node_authenticated_layout "https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/src/components/Layout/Layout.jsx"
click node_api_client "https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/src/lib/axios.js"
click node_login "https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/src/pages/Login/Login.jsx"
click node_dashboard "https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/src/pages/Dashboard/Dashboard.jsx"
click node_task_management "https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/src/pages/GestionTareas/GestionTareas.jsx"
click node_user_admin "https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/src/pages/Usuarios/Usuarios.jsx"
click node_operations_views "https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/src/pages/Movimientos/Movimientos.jsx"
click node_apache_entry "https://github.com/manuelrisco/tf-pendientes/blob/main/backend/index.php"
click node_router "https://github.com/manuelrisco/tf-pendientes/blob/main/backend/core/Router.php"
click node_auth_boundary "https://github.com/manuelrisco/tf-pendientes/blob/main/backend/middleware/AuthMiddleware.php"
click node_controllers "https://github.com/manuelrisco/tf-pendientes/blob/main/backend/controllers/TareaController.php"
click node_models "https://github.com/manuelrisco/tf-pendientes/blob/main/backend/models/TareaModel.php"
click node_database_config "https://github.com/manuelrisco/tf-pendientes/blob/main/backend/config/database.php"
click node_relational_db "https://github.com/manuelrisco/tf-pendientes/blob/main/BD/tf_pendientes.sql"
click node_domain_entities "https://github.com/manuelrisco/tf-pendientes/blob/main/backend/entities/Tarea.php"

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_vite,node_spa_entry,node_app_router,node_session_state,node_theme_state,node_authenticated_layout,node_api_client,node_login,node_dashboard,node_task_management,node_user_admin,node_operations_views toneBlue
class node_apache_entry,node_router,node_auth_boundary,node_controllers,node_domain_entities toneAmber
class node_models,node_database_config,node_relational_db toneMint
```

## Components

### React SPA

Vite-managed browser application.

- [Vite runtime](https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/vite.config.js): build runtime · `frontend/vite.config.js`
- [SPA entry](https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/src/main.jsx): React bootstrap · `frontend/src/main.jsx`
- [App routing](https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/src/App.jsx): application shell · `frontend/src/App.jsx`
- [Session state](https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/src/context/AuthContext.jsx): auth provider · Stores authenticated client state. · `frontend/src/context/AuthContext.jsx`
- [Theme state](https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/src/context/ThemeContext.jsx): theme provider · `frontend/src/context/ThemeContext.jsx`
- [Authenticated layout](https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/src/components/Layout/Layout.jsx): UI shell · Composes navigation and protected views. · `frontend/src/components/Layout/Layout.jsx`
- [Axios client](https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/src/lib/axios.js): HTTP boundary · Carries frontend requests and credentials to the API. · `frontend/src/lib/axios.js`
- [Login flow](https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/src/pages/Login/Login.jsx): screen and hook · Authenticates users and establishes session state. · `frontend/src/pages/Login/Login.jsx`
- [Dashboard](https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/src/pages/Dashboard/Dashboard.jsx): screen and hook · `frontend/src/pages/Dashboard/Dashboard.jsx`
- [Task management](https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/src/pages/GestionTareas/GestionTareas.jsx): screen and hook · `frontend/src/pages/GestionTareas/GestionTareas.jsx`
- [User administration](https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/src/pages/Usuarios/Usuarios.jsx): screen and hook · `frontend/src/pages/Usuarios/Usuarios.jsx`
- [Movements and reports](https://github.com/manuelrisco/tf-pendientes/blob/main/frontend/src/pages/Movimientos/Movimientos.jsx): operational screens · `frontend/src/pages/Movimientos/Movimientos.jsx`

### PHP API

Apache-served API runtime.

- [Apache API entry](https://github.com/manuelrisco/tf-pendientes/blob/main/backend/index.php): HTTP entry point · Rewrite rules direct requests into PHP. · `backend/index.php`
- [API router](https://github.com/manuelrisco/tf-pendientes/blob/main/backend/core/Router.php): request dispatcher · Routes requests to domain controllers. · `backend/core/Router.php`
- [JWT authorization](https://github.com/manuelrisco/tf-pendientes/blob/main/backend/middleware/AuthMiddleware.php): middleware and token helper · Verifies protected requests and issues session tokens. · `backend/middleware/AuthMiddleware.php`
- [Domain controllers](https://github.com/manuelrisco/tf-pendientes/blob/main/backend/controllers/TareaController.php): API controllers · Auth, users, tasks, movements, dashboard, reports, and catalogs. · `backend/controllers/TareaController.php`
- [Domain entities](https://github.com/manuelrisco/tf-pendientes/blob/main/backend/entities/Tarea.php): record definitions · Task, user, movement, status, priority, role, and audit records. · `backend/entities/Tarea.php`

### Persistence

Relational task-tracking data.

- [Data-access models](https://github.com/manuelrisco/tf-pendientes/blob/main/backend/models/TareaModel.php): query layer · Executes domain queries and report aggregations. · `backend/models/TareaModel.php`
- [Database connection](https://github.com/manuelrisco/tf-pendientes/blob/main/backend/config/database.php): connection configuration · `backend/config/database.php`
- [Relational database](https://github.com/manuelrisco/tf-pendientes/blob/main/BD/tf_pendientes.sql): task-tracking schema · Stores tasks, users, movements, audit records, and catalogs. · `BD/tf_pendientes.sql`

## Connections

- Vite runtime → SPA entry: serves
- SPA entry → App routing: mounts
- App routing → Session state: uses
- App routing → Theme state: uses
- App routing → Login flow: routes to
- App routing → Authenticated layout: routes authenticated users to
- Authenticated layout → Dashboard: hosts
- Authenticated layout → Task management: hosts
- Authenticated layout → User administration: hosts
- Authenticated layout → Movements and reports: hosts
- Login flow → Axios client: authenticates through
- Dashboard → Axios client: loads data through
- Task management → Axios client: mutates through
- User administration → Axios client: manages through
- Movements and reports → Axios client: queries through
- Axios client → Apache API entry: HTTP requests
- Apache API entry → API router: dispatches
- API router → JWT authorization: protects routes with
- JWT authorization → Domain controllers: authorizes
- API router → Domain controllers: dispatches public routes to
- Domain controllers → Data-access models: delegates queries to
- Domain controllers → Domain entities: uses
- Data-access models → Database connection: connects via
- Database connection → Relational database: connects to
