# juc-windell/frontend-arreglaya architecture

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

- Interactive diagram: https://gitdiagram.com/juc-windell/frontend-arreglaya
- Repository: https://github.com/juc-windell/frontend-arreglaya

## Overview

ArreglaYa is a React SPA for campus maintenance: users sign in, then access role-adapted dashboards and workflows for buildings/spaces, technicians/materials, requests, and work orders. Pages use service modules to call the Django REST API through a shared Axios client; authentication state, route protection, and error handling support those workflows. The README documents all major modules. Some page and integration code was not sampled, so links for those capabilities rely on documented routes or indexed imports rather than assumptions about internal call sequences.

Main entry points: [`src/App.jsx`](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/App.jsx) (SPA routes), [`src/api/axios.js`](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/api/axios.js) (Axios client), [`src/pages/Ordenes.jsx`](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/pages/Ordenes.jsx) (Work orders), [`src/context/AuthContext.jsx`](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/context/AuthContext.jsx) (Session provider)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and shell"]
  node_app["SPA routes<br/>[App.jsx]"]
  node_auth["Session provider<br/>[AuthContext.jsx]"]
  node_authsvc["Authentication service<br/>[authService.js]"]
  node_authhook["Session hook<br/>[useAuth.js]"]
  node_permissions["Role permissions<br/>[permisos.js]"]
  node_protected["Protected routes<br/>[ProtectedRoute.jsx]"]
end

subgraph group_places["Buildings and spaces"]
  node_buildings["Building pages<br/>[Edificios.jsx]"]
  node_buildingdetail["Building detail and edit"]
  node_buildingservice["Building service<br/>[edificioService.js]"]
  node_spaces["Space pages<br/>[Espacios.jsx]"]
  node_spacedetail["Space detail and edit<br/>[EspacioDetalle.jsx]"]
  node_spaceservice["Space service<br/>[espacioService.js]"]
end

subgraph group_work["Requests and work"]
  node_requests["Request workflow<br/>[Solicitudes.jsx]"]
  node_requestform["Request form<br/>[SolicitudForm.jsx]"]
  node_orders["Work orders<br/>[Ordenes.jsx]"]
  node_orderform["Order form<br/>[OrdenForm.jsx]"]
  node_materialsentry["Register materials"]
  node_order_service["Order service<br/>[ordenService.js]"]
  node_request_service["Request service"]
end

subgraph group_inventory["Inventory and staff"]
  node_technicians["Technician management<br/>[Tecnicos.jsx]"]
  node_technicianservice["Technician service<br/>[tecnicoService.js]"]
  node_materials["Material management<br/>[Materiales.jsx]"]
  node_materialservice["Material service<br/>[materialService.js]"]
end

