# phamdanghoan/devops-nodejs architecture

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

- Interactive diagram: https://gitdiagram.com/phamdanghoan/devops-nodejs
- Repository: https://github.com/phamdanghoan/devops-nodejs

## Overview

This is a Node.js/Express product REST API backed by PostgreSQL. The main workflow is an HTTP request entering the server, being routed to product controllers, and executing CRUD queries through the model and database connection pool. The app also exposes health checks. README documents Docker Compose and a GitHub Actions-to-Docker Hub-to-Render deployment capability, but those are operational delivery concerns rather than runtime components, so they are omitted. Edges are based on sampled source and explicit README statements.

Main entry points: [`src/server.js`](https://github.com/phamdanghoan/devops-nodejs/blob/main/src/server.js) (HTTP server), [`src/app.js`](https://github.com/phamdanghoan/devops-nodejs/blob/main/src/app.js) (Express app), [`src/routes/product.routes.js`](https://github.com/phamdanghoan/devops-nodejs/blob/main/src/routes/product.routes.js) (Product routes), [`src/controllers/product.controller.js`](https://github.com/phamdanghoan/devops-nodejs/blob/main/src/controllers/product.controller.js) (Product controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["API runtime"]
  node_server["HTTP server<br/>[server.js]"]
  node_app["Express app<br/>[app.js]"]
  node_health["Health endpoint<br/>[app.js]"]
end

subgraph group_products["Product domain"]
  node_routes["Product routes<br/>[product.routes.js]"]
  node_controller["Product controller"]
  node_model["Product model<br/>[product.model.js]"]
end

subgraph group_persistence["Persistence"]
  node_pool["PostgreSQL pool<br/>[database.js]"]
  node_postgres[("PostgreSQL")]
end

node_client(("API client"))

node_client -->|"sends HTTP"| node_server
node_server -->|"listens with"| node_app
node_app -->|"mounts at prefix"| node_routes
node_client -->|"checks status"| node_health
node_routes -->|"dispatches handlers"| node_controller
node_controller -->|"calls CRUD"| node_model
node_model -->|"queries through"| node_pool
node_pool -->|"connects to"| node_postgres

click node_server "https://github.com/phamdanghoan/devops-nodejs/blob/main/src/server.js"
click node_app "https://github.com/phamdanghoan/devops-nodejs/blob/main/src/app.js"
click node_health "https://github.com/phamdanghoan/devops-nodejs/blob/main/src/app.js"
click node_routes "https://github.com/phamdanghoan/devops-nodejs/blob/main/src/routes/product.routes.js"
click node_controller "https://github.com/phamdanghoan/devops-nodejs/blob/main/src/controllers/product.controller.js"
click node_model "https://github.com/phamdanghoan/devops-nodejs/blob/main/src/models/product.model.js"
click node_pool "https://github.com/phamdanghoan/devops-nodejs/blob/main/src/config/database.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_health,node_client toneBlue
class node_routes,node_controller,node_model toneAmber
class node_pool,node_postgres toneMint
```

## Components

### API runtime

- [HTTP server](https://github.com/phamdanghoan/devops-nodejs/blob/main/src/server.js): `src/server.js`
- [Express app](https://github.com/phamdanghoan/devops-nodejs/blob/main/src/app.js): `src/app.js`
- [Health endpoint](https://github.com/phamdanghoan/devops-nodejs/blob/main/src/app.js): `src/app.js`

### Product domain

- [Product routes](https://github.com/phamdanghoan/devops-nodejs/blob/main/src/routes/product.routes.js): `src/routes/product.routes.js`
- [Product controller](https://github.com/phamdanghoan/devops-nodejs/blob/main/src/controllers/product.controller.js): `src/controllers/product.controller.js`
- [Product model](https://github.com/phamdanghoan/devops-nodejs/blob/main/src/models/product.model.js): `src/models/product.model.js`

### Persistence

- [PostgreSQL pool](https://github.com/phamdanghoan/devops-nodejs/blob/main/src/config/database.js): `src/config/database.js`
- **PostgreSQL**

### Other components

- **API client**

## Connections

- API client → HTTP server: sends HTTP (evidence: `src/server.js`)
- HTTP server → Express app: listens with (evidence: `src/server.js`)
- Express app → Product routes: mounts at prefix (evidence: `src/app.js`)
- API client → Health endpoint: checks status (evidence: `src/app.js`)
- Product routes → Product controller: dispatches handlers (evidence: `src/routes/product.routes.js`)
- Product controller → Product model: calls CRUD (evidence: `src/controllers/product.controller.js`)
- Product model → PostgreSQL pool: queries through (evidence: `src/models/product.model.js`)
- PostgreSQL pool → PostgreSQL: connects to (evidence: `src/config/database.js`)
