# paul-developer-stack/tarea-h6 architecture

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

- Interactive diagram: https://gitdiagram.com/paul-developer-stack/tarea-h6
- Repository: https://github.com/paul-developer-stack/tarea-h6

## Overview

This is a Spanish-language REST API for customer, contact, product, and contact-type management. The principal workflow is an HTTP client request entering the Express app, being dispatched to a resource route and controller, then reading or changing MySQL data and returning JSON. The sampled code shows those paths for customers, contacts, and products; the contact-type route queries the database directly. The README is empty, so capability coverage is based on the source index and sampled files; unsampled customer/product routes and product wiring are represented only where the source index confirms them.

Main entry points: [`api/src/app.js`](https://github.com/paul-developer-stack/tarea-h6/blob/main/api/src/app.js) (Express app), [`api/src/config/db.js`](https://github.com/paul-developer-stack/tarea-h6/blob/main/api/src/config/db.js) (MySQL pool), [`api/server.js`](https://github.com/paul-developer-stack/tarea-h6/blob/main/api/server.js) (HTTP server), [`api/src/routes/clientes.routes.js`](https://github.com/paul-developer-stack/tarea-h6/blob/main/api/src/routes/clientes.routes.js) (Customer routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["HTTP entry"]
  node_server["HTTP server<br/>[server.js]"]
  node_app["Express app<br/>[app.js]"]
end

subgraph group_resources["Resource APIs"]
  node_customers_route["Customer routes<br/>[clientes.routes.js]"]
  node_customers_controller["Customer operations"]
  node_contacts_route["Contact routes"]
  node_contacts_controller["Contact operations"]
  node_products_route["Product routes"]
  node_products_controller["Product operations"]
  node_contact_types["Contact types"]
end

subgraph group_persistence["Persistence"]
  node_db_pool["MySQL pool<br/>[db.js]"]
  node_mysql[("MySQL database")]
end

subgraph group_errors["Error handling"]
  node_error_middleware["HTTP errors<br/>[errorHandler.js]"]
end

node_client(("API client"))

node_client -->|"sends HTTP"| node_server
node_server -->|"starts"| node_app
node_client -.->|"requests"| node_app
node_app -->|"mounts route"| node_customers_route
node_app -->|"mounts route"| node_contacts_route
node_app -->|"mounts route"| node_products_route
node_app -->|"mounts route"| node_contact_types
node_customers_route -->|"dispatches"| node_customers_controller
node_contacts_route -->|"dispatches"| node_contacts_controller
node_products_route -->|"dispatches"| node_products_controller
node_customers_controller -->|"queries"| node_db_pool
node_contacts_controller -->|"queries"| node_db_pool
node_products_controller -->|"queries"| node_db_pool
node_contact_types -->|"queries"| node_db_pool
node_db_pool -.->|"connects"| node_mysql
node_app -->|"registers handlers"| node_error_middleware

click node_server "https://github.com/paul-developer-stack/tarea-h6/blob/main/api/server.js"
click node_app "https://github.com/paul-developer-stack/tarea-h6/blob/main/api/src/app.js"
click node_customers_route "https://github.com/paul-developer-stack/tarea-h6/blob/main/api/src/routes/clientes.routes.js"
click node_customers_controller "https://github.com/paul-developer-stack/tarea-h6/blob/main/api/src/controllers/clientes.controller.js"
click node_contacts_route "https://github.com/paul-developer-stack/tarea-h6/blob/main/api/src/routes/contactos.routes.js"
click node_contacts_controller "https://github.com/paul-developer-stack/tarea-h6/blob/main/api/src/controllers/contactos.controller.js"
click node_products_route "https://github.com/paul-developer-stack/tarea-h6/blob/main/api/src/routes/productos.routes.js"
click node_products_controller "https://github.com/paul-developer-stack/tarea-h6/blob/main/api/src/controllers/productos.controller.js"
click node_contact_types "https://github.com/paul-developer-stack/tarea-h6/blob/main/api/src/routes/tiposContacto.routes.js"
click node_db_pool "https://github.com/paul-developer-stack/tarea-h6/blob/main/api/src/config/db.js"
click node_error_middleware "https://github.com/paul-developer-stack/tarea-h6/blob/main/api/src/middlewares/errorHandler.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_server,node_app,node_client toneBlue
class node_customers_route,node_customers_controller,node_contacts_route,node_contacts_controller,node_products_route,node_products_controller,node_contact_types toneAmber
class node_db_pool,node_mysql toneMint
class node_error_middleware toneRose
```

## Components

### HTTP entry

- [HTTP server](https://github.com/paul-developer-stack/tarea-h6/blob/main/api/server.js): `api/server.js`
- [Express app](https://github.com/paul-developer-stack/tarea-h6/blob/main/api/src/app.js): `api/src/app.js`

### Resource APIs

- [Customer routes](https://github.com/paul-developer-stack/tarea-h6/blob/main/api/src/routes/clientes.routes.js): `api/src/routes/clientes.routes.js`
- [Customer operations](https://github.com/paul-developer-stack/tarea-h6/blob/main/api/src/controllers/clientes.controller.js): `api/src/controllers/clientes.controller.js`
- [Contact routes](https://github.com/paul-developer-stack/tarea-h6/blob/main/api/src/routes/contactos.routes.js): `api/src/routes/contactos.routes.js`
- [Contact operations](https://github.com/paul-developer-stack/tarea-h6/blob/main/api/src/controllers/contactos.controller.js): `api/src/controllers/contactos.controller.js`
- [Product routes](https://github.com/paul-developer-stack/tarea-h6/blob/main/api/src/routes/productos.routes.js): `api/src/routes/productos.routes.js`
- [Product operations](https://github.com/paul-developer-stack/tarea-h6/blob/main/api/src/controllers/productos.controller.js): `api/src/controllers/productos.controller.js`
- [Contact types](https://github.com/paul-developer-stack/tarea-h6/blob/main/api/src/routes/tiposContacto.routes.js): `api/src/routes/tiposContacto.routes.js`

### Persistence

- [MySQL pool](https://github.com/paul-developer-stack/tarea-h6/blob/main/api/src/config/db.js): `api/src/config/db.js`
- **MySQL database**

### Error handling

- [HTTP errors](https://github.com/paul-developer-stack/tarea-h6/blob/main/api/src/middlewares/errorHandler.js): `api/src/middlewares/errorHandler.js`

### Other components

- **API client**

## Connections

- API client → HTTP server: sends HTTP
- HTTP server → Express app: starts (evidence: `api/server.js`)
- API client → Express app: requests
- Express app → Customer routes: mounts route (evidence: `api/src/app.js`)
- Express app → Contact routes: mounts route (evidence: `api/src/app.js`)
- Express app → Product routes: mounts route (evidence: `api/src/app.js`)
- Express app → Contact types: mounts route (evidence: `api/src/app.js`)
- Customer routes → Customer operations: dispatches (evidence: `api/src/routes/clientes.routes.js`)
- Contact routes → Contact operations: dispatches (evidence: `api/src/routes/contactos.routes.js`)
- Product routes → Product operations: dispatches (evidence: `api/src/routes/productos.routes.js`)
- Customer operations → MySQL pool: queries (evidence: `api/src/controllers/clientes.controller.js`)
- Contact operations → MySQL pool: queries (evidence: `api/src/controllers/contactos.controller.js`)
- Product operations → MySQL pool: queries (evidence: `api/src/controllers/productos.controller.js`)
- Contact types → MySQL pool: queries (evidence: `api/src/routes/tiposContacto.routes.js`)
- MySQL pool → MySQL database: connects
- Express app → HTTP errors: registers handlers (evidence: `api/src/app.js`)
