# mountainv157-maker/pdvfreezer architecture

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

- Interactive diagram: https://gitdiagram.com/mountainv157-maker/pdvfreezer
- Repository: https://github.com/mountainv157-maker/pdvfreezer

## Overview

PDV Freezer is a point-of-sale application for managing products and stock, recording sales, and closing sales periods. The main user-facing workflow is represented by a single client page; the sampled product form calls the product API, while the sales and closing handlers implement the corresponding domain operations. Route handlers use a shared libSQL connector backed by Turso. The excerpts do not establish most UI-to-API links, so those relationships are omitted rather than inferred.

Main entry points: [`src/lib/db.ts`](https://github.com/mountainv157-maker/pdvfreezer/blob/main/src/lib/db.ts) (Database connector), [`src/app/page.tsx`](https://github.com/mountainv157-maker/pdvfreezer/blob/main/src/app/page.tsx) (POS interface), [`src/app/api/produtos/route.ts`](https://github.com/mountainv157-maker/pdvfreezer/blob/main/src/app/api/produtos/route.ts) (Product management), [`src/app/api/vendas/route.ts`](https://github.com/mountainv157-maker/pdvfreezer/blob/main/src/app/api/vendas/route.ts) (Sales processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Point of sale"]
  node_app["POS interface<br/>[page.tsx]"]
end

subgraph group_api["Domain APIs"]
  node_products["Product management<br/>[route.ts]"]
  node_sales["Sales processing<br/>[route.ts]"]
  node_closing["Sales closing<br/>[route.ts]"]
  node_dbinit["Database initialization<br/>[route.ts]"]
end

subgraph group_persistence["Persistence"]
  node_connector["Database connector<br/>[db.ts]"]
  node_turso[("Turso database")]
end

node_operator(("Operator"))

node_operator -->|"uses"| node_app
node_app -->|"submits product"| node_products
node_products -->|"queries via"| node_connector
node_sales -->|"queries via"| node_connector
node_closing -->|"queries via"| node_connector
node_dbinit -->|"initializes"| node_connector
node_connector -->|"connects to"| node_turso

click node_app "https://github.com/mountainv157-maker/pdvfreezer/blob/main/src/app/page.tsx"
click node_products "https://github.com/mountainv157-maker/pdvfreezer/blob/main/src/app/api/produtos/route.ts"
click node_sales "https://github.com/mountainv157-maker/pdvfreezer/blob/main/src/app/api/vendas/route.ts"
click node_closing "https://github.com/mountainv157-maker/pdvfreezer/blob/main/src/app/api/fechamentos/route.ts"
click node_dbinit "https://github.com/mountainv157-maker/pdvfreezer/blob/main/src/app/api/init/route.ts"
click node_connector "https://github.com/mountainv157-maker/pdvfreezer/blob/main/src/lib/db.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_app toneBlue
class node_products,node_sales,node_closing,node_dbinit toneAmber
class node_connector,node_turso toneMint
class node_operator toneIndigo
```

## Components

### Point of sale

- [POS interface](https://github.com/mountainv157-maker/pdvfreezer/blob/main/src/app/page.tsx): `src/app/page.tsx`

### Domain APIs

- [Product management](https://github.com/mountainv157-maker/pdvfreezer/blob/main/src/app/api/produtos/route.ts): `src/app/api/produtos/route.ts`
- [Sales processing](https://github.com/mountainv157-maker/pdvfreezer/blob/main/src/app/api/vendas/route.ts): `src/app/api/vendas/route.ts`
- [Sales closing](https://github.com/mountainv157-maker/pdvfreezer/blob/main/src/app/api/fechamentos/route.ts): `src/app/api/fechamentos/route.ts`
- [Database initialization](https://github.com/mountainv157-maker/pdvfreezer/blob/main/src/app/api/init/route.ts): `src/app/api/init/route.ts`

### Persistence

- [Database connector](https://github.com/mountainv157-maker/pdvfreezer/blob/main/src/lib/db.ts): `src/lib/db.ts`
- **Turso database**

### Other components

- **Operator**

## Connections

- Operator → POS interface: uses
- POS interface → Product management: submits product (evidence: `src/app/page.tsx`)
- Product management → Database connector: queries via (evidence: `src/app/api/produtos/route.ts`)
- Sales processing → Database connector: queries via (evidence: `src/app/api/vendas/route.ts`)
- Sales closing → Database connector: queries via (evidence: `src/app/api/fechamentos/route.ts`)
- Database initialization → Database connector: initializes (evidence: `src/app/api/init/route.ts`)
- Database connector → Turso database: connects to (evidence: `src/lib/db.ts`)
