# pavloshaparenko/pumba_services architecture

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

- Interactive diagram: https://gitdiagram.com/pavloshaparenko/pumba_services
- Repository: https://github.com/pavloshaparenko/pumba_services

## Overview

Pumba_services is a small commerce-oriented API repository. Its demonstrated request path is an HTTP client reaching the Node server, through request handling and route dispatch, to health or category handlers; category requests read active rows from PostgreSQL. The tree also indicates commerce schema areas for products, orders, addresses, wishlists, brands, attributes, and categories, but the README is uninformative and those migrations were not sampled. Edges reflect only shown code or source-index references; the broader schema is included without speculative runtime links.

Main entry points: [`apps/api/src/http/pipeline.ts`](https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/http/pipeline.ts) (Request pipeline), [`apps/api/src/services/pool.ts`](https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/services/pool.ts) (PostgreSQL pool), [`apps/api/src/server.ts`](https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/server.ts) (Startup and shutdown), [`apps/api/src/http/router.ts`](https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/http/router.ts) (Route dispatch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["API runtime"]
  node_server_entry["Startup and shutdown<br/>[server.ts]"]
  node_env["Environment config<br/>[env.ts]"]
end

subgraph group_http["HTTP handling"]
  node_http_server["HTTP server<br/>[server.ts]"]
  node_pipeline["Request pipeline<br/>[pipeline.ts]"]
  node_cors["CORS handling<br/>[cors.ts]"]
  node_router["Route dispatch<br/>[router.ts]"]
  node_health["Health handler<br/>[health.ts]"]
  node_not_found["Not-found handler<br/>[notFound.ts]"]
  node_error_handler["HTTP error handler<br/>[errorHandler.ts]"]
  node_app_error["Application error<br/>[AppError.ts]"]
end

subgraph group_commerce["Commerce data"]
  node_categories_handler["Categories handler<br/>[categories.ts]"]
  node_category_queries["Category queries<br/>[categories.ts]"]
  node_pool["PostgreSQL pool<br/>[pool.ts]"]
  node_commerce_schema[("Commerce schema")]
end

node_client(("HTTP client"))
node_postgres[("PostgreSQL")]

node_client -->|"sends requests"| node_http_server
node_server_entry -->|"reads config"| node_env
node_server_entry -->|"checks and closes"| node_pool
node_server_entry -->|"creates server"| node_http_server
node_http_server -->|"passes requests"| node_pipeline
node_pipeline -->|"applies CORS"| node_cors
node_pipeline -->|"dispatches route"| node_router
node_pipeline -->|"handles errors"| node_error_handler
node_router -->|"routes health"| node_health
node_router -->|"routes categories"| node_categories_handler
node_categories_handler -->|"loads categories"| node_category_queries
node_category_queries -->|"queries"| node_pool
node_pool -->|"uses settings"| node_env
node_pool -.->|"queries database"| node_postgres
node_cors -->|"reads origin"| node_env
node_error_handler -->|"checks type"| node_app_error
node_not_found -.->|"uses error type"| node_app_error

click node_server_entry "https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/server.ts"
click node_env "https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/config/env.ts"
click node_http_server "https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/http/server.ts"
click node_pipeline "https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/http/pipeline.ts"
click node_cors "https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/http/cors.ts"
click node_router "https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/http/router.ts"
click node_health "https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/http/handlers/health.ts"
click node_categories_handler "https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/http/handlers/categories.ts"
click node_not_found "https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/http/handlers/notFound.ts"
click node_error_handler "https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/http/errorHandler.ts"
click node_app_error "https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/errors/AppError.ts"
click node_category_queries "https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/db/categories.ts"
click node_pool "https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/services/pool.ts"
click node_commerce_schema "https://github.com/pavloshaparenko/pumba_services/tree/main/apps/api/migrations"

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_entry,node_env,node_client toneBlue
class node_http_server,node_pipeline,node_cors,node_router,node_health,node_not_found,node_error_handler,node_app_error,node_postgres toneAmber
class node_categories_handler,node_category_queries,node_pool,node_commerce_schema toneMint
```

## Components

### API runtime

- [Startup and shutdown](https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/server.ts): `apps/api/src/server.ts`
- [Environment config](https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/config/env.ts): `apps/api/src/config/env.ts`

### HTTP handling

- [HTTP server](https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/http/server.ts): `apps/api/src/http/server.ts`
- [Request pipeline](https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/http/pipeline.ts): `apps/api/src/http/pipeline.ts`
- [CORS handling](https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/http/cors.ts): `apps/api/src/http/cors.ts`
- [Route dispatch](https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/http/router.ts): `apps/api/src/http/router.ts`
- [Health handler](https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/http/handlers/health.ts): `apps/api/src/http/handlers/health.ts`
- [Not-found handler](https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/http/handlers/notFound.ts): `apps/api/src/http/handlers/notFound.ts`
- [HTTP error handler](https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/http/errorHandler.ts): `apps/api/src/http/errorHandler.ts`
- [Application error](https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/errors/AppError.ts): `apps/api/src/errors/AppError.ts`

### Commerce data

- [Categories handler](https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/http/handlers/categories.ts): `apps/api/src/http/handlers/categories.ts`
- [Category queries](https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/db/categories.ts): `apps/api/src/db/categories.ts`
- [PostgreSQL pool](https://github.com/pavloshaparenko/pumba_services/blob/main/apps/api/src/services/pool.ts): `apps/api/src/services/pool.ts`
- [Commerce schema](https://github.com/pavloshaparenko/pumba_services/tree/main/apps/api/migrations): `apps/api/migrations`

### Other components

- **HTTP client**
- **PostgreSQL**

## Connections

- HTTP client → HTTP server: sends requests
- Startup and shutdown → Environment config: reads config (evidence: `apps/api/src/server.ts`)
- Startup and shutdown → PostgreSQL pool: checks and closes (evidence: `apps/api/src/server.ts`)
- Startup and shutdown → HTTP server: creates server (evidence: `apps/api/src/server.ts`)
- HTTP server → Request pipeline: passes requests (evidence: `apps/api/src/http/server.ts`)
- Request pipeline → CORS handling: applies CORS (evidence: `apps/api/src/http/pipeline.ts`)
- Request pipeline → Route dispatch: dispatches route (evidence: `apps/api/src/http/pipeline.ts`)
- Request pipeline → HTTP error handler: handles errors (evidence: `apps/api/src/http/pipeline.ts`)
- Route dispatch → Health handler: routes health (evidence: `apps/api/src/http/router.ts`)
- Route dispatch → Categories handler: routes categories (evidence: `apps/api/src/http/router.ts`)
- Categories handler → Category queries: loads categories (evidence: `apps/api/src/http/handlers/categories.ts`)
- Category queries → PostgreSQL pool: queries (evidence: `apps/api/src/db/categories.ts`)
- PostgreSQL pool → Environment config: uses settings (evidence: `apps/api/src/services/pool.ts`)
- PostgreSQL pool → PostgreSQL: queries database
- CORS handling → Environment config: reads origin (evidence: `apps/api/src/http/cors.ts`)
- HTTP error handler → Application error: checks type (evidence: `apps/api/src/http/errorHandler.ts`)
- Not-found handler → Application error: uses error type (evidence: `apps/api/src/http/handlers/notFound.ts`)
