# stevencardenas-dev/sincoco architecture

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

- Interactive diagram: https://gitdiagram.com/stevencardenas-dev/sincoco
- Repository: https://github.com/stevencardenas-dev/sincoco

## Overview

SINCOCO is a construction-project, inventory, and workforce management web application. Its user workflow begins with role-based sign-in, then uses the web interface to access project planning and operational modules backed by an Express API and MySQL. The README describes authentication and user management as complete, project registration as partially integrated, and many other screens as placeholders despite the broader module tree. The graph preserves those documented capabilities; edges are limited to relationships shown in excerpts, the source index, or README.

Main entry points: [`backend/src/repositories`](https://github.com/stevencardenas-dev/sincoco/tree/main/backend/src/repositories) (Data repositories), [`frontend/src/App.jsx`](https://github.com/stevencardenas-dev/sincoco/blob/main/frontend/src/App.jsx) (Web app routes), [`backend/src/services/authService.js`](https://github.com/stevencardenas-dev/sincoco/blob/main/backend/src/services/authService.js) (Authentication logic), [`frontend/src/context/AuthContext.jsx`](https://github.com/stevencardenas-dev/sincoco/blob/main/frontend/src/context/AuthContext.jsx) (Session context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_webapp["Web app routes<br/>[App.jsx]"]
  node_authui["Session context<br/>[AuthContext.jsx]"]
  node_authclient["Auth API client<br/>[auth.js]"]
  node_projectspage["Project screens<br/>[Proyectos.jsx]"]
  node_planpage["Project plan<br/>[PlanProyecto.jsx]"]
  node_personalpage["Workforce screens<br/>[Personal.jsx]"]
  node_uihelpers["Shared UI"]
  node_hooks["Page state hooks"]
  node_frontendapi["API services"]
  node_formhook["Form state<br/>[useFormulario.js]"]
  node_resourcehook["Resource state<br/>[useRecurso.js]"]
  node_webshared["Formatting and errors<br/>[errores.js]"]
end

subgraph group_api["API and access"]
  node_backend["Express API<br/>[server.js]"]
  node_routes["API routes"]
  node_authservice["Authentication logic<br/>[authService.js]"]
end

subgraph group_projects["Project operations"]
  node_projectservice["Project management<br/>[proyectoService.js]"]
  node_planning["Project planning"]
end

subgraph group_operations["Inventory and workforce"]
  node_workforce["Workforce management"]
  node_inventory["Inventory operations"]
  node_opsmodules["Operational modules"]
end

subgraph group_data["Persistence and shared layers"]
  node_repositories["Data repositories"]
  node_mysql[("MySQL database<br/>[pool.js]")]
  node_audit["Audit log<br/>[bitacora.js]"]
  node_shared["Shared validation and errors<br/>[campos.js]"]
end

node_user(("System user"))

node_user -->|"opens"| node_webapp
node_webapp -->|"checks session"| node_authui
node_authui -->|"calls"| node_authclient
node_webapp -->|"routes to"| node_projectspage
node_webapp -->|"routes to"| node_planpage
node_webapp -->|"routes to"| node_personalpage
node_authui -->|"authenticates via API"| node_backend
node_projectspage -.->|"uses API services"| node_frontendapi
node_planpage -.->|"uses API services"| node_frontendapi
node_personalpage -.->|"uses API services"| node_frontendapi
node_hooks -->|"uses error helpers"| node_webshared
node_backend -->|"mounts routes"| node_routes
node_routes -.->|"routes auth requests"| node_authservice
node_authservice -->|"uses user and role stores"| node_repositories
node_authservice -->|"records events"| node_audit
node_authservice -->|"uses session settings"| node_mysql
node_projectservice -.->|"uses repositories"| node_repositories
node_workforce -->|"uses workforce store"| node_repositories
node_inventory -->|"uses tool store"| node_repositories
node_opsmodules -.->|"persists operational data"| node_repositories
node_repositories -.->|"queries database"| node_mysql
node_shared -.->|"validates schema-sized fields"| node_mysql
node_formhook -->|"formats errors"| node_webshared
node_uihelpers -.->|"supports screens"| node_projectspage

click node_webapp "https://github.com/stevencardenas-dev/sincoco/blob/main/frontend/src/App.jsx"
click node_authui "https://github.com/stevencardenas-dev/sincoco/blob/main/frontend/src/context/AuthContext.jsx"
click node_authclient "https://github.com/stevencardenas-dev/sincoco/blob/main/frontend/src/services/auth.js"
click node_projectspage "https://github.com/stevencardenas-dev/sincoco/blob/main/frontend/src/pages/Proyectos.jsx"
click node_planpage "https://github.com/stevencardenas-dev/sincoco/blob/main/frontend/src/pages/PlanProyecto.jsx"
click node_personalpage "https://github.com/stevencardenas-dev/sincoco/blob/main/frontend/src/pages/Personal.jsx"
click node_uihelpers "https://github.com/stevencardenas-dev/sincoco/tree/main/frontend/src/components"
click node_hooks "https://github.com/stevencardenas-dev/sincoco/tree/main/frontend/src/hooks"
click node_frontendapi "https://github.com/stevencardenas-dev/sincoco/tree/main/frontend/src/services"
click node_backend "https://github.com/stevencardenas-dev/sincoco/blob/main/backend/src/server.js"
click node_routes "https://github.com/stevencardenas-dev/sincoco/tree/main/backend/src/routes"
click node_authservice "https://github.com/stevencardenas-dev/sincoco/blob/main/backend/src/services/authService.js"
click node_projectservice "https://github.com/stevencardenas-dev/sincoco/blob/main/backend/src/services/proyectoService.js"
click node_planning "https://github.com/stevencardenas-dev/sincoco/tree/main/backend/src/services"
click node_workforce "https://github.com/stevencardenas-dev/sincoco/blob/main/backend/src/services/trabajadorService.js"
click node_inventory "https://github.com/stevencardenas-dev/sincoco/blob/main/backend/src/services/herramientaService.js"
click node_opsmodules "https://github.com/stevencardenas-dev/sincoco/tree/main/backend/src/services"
click node_repositories "https://github.com/stevencardenas-dev/sincoco/tree/main/backend/src/repositories"
click node_mysql "https://github.com/stevencardenas-dev/sincoco/blob/main/backend/src/db/pool.js"
click node_audit "https://github.com/stevencardenas-dev/sincoco/blob/main/backend/src/db/bitacora.js"
click node_shared "https://github.com/stevencardenas-dev/sincoco/blob/main/backend/src/utils/campos.js"
click node_formhook "https://github.com/stevencardenas-dev/sincoco/blob/main/frontend/src/hooks/useFormulario.js"
click node_resourcehook "https://github.com/stevencardenas-dev/sincoco/blob/main/frontend/src/hooks/useRecurso.js"
click node_webshared "https://github.com/stevencardenas-dev/sincoco/blob/main/frontend/src/lib/errores.js"

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_webapp,node_authui,node_authclient,node_projectspage,node_planpage,node_personalpage,node_uihelpers,node_hooks,node_frontendapi,node_formhook,node_resourcehook,node_webshared,node_user toneBlue
class node_backend,node_routes,node_authservice toneAmber
class node_projectservice,node_planning toneMint
class node_workforce,node_inventory,node_opsmodules toneRose
class node_repositories,node_mysql,node_audit,node_shared toneIndigo
```

## Components

### Web application

- [Web app routes](https://github.com/stevencardenas-dev/sincoco/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Session context](https://github.com/stevencardenas-dev/sincoco/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Auth API client](https://github.com/stevencardenas-dev/sincoco/blob/main/frontend/src/services/auth.js): `frontend/src/services/auth.js`
- [Project screens](https://github.com/stevencardenas-dev/sincoco/blob/main/frontend/src/pages/Proyectos.jsx): `frontend/src/pages/Proyectos.jsx`
- [Project plan](https://github.com/stevencardenas-dev/sincoco/blob/main/frontend/src/pages/PlanProyecto.jsx): `frontend/src/pages/PlanProyecto.jsx`
- [Workforce screens](https://github.com/stevencardenas-dev/sincoco/blob/main/frontend/src/pages/Personal.jsx): `frontend/src/pages/Personal.jsx`
- [Shared UI](https://github.com/stevencardenas-dev/sincoco/tree/main/frontend/src/components): `frontend/src/components`
- [Page state hooks](https://github.com/stevencardenas-dev/sincoco/tree/main/frontend/src/hooks): `frontend/src/hooks`
- [API services](https://github.com/stevencardenas-dev/sincoco/tree/main/frontend/src/services): `frontend/src/services`
- [Form state](https://github.com/stevencardenas-dev/sincoco/blob/main/frontend/src/hooks/useFormulario.js): `frontend/src/hooks/useFormulario.js`
- [Resource state](https://github.com/stevencardenas-dev/sincoco/blob/main/frontend/src/hooks/useRecurso.js): `frontend/src/hooks/useRecurso.js`
- [Formatting and errors](https://github.com/stevencardenas-dev/sincoco/blob/main/frontend/src/lib/errores.js): `frontend/src/lib/errores.js`

### API and access

- [Express API](https://github.com/stevencardenas-dev/sincoco/blob/main/backend/src/server.js): `backend/src/server.js`
- [API routes](https://github.com/stevencardenas-dev/sincoco/tree/main/backend/src/routes): `backend/src/routes`
- [Authentication logic](https://github.com/stevencardenas-dev/sincoco/blob/main/backend/src/services/authService.js): `backend/src/services/authService.js`

### Project operations

- [Project management](https://github.com/stevencardenas-dev/sincoco/blob/main/backend/src/services/proyectoService.js): `backend/src/services/proyectoService.js`
- [Project planning](https://github.com/stevencardenas-dev/sincoco/tree/main/backend/src/services): `backend/src/services`

### Inventory and workforce

- [Workforce management](https://github.com/stevencardenas-dev/sincoco/blob/main/backend/src/services/trabajadorService.js): `backend/src/services/trabajadorService.js`
- [Inventory operations](https://github.com/stevencardenas-dev/sincoco/blob/main/backend/src/services/herramientaService.js): `backend/src/services/herramientaService.js`
- [Operational modules](https://github.com/stevencardenas-dev/sincoco/tree/main/backend/src/services): `backend/src/services`

### Persistence and shared layers

- [Data repositories](https://github.com/stevencardenas-dev/sincoco/tree/main/backend/src/repositories): `backend/src/repositories`
- [MySQL database](https://github.com/stevencardenas-dev/sincoco/blob/main/backend/src/db/pool.js): `backend/src/db/pool.js`
- [Audit log](https://github.com/stevencardenas-dev/sincoco/blob/main/backend/src/db/bitacora.js): `backend/src/db/bitacora.js`
- [Shared validation and errors](https://github.com/stevencardenas-dev/sincoco/blob/main/backend/src/utils/campos.js): `backend/src/utils/campos.js`

### Other components

- **System user**

## Connections

- System user → Web app routes: opens (evidence: `README.md`)
- Web app routes → Session context: checks session (evidence: `frontend/src/App.jsx`)
- Session context → Auth API client: calls (evidence: `frontend/src/context/AuthContext.jsx`)
- Web app routes → Project screens: routes to (evidence: `frontend/src/App.jsx`)
- Web app routes → Project plan: routes to (evidence: `frontend/src/App.jsx`)
- Web app routes → Workforce screens: routes to (evidence: `frontend/src/App.jsx`)
- Session context → Express API: authenticates via API (evidence: `frontend/src/context/AuthContext.jsx`)
- Project screens → API services: uses API services
- Project plan → API services: uses API services (evidence: `frontend/src/pages/PlanProyecto.jsx`)
- Workforce screens → API services: uses API services (evidence: `frontend/src/pages/Personal.jsx`)
- Page state hooks → Formatting and errors: uses error helpers (evidence: `frontend/src/hooks/useRecurso.js`)
- Express API → API routes: mounts routes (evidence: `backend/src/server.js`)
- API routes → Authentication logic: routes auth requests
- Authentication logic → Data repositories: uses user and role stores (evidence: `backend/src/services/authService.js`)
- Authentication logic → Audit log: records events (evidence: `backend/src/services/authService.js`)
- Authentication logic → MySQL database: uses session settings (evidence: `backend/src/services/authService.js`)
- Project management → Data repositories: uses repositories
- Workforce management → Data repositories: uses workforce store (evidence: `backend/src/services/trabajadorService.js`)
- Inventory operations → Data repositories: uses tool store (evidence: `backend/src/services/herramientaService.js`)
- Operational modules → Data repositories: persists operational data (evidence: `backend/src/services/authService.js`)
- Data repositories → MySQL database: queries database (evidence: `backend/src/repositories/solicitudMaterialRepository.js`)
- Shared validation and errors → MySQL database: validates schema-sized fields
- Form state → Formatting and errors: formats errors (evidence: `frontend/src/hooks/useFormulario.js`)
- Shared UI → Project screens: supports screens