subgraph group_insights["Dashboard"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_dashboardservice["Dashboard service"]
end

subgraph group_platform["Shared client and UI"]
  node_api["Axios client<br/>[axios.js]"]
  node_errors["API error handling<br/>[errores.js]"]
  node_hooks["Query and route hooks"]
  node_sharedui["Shared UI components"]
end

node_user(("Campus user"))
node_django[("Django REST API")]

node_user -->|"uses"| node_app
node_app -->|"routes through"| node_protected
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_buildings
node_app -->|"routes to"| node_buildingdetail
node_app -->|"routes to"| node_spaces
node_app -->|"routes to"| node_spacedetail
node_app -->|"routes to"| node_technicians
node_app -->|"routes to"| node_materials
node_app -->|"routes to"| node_requests
node_app -->|"routes to"| node_orders
node_app -->|"reads session"| node_authhook
node_auth -->|"authenticates and revokes"| node_authsvc
node_auth -->|"registers 401 handler"| node_api
node_auth -->|"derives role access"| node_permissions
node_protected -->|"checks session"| node_authhook
node_auth -->|"validates profile and revokes token"| node_django
node_api -->|"sends API requests"| node_django
node_buildings -->|"requests building data"| node_buildingservice
node_buildingdetail -->|"requests building data"| node_buildingservice
node_spaces -->|"requests space data"| node_spaceservice
node_spacedetail -->|"requests space data"| node_spaceservice
node_spacedetail -->|"loads building data"| node_buildingservice
node_buildingservice -->|"calls"| node_api
node_spaceservice -->|"calls"| node_api
node_spaceservice -->|"queries related requests"| node_django
node_requests -->|"renders"| node_requestform
node_orders -->|"renders"| node_orderform
node_orders -->|"renders"| node_materialsentry
node_orders -->|"calls"| node_order_service
node_orders -->|"loads request data"| node_request_service
node_orders -->|"loads technician data"| node_technicianservice
node_orders -->|"loads material data"| node_materialservice
node_requests -->|"uses"| node_request_service
node_order_service -->|"calls"| node_api
node_request_service -->|"calls"| node_api
node_technicians -->|"calls"| node_technicianservice
node_materials -->|"calls"| node_materialservice
node_technicianservice -->|"calls"| node_api
node_materialservice -->|"calls"| node_api
node_dashboard -->|"loads indicators"| node_dashboardservice
node_dashboardservice -->|"calls"| node_api
node_hooks -->|"interprets query errors"| node_errors
node_sharedui -.->|"displays API errors"| node_errors
node_api -->|"notifies on 401"| node_auth

click node_app "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/App.jsx"
click node_auth "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/context/AuthContext.jsx"
click node_authsvc "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/services/authService.js"
click node_authhook "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/hooks/useAuth.js"
click node_permissions "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/utils/permisos.js"
click node_protected "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/components/ProtectedRoute.jsx"
click node_buildings "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/pages/Edificios.jsx"
click node_buildingdetail "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/pages/EdificioDetalle.jsx"
click node_buildingservice "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/services/edificioService.js"
click node_spaces "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/pages/Espacios.jsx"
click node_spacedetail "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/pages/EspacioDetalle.jsx"
click node_spaceservice "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/services/espacioService.js"
click node_requests "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/pages/Solicitudes.jsx"
click node_requestform "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/components/solicitudes/SolicitudForm.jsx"
click node_orders "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/pages/Ordenes.jsx"
click node_orderform "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/components/ordenes/OrdenForm.jsx"
click node_materialsentry "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/components/ordenes/RegistrarMateriales.jsx"
click node_order_service "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/services/ordenService.js"
click node_request_service "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/services/solicitudService.js"
click node_technicians "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/pages/Tecnicos.jsx"
click node_technicianservice "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/services/tecnicoService.js"
click node_materials "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/pages/Materiales.jsx"
click node_materialservice "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/services/materialService.js"
click node_dashboard "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/pages/Dashboard.jsx"
click node_dashboardservice "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/services/dashboardService.js"
click node_api "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/api/axios.js"
click node_errors "https://github.com/juc-windell/frontend-arreglaya/blob/main/src/api/errores.js"
click node_hooks "https://github.com/juc-windell/frontend-arreglaya/tree/main/src/hooks"
click node_sharedui "https://github.com/juc-windell/frontend-arreglaya/tree/main/src/components"

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,node_authsvc,node_authhook,node_permissions,node_protected,node_user toneBlue
class node_buildings,node_buildingdetail,node_buildingservice,node_spaces,node_spacedetail,node_spaceservice,node_django toneAmber
class node_requests,node_requestform,node_orders,node_orderform,node_materialsentry,node_order_service,node_request_service toneMint
class node_technicians,node_technicianservice,node_materials,node_materialservice toneRose
class node_dashboard,node_dashboardservice toneIndigo
class node_api,node_errors,node_hooks,node_sharedui toneTeal
```

## Components

### Access and shell

- [SPA routes](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/App.jsx): `src/App.jsx`
- [Session provider](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/context/AuthContext.jsx): `src/context/AuthContext.jsx`
- [Authentication service](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/services/authService.js): `src/services/authService.js`
- [Session hook](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/hooks/useAuth.js): `src/hooks/useAuth.js`
- [Role permissions](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/utils/permisos.js): `src/utils/permisos.js`
- [Protected routes](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/components/ProtectedRoute.jsx): `src/components/ProtectedRoute.jsx`

### Buildings and spaces

- [Building pages](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/pages/Edificios.jsx): `src/pages/Edificios.jsx`
- [Building detail and edit](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/pages/EdificioDetalle.jsx): `src/pages/EdificioDetalle.jsx`
- [Building service](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/services/edificioService.js): `src/services/edificioService.js`
- [Space pages](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/pages/Espacios.jsx): `src/pages/Espacios.jsx`
- [Space detail and edit](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/pages/EspacioDetalle.jsx): `src/pages/EspacioDetalle.jsx`
- [Space service](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/services/espacioService.js): `src/services/espacioService.js`

### Requests and work

- [Request workflow](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/pages/Solicitudes.jsx): `src/pages/Solicitudes.jsx`
- [Request form](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/components/solicitudes/SolicitudForm.jsx): `src/components/solicitudes/SolicitudForm.jsx`
- [Work orders](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/pages/Ordenes.jsx): `src/pages/Ordenes.jsx`
- [Order form](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/components/ordenes/OrdenForm.jsx): `src/components/ordenes/OrdenForm.jsx`
- [Register materials](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/components/ordenes/RegistrarMateriales.jsx): `src/components/ordenes/RegistrarMateriales.jsx`
- [Order service](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/services/ordenService.js): `src/services/ordenService.js`
- [Request service](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/services/solicitudService.js): `src/services/solicitudService.js`

### Inventory and staff

- [Technician management](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/pages/Tecnicos.jsx): `src/pages/Tecnicos.jsx`
- [Technician service](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/services/tecnicoService.js): `src/services/tecnicoService.js`
- [Material management](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/pages/Materiales.jsx): `src/pages/Materiales.jsx`
- [Material service](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/services/materialService.js): `src/services/materialService.js`

### Dashboard

- [Dashboard](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/pages/Dashboard.jsx): `src/pages/Dashboard.jsx`
- [Dashboard service](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/services/dashboardService.js): `src/services/dashboardService.js`

### Shared client and UI

- [Axios client](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/api/axios.js): `src/api/axios.js`
- [API error handling](https://github.com/juc-windell/frontend-arreglaya/blob/main/src/api/errores.js): `src/api/errores.js`
- [Query and route hooks](https://github.com/juc-windell/frontend-arreglaya/tree/main/src/hooks): `src/hooks`
- [Shared UI components](https://github.com/juc-windell/frontend-arreglaya/tree/main/src/components): `src/components`

### Other components

- **Campus user**
- **Django REST API**

## Connections

- Campus user → SPA routes: uses (evidence: `README.md`)
- SPA routes → Protected routes: routes through (evidence: `src/App.jsx`)
- SPA routes → Dashboard: routes to (evidence: `src/App.jsx`)
- SPA routes → Building pages: routes to (evidence: `src/App.jsx`)
- SPA routes → Building detail and edit: routes to (evidence: `src/App.jsx`)
- SPA routes → Space pages: routes to (evidence: `src/App.jsx`)
- SPA routes → Space detail and edit: routes to (evidence: `src/App.jsx`)
- SPA routes → Technician management: routes to (evidence: `src/App.jsx`)
- SPA routes → Material management: routes to (evidence: `src/App.jsx`)
- SPA routes → Request workflow: routes to (evidence: `src/App.jsx`)
- SPA routes → Work orders: routes to (evidence: `src/App.jsx`)
- SPA routes → Session hook: reads session (evidence: `src/App.jsx`)
- Session provider → Authentication service: authenticates and revokes (evidence: `src/context/AuthContext.jsx`)
- Session provider → Axios client: registers 401 handler (evidence: `src/context/AuthContext.jsx`)
- Session provider → Role permissions: derives role access (evidence: `src/context/AuthContext.jsx`)
- Protected routes → Session hook: checks session (evidence: `src/components/ProtectedRoute.jsx`)
- Session provider → Django REST API: validates profile and revokes token (evidence: `README.md`)
- Axios client → Django REST API: sends API requests (evidence: `README.md`)
- Building pages → Building service: requests building data (evidence: `src/pages/Edificios.jsx`)
- Building detail and edit → Building service: requests building data (evidence: `src/pages/EdificioDetalle.jsx`)
- Space pages → Space service: requests space data (evidence: `src/pages/Espacios.jsx`)
- Space detail and edit → Space service: requests space data (evidence: `src/pages/EspacioDetalle.jsx`)
- Space detail and edit → Building service: loads building data
- Building service → Axios client: calls (evidence: `src/services/edificioService.js`)
- Space service → Axios client: calls (evidence: `src/services/espacioService.js`)
- Space service → Django REST API: queries related requests (evidence: `src/services/espacioService.js`)
- Request workflow → Request form: renders
- Work orders → Order form: renders (evidence: `src/pages/Ordenes.jsx`)
- Work orders → Register materials: renders (evidence: `src/pages/Ordenes.jsx`)
- Work orders → Order service: calls (evidence: `src/pages/Ordenes.jsx`)
- Work orders → Request service: loads request data (evidence: `src/pages/Ordenes.jsx`)
- Work orders → Technician service: loads technician data (evidence: `src/pages/Ordenes.jsx`)
- Work orders → Material service: loads material data (evidence: `src/pages/Ordenes.jsx`)
- Request workflow → Request service: uses
- Order service → Axios client: calls (evidence: `src/services/ordenService.js`)
- Request service → Axios client: calls (evidence: `README.md`)
- Technician management → Technician service: calls (evidence: `src/pages/Tecnicos.jsx`)
- Material management → Material service: calls (evidence: `src/pages/Materiales.jsx`)
- Technician service → Axios client: calls (evidence: `src/services/tecnicoService.js`)
- Material service → Axios client: calls (evidence: `src/services/materialService.js`)
- Dashboard → Dashboard service: loads indicators (evidence: `src/pages/Dashboard.jsx`)
- Dashboard service → Axios client: calls (evidence: `src/services/dashboardService.js`)
- Query and route hooks → API error handling: interprets query errors (evidence: `src/hooks/useConsulta.js`)
- Shared UI components → API error handling: displays API errors (evidence: `src/components/dashboard/TarjetaIndicador.jsx`)
- Axios client → Session provider: notifies on 401 (evidence: `src/api/axios.js`)
