# diegoparradoc96/api-nico architecture

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

- Interactive diagram: https://gitdiagram.com/diegoparradoc96/api-nico
- Repository: https://github.com/diegoparradoc96/api-nico

## Overview

This is a small Express orders API. A client reaches the server, which mounts the orders router; the router dispatches GET and POST requests to the controller. The controller lists orders or validates and timestamps a new order, then calls the orders service, which uses Prisma to read or create records in PostgreSQL. The excerpts show this request path and database configuration; the schema and migration contents were not inspected.

Main entry points: [`src/server.ts`](https://github.com/diegoparradoc96/api-nico/blob/main/src/server.ts) (Express server), [`src/app.ts`](https://github.com/diegoparradoc96/api-nico/blob/main/src/app.ts) (App setup), [`src/routes/orders.route.ts`](https://github.com/diegoparradoc96/api-nico/blob/main/src/routes/orders.route.ts) (Orders routes), [`src/controllers/orders.controller.ts`](https://github.com/diegoparradoc96/api-nico/blob/main/src/controllers/orders.controller.ts) (Orders controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP API"]
  node_server["Express server<br/>[server.ts]"]
  node_app["App setup<br/>[app.ts]"]
  node_router["Orders routes<br/>[orders.route.ts]"]
end

subgraph group_orders["Order handling"]
  node_controller["Orders controller"]
  node_service["Orders service<br/>[orders.service.ts]"]
end

subgraph group_persistence["Persistence"]
  node_prisma["Prisma client<br/>[prisma.ts]"]
  node_postgres[("PostgreSQL")]
end

node_client(("API client"))

node_client -.->|"sends HTTP"| node_server
node_server -->|"serves"| node_app
node_app -->|"mounts at /api/orders"| node_router
node_router -->|"dispatches"| node_controller
node_controller -->|"calls"| node_service
node_service -->|"queries"| node_prisma
node_prisma -->|"connects to"| node_postgres

click node_server "https://github.com/diegoparradoc96/api-nico/blob/main/src/server.ts"
click node_app "https://github.com/diegoparradoc96/api-nico/blob/main/src/app.ts"
click node_router "https://github.com/diegoparradoc96/api-nico/blob/main/src/routes/orders.route.ts"
click node_controller "https://github.com/diegoparradoc96/api-nico/blob/main/src/controllers/orders.controller.ts"
click node_service "https://github.com/diegoparradoc96/api-nico/blob/main/src/services/orders.service.ts"
click node_prisma "https://github.com/diegoparradoc96/api-nico/blob/main/src/db/prisma.ts"

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_router,node_client toneBlue
class node_controller,node_service toneAmber
class node_prisma,node_postgres toneMint
```

## Components

### HTTP API

- [Express server](https://github.com/diegoparradoc96/api-nico/blob/main/src/server.ts): `src/server.ts`
- [App setup](https://github.com/diegoparradoc96/api-nico/blob/main/src/app.ts): `src/app.ts`
- [Orders routes](https://github.com/diegoparradoc96/api-nico/blob/main/src/routes/orders.route.ts): `src/routes/orders.route.ts`

### Order handling

- [Orders controller](https://github.com/diegoparradoc96/api-nico/blob/main/src/controllers/orders.controller.ts): `src/controllers/orders.controller.ts`
- [Orders service](https://github.com/diegoparradoc96/api-nico/blob/main/src/services/orders.service.ts): `src/services/orders.service.ts`

### Persistence

- [Prisma client](https://github.com/diegoparradoc96/api-nico/blob/main/src/db/prisma.ts): `src/db/prisma.ts`
- **PostgreSQL**

### Other components

- **API client**

## Connections

- API client → Express server: sends HTTP
- Express server → App setup: serves (evidence: `src/server.ts`)
- App setup → Orders routes: mounts at /api/orders (evidence: `src/app.ts`)
- Orders routes → Orders controller: dispatches (evidence: `src/routes/orders.route.ts`)
- Orders controller → Orders service: calls (evidence: `src/controllers/orders.controller.ts`)
- Orders service → Prisma client: queries (evidence: `src/services/orders.service.ts`)
- Prisma client → PostgreSQL: connects to (evidence: `src/db/prisma.ts`)
