# innosynth/print-workshop architecture

> Architecture diagram of the GitHub repository innosynth/print-workshop, 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/innosynth/print-workshop
- Repository: https://github.com/innosynth/print-workshop

## Overview

This is a browser-based business management application with sales, purchasing, inventory, accounting, contacts, reporting, settings, and machine meter readings. The principal workflow is user sign-in, permission-checked navigation, and use of a business module; the frontend is organized into page-level modules backed by API and database layers. The source index confirms database dependencies for the sampled API modules, but most page and API internals were not excerpted, so their detailed data flows are not asserted.

Main entry points: [`src/App.tsx`](https://github.com/innosynth/print-workshop/blob/main/src/App.tsx) (Router and access), [`db/index.ts`](https://github.com/innosynth/print-workshop/blob/main/db/index.ts) (Database client), [`src/components/Layout.tsx`](https://github.com/innosynth/print-workshop/blob/main/src/components/Layout.tsx) (Navigation layout), [`api/system.ts`](https://github.com/innosynth/print-workshop/blob/main/api/system.ts) (System API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application shell"]
  node_app["Router and access<br/>[App.tsx]"]
  node_auth["Authentication<br/>[auth-context.tsx]"]
  node_layout["Navigation layout<br/>[Layout.tsx]"]
  node_sidebar["Application sidebar<br/>[AppSidebar.tsx]"]
end

subgraph group_business["Business modules"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_contacts["Contacts<br/>[Contacts.tsx]"]
  node_sales["Sales<br/>[Sales.tsx]"]
  node_purchase["Purchasing<br/>[Purchase.tsx]"]
  node_accounting["Accounting<br/>[Accounting.tsx]"]
  node_inventory["Inventory<br/>[Inventory.tsx]"]
  node_products["Products<br/>[Products.tsx]"]
  node_meters["Meter readings<br/>[MeterReadings.tsx]"]
  node_reports["Reports<br/>[Reports.tsx]"]
  node_settings["Settings<br/>[Settings.tsx]"]
end

subgraph group_services["API services"]
  node_api_core["Core API<br/>[core.ts]"]
  node_api_sales["Sales API<br/>[sales.ts]"]
  node_api_system["System API<br/>[system.ts]"]
  node_api_pdf["PDF API<br/>[pdf.ts]"]
  node_api_qr["QR API<br/>[qr.ts]"]
end

subgraph group_storage["Data storage"]
  node_db_client["Database client<br/>[index.ts]"]
  node_schema[("Business schema<br/>[schema.ts]")]
end

node_user(("User"))

node_user -->|"opens app"| node_app
node_app -->|"checks access"| node_auth
node_app -->|"wraps protected pages"| node_layout
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_contacts
node_app -->|"routes to"| node_sales
node_app -->|"routes to"| node_purchase
node_app -->|"routes to"| node_accounting
node_app -->|"routes to"| node_inventory
node_app -->|"routes to"| node_products
node_app -->|"routes to"| node_meters
node_app -->|"routes to"| node_reports
node_app -->|"routes to"| node_settings
node_layout -->|"renders"| node_sidebar
node_layout -->|"fetches machines"| node_api_system
node_reports -->|"fetches inventory"| node_api_system
node_api_core -->|"uses database"| node_db_client
node_api_sales -->|"uses database"| node_db_client
node_api_system -->|"uses database"| node_db_client
node_db_client -->|"initializes with"| node_schema

click node_app "https://github.com/innosynth/print-workshop/blob/main/src/App.tsx"
click node_auth "https://github.com/innosynth/print-workshop/blob/main/src/lib/auth-context.tsx"
click node_layout "https://github.com/innosynth/print-workshop/blob/main/src/components/Layout.tsx"
click node_sidebar "https://github.com/innosynth/print-workshop/blob/main/src/components/AppSidebar.tsx"
click node_dashboard "https://github.com/innosynth/print-workshop/blob/main/src/pages/Dashboard.tsx"
click node_contacts "https://github.com/innosynth/print-workshop/blob/main/src/pages/Contacts.tsx"
click node_sales "https://github.com/innosynth/print-workshop/blob/main/src/pages/Sales.tsx"
click node_purchase "https://github.com/innosynth/print-workshop/blob/main/src/pages/Purchase.tsx"
click node_accounting "https://github.com/innosynth/print-workshop/blob/main/src/pages/Accounting.tsx"
click node_inventory "https://github.com/innosynth/print-workshop/blob/main/src/pages/Inventory.tsx"
click node_products "https://github.com/innosynth/print-workshop/blob/main/src/pages/Products.tsx"
click node_meters "https://github.com/innosynth/print-workshop/blob/main/src/pages/MeterReadings.tsx"
click node_reports "https://github.com/innosynth/print-workshop/blob/main/src/pages/Reports.tsx"
click node_settings "https://github.com/innosynth/print-workshop/blob/main/src/pages/Settings.tsx"
click node_api_core "https://github.com/innosynth/print-workshop/blob/main/api/core.ts"
click node_api_sales "https://github.com/innosynth/print-workshop/blob/main/api/sales.ts"
click node_api_system "https://github.com/innosynth/print-workshop/blob/main/api/system.ts"
click node_api_pdf "https://github.com/innosynth/print-workshop/blob/main/api/pdf.ts"
click node_api_qr "https://github.com/innosynth/print-workshop/blob/main/api/qr.ts"
click node_db_client "https://github.com/innosynth/print-workshop/blob/main/db/index.ts"
click node_schema "https://github.com/innosynth/print-workshop/blob/main/db/schema.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,node_auth,node_layout,node_sidebar,node_user toneBlue
class node_dashboard,node_contacts,node_sales,node_purchase,node_accounting,node_inventory,node_products,node_meters,node_reports,node_settings toneAmber
class node_api_core,node_api_sales,node_api_system,node_api_pdf,node_api_qr toneMint
class node_db_client,node_schema toneRose
```

## Components

### Application shell

- [Router and access](https://github.com/innosynth/print-workshop/blob/main/src/App.tsx): `src/App.tsx`
- [Authentication](https://github.com/innosynth/print-workshop/blob/main/src/lib/auth-context.tsx): `src/lib/auth-context.tsx`
- [Navigation layout](https://github.com/innosynth/print-workshop/blob/main/src/components/Layout.tsx): `src/components/Layout.tsx`
- [Application sidebar](https://github.com/innosynth/print-workshop/blob/main/src/components/AppSidebar.tsx): `src/components/AppSidebar.tsx`

### Business modules

- [Dashboard](https://github.com/innosynth/print-workshop/blob/main/src/pages/Dashboard.tsx): `src/pages/Dashboard.tsx`
- [Contacts](https://github.com/innosynth/print-workshop/blob/main/src/pages/Contacts.tsx): `src/pages/Contacts.tsx`
- [Sales](https://github.com/innosynth/print-workshop/blob/main/src/pages/Sales.tsx): `src/pages/Sales.tsx`
- [Purchasing](https://github.com/innosynth/print-workshop/blob/main/src/pages/Purchase.tsx): `src/pages/Purchase.tsx`
- [Accounting](https://github.com/innosynth/print-workshop/blob/main/src/pages/Accounting.tsx): `src/pages/Accounting.tsx`
- [Inventory](https://github.com/innosynth/print-workshop/blob/main/src/pages/Inventory.tsx): `src/pages/Inventory.tsx`
- [Products](https://github.com/innosynth/print-workshop/blob/main/src/pages/Products.tsx): `src/pages/Products.tsx`
- [Meter readings](https://github.com/innosynth/print-workshop/blob/main/src/pages/MeterReadings.tsx): `src/pages/MeterReadings.tsx`
- [Reports](https://github.com/innosynth/print-workshop/blob/main/src/pages/Reports.tsx): `src/pages/Reports.tsx`
- [Settings](https://github.com/innosynth/print-workshop/blob/main/src/pages/Settings.tsx): `src/pages/Settings.tsx`

### API services

- [Core API](https://github.com/innosynth/print-workshop/blob/main/api/core.ts): `api/core.ts`
- [Sales API](https://github.com/innosynth/print-workshop/blob/main/api/sales.ts): `api/sales.ts`
- [System API](https://github.com/innosynth/print-workshop/blob/main/api/system.ts): `api/system.ts`
- [PDF API](https://github.com/innosynth/print-workshop/blob/main/api/pdf.ts): `api/pdf.ts`
- [QR API](https://github.com/innosynth/print-workshop/blob/main/api/qr.ts): `api/qr.ts`

### Data storage

- [Database client](https://github.com/innosynth/print-workshop/blob/main/db/index.ts): `db/index.ts`
- [Business schema](https://github.com/innosynth/print-workshop/blob/main/db/schema.ts): `db/schema.ts`

### Other components

- **User**

## Connections

- User → Router and access: opens app (evidence: `src/App.tsx`)
- Router and access → Authentication: checks access (evidence: `src/App.tsx`)
- Router and access → Navigation layout: wraps protected pages (evidence: `src/App.tsx`)
- Router and access → Dashboard: routes to (evidence: `src/App.tsx`)
- Router and access → Contacts: routes to (evidence: `src/App.tsx`)
- Router and access → Sales: routes to (evidence: `src/App.tsx`)
- Router and access → Purchasing: routes to (evidence: `src/App.tsx`)
- Router and access → Accounting: routes to (evidence: `src/App.tsx`)
- Router and access → Inventory: routes to (evidence: `src/App.tsx`)
- Router and access → Products: routes to (evidence: `src/App.tsx`)
- Router and access → Meter readings: routes to (evidence: `src/App.tsx`)
- Router and access → Reports: routes to (evidence: `src/App.tsx`)
- Router and access → Settings: routes to (evidence: `src/App.tsx`)
- Navigation layout → Application sidebar: renders (evidence: `src/components/Layout.tsx`)
- Navigation layout → System API: fetches machines (evidence: `src/components/Layout.tsx`)
- Reports → System API: fetches inventory (evidence: `src/pages/Reports.tsx`)
- Core API → Database client: uses database (evidence: `api/core.ts`)
- Sales API → Database client: uses database (evidence: `api/sales.ts`)
- System API → Database client: uses database (evidence: `api/system.ts`)
- Database client → Business schema: initializes with (evidence: `db/index.ts`)
