# 534b64/shop_manager architecture

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

- Interactive diagram: https://gitdiagram.com/534b64/shop_manager
- Repository: https://github.com/534b64/shop_manager

## Overview

Shop Manager is a shop ERP/POS for customer accounts, job quoting and order tracking, inventory, payments, point-of-sale, invoices and returns, reporting, settings, and audit. The user workflow starts with sign-in, then role-gated pages call the Fastify API; domain routes perform business operations against SQLite and return data to the client. The graph includes documented major capabilities and sampled route-to-service dependencies. Unsampled subsystems are represented at their existing directories; edges are omitted where the supplied excerpts and README do not establish a relationship.

Main entry points: [`src/routes.tsx`](https://github.com/534b64/shop_manager/blob/main/src/routes.tsx) (Page routing), [`server/app.ts`](https://github.com/534b64/shop_manager/blob/main/server/app.ts) (Fastify API), [`server/modules/jobs/edit.routes.ts`](https://github.com/534b64/shop_manager/blob/main/server/modules/jobs/edit.routes.ts) (Job management), [`server/modules/auth/service.ts`](https://github.com/534b64/shop_manager/blob/main/server/modules/auth/service.ts) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_client_app["Application shell<br/>[App.tsx]"]
  node_routes["Page routing<br/>[routes.tsx]"]
  node_client_api["API and session<br/>[api.ts]"]
  node_dashboard["Dashboard"]
  node_customers_ui["Customer accounts"]
  node_jobs_ui["Jobs and quotes"]
  node_inventory_ui["Inventory workflows"]
  node_pos_ui["POS and drawer"]
  node_payments_ui["Payments"]
  node_reports_ui["Reports"]
  node_settings_ui["Settings and audit"]
end

subgraph group_operations["Shop operations"]
  node_customers_api["Customer management<br/>[routes.ts]"]
  node_jobs_api["Job management<br/>[edit.routes.ts]"]
  node_inventory_api["Inventory and counts"]
  node_materials_api["Materials<br/>[routes.ts]"]
end

subgraph group_commerce["Sales and finance"]
  node_sales_api["Sales and invoices<br/>[invoices.routes.ts]"]
  node_payments_api["Payments and credit<br/>[routes.ts]"]
end

subgraph group_platform["API and governance"]
  node_auth_api["Authentication<br/>[service.ts]"]
  node_shared_domain["Domain rules<br/>[domain.ts]"]
  node_audit_api["Audit trail<br/>[service.ts]"]
  node_settings_api["Shop settings<br/>[service.ts]"]
  node_api_server["Fastify API<br/>[app.ts]"]
end

subgraph group_data["Persistence"]
  node_sqlite[("SQLite database<br/>[index.ts]")]
  node_schema["Domain schema"]
end

node_shop_user(("Shop user"))

node_shop_user -->|"uses"| node_client_app
node_client_app -->|"renders"| node_routes
node_client_app -->|"checks session"| node_client_api
node_routes -->|"routes to"| node_dashboard
node_routes -->|"routes to"| node_customers_ui
node_routes -->|"routes to"| node_jobs_ui
node_routes -.->|"routes to"| node_inventory_ui
node_routes -->|"routes to"| node_pos_ui
node_routes -->|"routes to"| node_payments_ui
node_routes -->|"routes to"| node_reports_ui
node_routes -.->|"routes to"| node_settings_ui
node_client_app -->|"refreshes session"| node_auth_api
node_client_api -.->|"sends API requests"| node_api_server
node_api_server -->|"registers routes"| node_auth_api
node_api_server -->|"registers routes"| node_customers_api
node_api_server -->|"registers routes"| node_jobs_api
node_api_server -->|"registers routes"| node_inventory_api
node_api_server -->|"registers routes"| node_materials_api
node_api_server -->|"registers routes"| node_payments_api
node_api_server -->|"registers routes"| node_sales_api
node_customers_api -->|"reads and writes"| node_sqlite
node_jobs_api -->|"reads and writes"| node_sqlite
node_inventory_api -->|"reads and writes"| node_sqlite
node_payments_api -->|"reads and writes"| node_sqlite
node_sales_api -->|"records refunds"| node_payments_api
node_customers_api -->|"reads credit balance"| node_payments_api
node_jobs_api -->|"checks invoice"| node_sales_api
node_jobs_api -->|"checks payments"| node_payments_api
node_jobs_api -->|"requires approval"| node_auth_api
node_customers_api -->|"requires approval"| node_auth_api
node_payments_api -->|"requires approval"| node_auth_api
node_inventory_api -->|"requires approval"| node_auth_api
node_sales_api -->|"requires approval"| node_auth_api
node_customers_api -->|"records changes"| node_audit_api
node_jobs_api -->|"records changes"| node_audit_api
node_api_server -->|"runs migrations"| node_sqlite
node_sqlite -->|"uses schema"| node_schema
node_inventory_api -->|"uses domain rules"| node_shared_domain
node_sales_api -->|"uses invoice rules"| node_shared_domain

click node_client_app "https://github.com/534b64/shop_manager/blob/main/src/App.tsx"
click node_routes "https://github.com/534b64/shop_manager/blob/main/src/routes.tsx"
click node_client_api "https://github.com/534b64/shop_manager/blob/main/src/lib/api.ts"
click node_dashboard "https://github.com/534b64/shop_manager/tree/main/src/pages/dashboard"
click node_customers_ui "https://github.com/534b64/shop_manager/tree/main/src/modules/customers"
click node_jobs_ui "https://github.com/534b64/shop_manager/tree/main/src/modules/jobs"
click node_inventory_ui "https://github.com/534b64/shop_manager/tree/main/src/modules/inventory"
click node_pos_ui "https://github.com/534b64/shop_manager/tree/main/src/modules/pos"
click node_payments_ui "https://github.com/534b64/shop_manager/tree/main/src/modules/payments"
click node_reports_ui "https://github.com/534b64/shop_manager/tree/main/src/pages/reports"
click node_settings_ui "https://github.com/534b64/shop_manager/tree/main/src/pages/settings"
click node_auth_api "https://github.com/534b64/shop_manager/blob/main/server/modules/auth/service.ts"
click node_customers_api "https://github.com/534b64/shop_manager/blob/main/server/modules/customers/routes.ts"
click node_jobs_api "https://github.com/534b64/shop_manager/blob/main/server/modules/jobs/edit.routes.ts"
click node_inventory_api "https://github.com/534b64/shop_manager/blob/main/server/modules/inventory/cycle-counts.routes.ts"
click node_materials_api "https://github.com/534b64/shop_manager/blob/main/server/modules/materials/routes.ts"
click node_sales_api "https://github.com/534b64/shop_manager/blob/main/server/modules/sales/invoices.routes.ts"
click node_payments_api "https://github.com/534b64/shop_manager/blob/main/server/modules/payments/routes.ts"
click node_shared_domain "https://github.com/534b64/shop_manager/blob/main/shared/domain.ts"
click node_audit_api "https://github.com/534b64/shop_manager/blob/main/server/modules/audit/service.ts"
click node_settings_api "https://github.com/534b64/shop_manager/blob/main/server/modules/settings/service.ts"
click node_sqlite "https://github.com/534b64/shop_manager/blob/main/server/db/index.ts"
click node_schema "https://github.com/534b64/shop_manager/tree/main/server/db/schema"
click node_api_server "https://github.com/534b64/shop_manager/blob/main/server/app.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_client_app,node_routes,node_client_api,node_dashboard,node_customers_ui,node_jobs_ui,node_inventory_ui,node_pos_ui,node_payments_ui,node_reports_ui,node_settings_ui,node_shop_user toneBlue
class node_customers_api,node_jobs_api,node_inventory_api,node_materials_api toneAmber
class node_sales_api,node_payments_api toneMint
class node_auth_api,node_shared_domain,node_audit_api,node_settings_api,node_api_server toneRose
class node_sqlite,node_schema toneIndigo
```

## Components

### Client experience

- [Application shell](https://github.com/534b64/shop_manager/blob/main/src/App.tsx): `src/App.tsx`
- [Page routing](https://github.com/534b64/shop_manager/blob/main/src/routes.tsx): `src/routes.tsx`
- [API and session](https://github.com/534b64/shop_manager/blob/main/src/lib/api.ts): `src/lib/api.ts`
- [Dashboard](https://github.com/534b64/shop_manager/tree/main/src/pages/dashboard): `src/pages/dashboard`
- [Customer accounts](https://github.com/534b64/shop_manager/tree/main/src/modules/customers): `src/modules/customers`
- [Jobs and quotes](https://github.com/534b64/shop_manager/tree/main/src/modules/jobs): `src/modules/jobs`
- [Inventory workflows](https://github.com/534b64/shop_manager/tree/main/src/modules/inventory): `src/modules/inventory`
- [POS and drawer](https://github.com/534b64/shop_manager/tree/main/src/modules/pos): `src/modules/pos`
- [Payments](https://github.com/534b64/shop_manager/tree/main/src/modules/payments): `src/modules/payments`
- [Reports](https://github.com/534b64/shop_manager/tree/main/src/pages/reports): `src/pages/reports`
- [Settings and audit](https://github.com/534b64/shop_manager/tree/main/src/pages/settings): `src/pages/settings`

### Shop operations

- [Customer management](https://github.com/534b64/shop_manager/blob/main/server/modules/customers/routes.ts): `server/modules/customers/routes.ts`
- [Job management](https://github.com/534b64/shop_manager/blob/main/server/modules/jobs/edit.routes.ts): `server/modules/jobs/edit.routes.ts`
- [Inventory and counts](https://github.com/534b64/shop_manager/blob/main/server/modules/inventory/cycle-counts.routes.ts): `server/modules/inventory/cycle-counts.routes.ts`
- [Materials](https://github.com/534b64/shop_manager/blob/main/server/modules/materials/routes.ts): `server/modules/materials/routes.ts`

### Sales and finance

- [Sales and invoices](https://github.com/534b64/shop_manager/blob/main/server/modules/sales/invoices.routes.ts): `server/modules/sales/invoices.routes.ts`
- [Payments and credit](https://github.com/534b64/shop_manager/blob/main/server/modules/payments/routes.ts): `server/modules/payments/routes.ts`

### API and governance

- [Authentication](https://github.com/534b64/shop_manager/blob/main/server/modules/auth/service.ts): `server/modules/auth/service.ts`
- [Domain rules](https://github.com/534b64/shop_manager/blob/main/shared/domain.ts): `shared/domain.ts`
- [Audit trail](https://github.com/534b64/shop_manager/blob/main/server/modules/audit/service.ts): `server/modules/audit/service.ts`
- [Shop settings](https://github.com/534b64/shop_manager/blob/main/server/modules/settings/service.ts): `server/modules/settings/service.ts`
- [Fastify API](https://github.com/534b64/shop_manager/blob/main/server/app.ts): `server/app.ts`

### Persistence

- [SQLite database](https://github.com/534b64/shop_manager/blob/main/server/db/index.ts): `server/db/index.ts`
- [Domain schema](https://github.com/534b64/shop_manager/tree/main/server/db/schema): `server/db/schema`

### Other components

- **Shop user**

## Connections

- Shop user → Application shell: uses (evidence: `src/App.tsx`)
- Application shell → Page routing: renders (evidence: `src/App.tsx`)
- Application shell → API and session: checks session (evidence: `src/App.tsx`)
- Page routing → Dashboard: routes to (evidence: `src/routes.tsx`)
- Page routing → Customer accounts: routes to (evidence: `src/routes.tsx`)
- Page routing → Jobs and quotes: routes to (evidence: `src/routes.tsx`)
- Page routing → Inventory workflows: routes to (evidence: `src/routes.tsx`)
- Page routing → POS and drawer: routes to (evidence: `src/routes.tsx`)
- Page routing → Payments: routes to (evidence: `src/routes.tsx`)
- Page routing → Reports: routes to (evidence: `src/routes.tsx`)
- Page routing → Settings and audit: routes to (evidence: `src/routes.tsx`)
- Application shell → Authentication: refreshes session (evidence: `src/App.tsx`)
- API and session → Fastify API: sends API requests
- Fastify API → Authentication: registers routes (evidence: `server/app.ts`)
- Fastify API → Customer management: registers routes (evidence: `server/app.ts`)
- Fastify API → Job management: registers routes (evidence: `server/app.ts`)
- Fastify API → Inventory and counts: registers routes (evidence: `server/app.ts`)
- Fastify API → Materials: registers routes (evidence: `server/app.ts`)
- Fastify API → Payments and credit: registers routes (evidence: `server/app.ts`)
- Fastify API → Sales and invoices: registers routes (evidence: `server/app.ts`)
- Customer management → SQLite database: reads and writes (evidence: `server/modules/customers/routes.ts`)
- Job management → SQLite database: reads and writes (evidence: `server/modules/jobs/edit.routes.ts`)
- Inventory and counts → SQLite database: reads and writes (evidence: `server/modules/inventory/cycle-counts.routes.ts`)
- Payments and credit → SQLite database: reads and writes (evidence: `server/modules/payments/routes.ts`)
- Sales and invoices → Payments and credit: records refunds (evidence: `server/modules/sales/invoices.routes.ts`)
- Customer management → Payments and credit: reads credit balance (evidence: `server/modules/customers/routes.ts`)
- Job management → Sales and invoices: checks invoice (evidence: `server/modules/jobs/edit.routes.ts`)
- Job management → Payments and credit: checks payments (evidence: `server/modules/jobs/edit.routes.ts`)
- Job management → Authentication: requires approval (evidence: `server/modules/jobs/edit.routes.ts`)
- Customer management → Authentication: requires approval (evidence: `server/modules/customers/routes.ts`)
- Payments and credit → Authentication: requires approval (evidence: `server/modules/payments/routes.ts`)
- Inventory and counts → Authentication: requires approval (evidence: `server/modules/inventory/cycle-counts.routes.ts`)
- Sales and invoices → Authentication: requires approval (evidence: `server/modules/sales/invoices.routes.ts`)
- Customer management → Audit trail: records changes (evidence: `server/modules/customers/routes.ts`)
- Job management → Audit trail: records changes (evidence: `server/modules/jobs/edit.routes.ts`)
- Fastify API → SQLite database: runs migrations (evidence: `server/app.ts`)
- SQLite database → Domain schema: uses schema (evidence: `server/db/index.ts`)
- Inventory and counts → Domain rules: uses domain rules (evidence: `server/modules/inventory/cycle-counts.routes.ts`)
- Sales and invoices → Domain rules: uses invoice rules (evidence: `server/modules/sales/invoices.routes.ts`)
