# liavhv/demoprisma architecture

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

- Interactive diagram: https://gitdiagram.com/liavhv/demoprisma
- Repository: https://github.com/liavhv/demoprisma

## Overview

DemoPrisma is a small Express API for managing states and municipalities with Prisma and SQL Server. A client sends requests to the server, which mounts the two resource routers under `/api`; each router handles its own list, create, read, update, and delete operations and accesses Prisma directly. State creation also validates and normalizes the name. The README documents SQL Server as the database and `/api/Estados` as a sample endpoint. The schema’s details are not excerpted, so its structure is not mapped here.

Main entry points: [`index.js`](https://github.com/liavhv/demoprisma/blob/main/index.js) (Express server), [`routes/Estados/estados.route.js`](https://github.com/liavhv/demoprisma/blob/main/routes/Estados/estados.route.js) (States API), [`routes/Municipios/municipios.route.js`](https://github.com/liavhv/demoprisma/blob/main/routes/Municipios/municipios.route.js) (Municipalities API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_server["API server"]
  node_server["Express server<br/>[index.js]"]
end

subgraph group_resources["Resource routes"]
  node_states["States API<br/>[estados.route.js]"]
  node_municipalities["Municipalities API"]
end

subgraph group_data["Data access"]
  node_sqlserver[("SQL Server")]
end

node_client(("API client"))

node_client -->|"sends requests"| node_server
node_server -->|"mounts at /api"| node_states
node_server -->|"mounts at /api"| node_municipalities
node_states -->|"queries via Prisma"| node_sqlserver
node_municipalities -->|"queries via Prisma"| node_sqlserver

click node_server "https://github.com/liavhv/demoprisma/blob/main/index.js"
click node_states "https://github.com/liavhv/demoprisma/blob/main/routes/Estados/estados.route.js"
click node_municipalities "https://github.com/liavhv/demoprisma/blob/main/routes/Municipios/municipios.route.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_client toneBlue
class node_states,node_municipalities toneAmber
class node_sqlserver toneMint
```

## Components

### API server

- [Express server](https://github.com/liavhv/demoprisma/blob/main/index.js): `index.js`

### Resource routes

- [States API](https://github.com/liavhv/demoprisma/blob/main/routes/Estados/estados.route.js): `routes/Estados/estados.route.js`
- [Municipalities API](https://github.com/liavhv/demoprisma/blob/main/routes/Municipios/municipios.route.js): `routes/Municipios/municipios.route.js`

### Data access

- **SQL Server**

### Other components

- **API client**

## Connections

- API client → Express server: sends requests (evidence: `README.md`)
- Express server → States API: mounts at /api (evidence: `index.js`)
- Express server → Municipalities API: mounts at /api (evidence: `index.js`)
- States API → SQL Server: queries via Prisma (evidence: `routes/Estados/estados.route.js`)
- Municipalities API → SQL Server: queries via Prisma (evidence: `routes/Municipios/municipios.route.js`)
