# 0yk0/one_man_shop architecture

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

- Interactive diagram: https://gitdiagram.com/0yk0/one_man_shop
- Repository: https://github.com/0yk0/one_man_shop

## Overview

One Man Shop is an offline-first point-of-sale application for small shops, with desktop and Android frontends sharing a Go backend. The principal workflow is shop setup, product and customer management, checkout with UPI or cash, and subsequent receipt printing and sales reporting. Settings, backups, and a customer-facing display provide supporting capabilities. The README documents the main backend/data and display relationships; source excerpts show frontend routing and selected binding calls. Several backend handlers and platform-specific integrations were not sampled, so their internal links are omitted or identified as documented.

Main entry points: [`frontend/src/App.tsx`](https://github.com/0yk0/one_man_shop/blob/main/frontend/src/App.tsx) (App routing), [`frontend/src/bindings.ts`](https://github.com/0yk0/one_man_shop/blob/main/frontend/src/bindings.ts) (Wails bindings), [`frontend/src/pages/POSScreen.tsx`](https://github.com/0yk0/one_man_shop/blob/main/frontend/src/pages/POSScreen.tsx) (POS checkout), [`backend/handlers`](https://github.com/0yk0/one_man_shop/tree/main/backend/handlers) (POS handlers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["POS Client"]
  node_app["App routing<br/>[App.tsx]"]
  node_setup["Shop setup<br/>[SetupWizard.tsx]"]
  node_checkout["POS checkout<br/>[POSScreen.tsx]"]
  node_catalog["Product catalog<br/>[ProductsPage.tsx]"]
  node_customers["Customer records<br/>[CustomersPage.tsx]"]
  node_customer_detail["Customer history"]
  node_receipts["Receipts and export<br/>[ReceiptsPage.tsx]"]
  node_reports["Sales reports<br/>[ReportsPage.tsx]"]
  node_settings_ui["Shop settings<br/>[SettingsPage.tsx]"]
  node_bindings["Wails bindings<br/>[bindings.ts]"]
  node_settings_hook["Settings state<br/>[useSettings.ts]"]
  node_print_helper["Print helper<br/>[print.ts]"]
  node_display_ui["Customer display"]
end

subgraph group_backend["Go Backend"]
  node_app_service["App service<br/>[app.go]"]
  node_handlers["POS handlers"]
  node_backup["Backup service<br/>[backup.go]"]
  node_display_mgr["Display manager<br/>[state.go]"]
  node_display_ws["Display WebSocket<br/>[ws.go]"]
end

subgraph group_state["Local Data"]
  node_db_layer[("PocketBase data<br/>[pocketbase.go]")]
  node_models["Domain models<br/>[models.go]"]
end

subgraph group_extras["Shop Capabilities"]
end

node_owner(("Shop operator"))
node_filesystem[("Local filesystem")]
node_upi(("UPI payment apps"))
node_printer["Thermal printer"]

node_owner -->|"uses POS"| node_app
node_app -->|"routes setup"| node_setup
node_app -->|"routes checkout"| node_checkout
node_app -->|"routes catalog"| node_catalog
node_app -->|"routes customers"| node_customers
node_app -->|"routes detail"| node_customer_detail
node_app -->|"routes receipts"| node_receipts
node_app -->|"routes reports"| node_reports
node_app -->|"routes settings"| node_settings_ui
node_setup -->|"calls setup methods"| node_bindings
node_checkout -->|"calls POS methods"| node_bindings
node_catalog -->|"calls catalog methods"| node_bindings
node_customers -->|"calls customer methods"| node_bindings
node_customer_detail -->|"calls customer methods"| node_bindings
node_receipts -->|"calls receipt methods"| node_bindings
node_reports -->|"renders report tabs"| node_bindings
node_settings_ui -->|"uses settings state"| node_settings_hook
node_settings_hook -->|"calls settings methods"| node_bindings
node_bindings -->|"invokes Go methods"| node_app_service
node_app_service -->|"dispatches operations"| node_handlers
node_handlers -->|"reads and writes"| node_db_layer
node_handlers -.->|"exports backups"| node_backup
node_backup -->|"writes backups"| node_filesystem
node_handlers -.->|"uses domain data"| node_models
node_checkout -->|"presents payment QR"| node_upi
node_receipts -->|"prints receipts"| node_print_helper
node_print_helper -->|"calls print methods"| node_bindings
node_print_helper -.->|"sends print data"| node_printer
node_checkout -->|"sends display updates"| node_display_mgr
node_display_mgr -->|"pushes display state"| node_display_ws
node_display_ws -->|"serves WebSocket state"| node_display_ui

click node_app "https://github.com/0yk0/one_man_shop/blob/main/frontend/src/App.tsx"
click node_setup "https://github.com/0yk0/one_man_shop/blob/main/frontend/src/components/SetupWizard.tsx"
click node_checkout "https://github.com/0yk0/one_man_shop/blob/main/frontend/src/pages/POSScreen.tsx"
click node_catalog "https://github.com/0yk0/one_man_shop/blob/main/frontend/src/pages/ProductsPage.tsx"
click node_customers "https://github.com/0yk0/one_man_shop/blob/main/frontend/src/pages/CustomersPage.tsx"
click node_customer_detail "https://github.com/0yk0/one_man_shop/blob/main/frontend/src/pages/CustomerDetailPage.tsx"
click node_receipts "https://github.com/0yk0/one_man_shop/blob/main/frontend/src/pages/ReceiptsPage.tsx"
click node_reports "https://github.com/0yk0/one_man_shop/blob/main/frontend/src/pages/ReportsPage.tsx"
click node_settings_ui "https://github.com/0yk0/one_man_shop/blob/main/frontend/src/pages/SettingsPage.tsx"
click node_bindings "https://github.com/0yk0/one_man_shop/blob/main/frontend/src/bindings.ts"
click node_settings_hook "https://github.com/0yk0/one_man_shop/blob/main/frontend/src/hooks/useSettings.ts"
click node_print_helper "https://github.com/0yk0/one_man_shop/blob/main/frontend/src/lib/print.ts"
click node_app_service "https://github.com/0yk0/one_man_shop/blob/main/app.go"
click node_handlers "https://github.com/0yk0/one_man_shop/tree/main/backend/handlers"
click node_db_layer "https://github.com/0yk0/one_man_shop/blob/main/backend/db/pocketbase.go"
click node_models "https://github.com/0yk0/one_man_shop/blob/main/backend/models/models.go"
click node_backup "https://github.com/0yk0/one_man_shop/blob/main/backend/handlers/backup.go"
click node_display_mgr "https://github.com/0yk0/one_man_shop/blob/main/backend/display/state.go"
click node_display_ws "https://github.com/0yk0/one_man_shop/blob/main/backend/display/ws.go"
click node_display_ui "https://github.com/0yk0/one_man_shop/blob/main/frontend/src/components/CustomerDisplay/CustomerDisplay.tsx"

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_setup,node_checkout,node_catalog,node_customers,node_customer_detail,node_receipts,node_reports,node_settings_ui,node_bindings,node_settings_hook,node_print_helper,node_display_ui toneBlue
class node_app_service,node_handlers,node_backup,node_display_mgr,node_display_ws,node_filesystem toneAmber
class node_db_layer,node_models toneMint
class node_owner,node_upi,node_printer toneIndigo
```

## Components

### POS Client

- [App routing](https://github.com/0yk0/one_man_shop/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Shop setup](https://github.com/0yk0/one_man_shop/blob/main/frontend/src/components/SetupWizard.tsx): `frontend/src/components/SetupWizard.tsx`
- [POS checkout](https://github.com/0yk0/one_man_shop/blob/main/frontend/src/pages/POSScreen.tsx): `frontend/src/pages/POSScreen.tsx`
- [Product catalog](https://github.com/0yk0/one_man_shop/blob/main/frontend/src/pages/ProductsPage.tsx): `frontend/src/pages/ProductsPage.tsx`
- [Customer records](https://github.com/0yk0/one_man_shop/blob/main/frontend/src/pages/CustomersPage.tsx): `frontend/src/pages/CustomersPage.tsx`
- [Customer history](https://github.com/0yk0/one_man_shop/blob/main/frontend/src/pages/CustomerDetailPage.tsx): `frontend/src/pages/CustomerDetailPage.tsx`
- [Receipts and export](https://github.com/0yk0/one_man_shop/blob/main/frontend/src/pages/ReceiptsPage.tsx): `frontend/src/pages/ReceiptsPage.tsx`
- [Sales reports](https://github.com/0yk0/one_man_shop/blob/main/frontend/src/pages/ReportsPage.tsx): `frontend/src/pages/ReportsPage.tsx`
- [Shop settings](https://github.com/0yk0/one_man_shop/blob/main/frontend/src/pages/SettingsPage.tsx): `frontend/src/pages/SettingsPage.tsx`
- [Wails bindings](https://github.com/0yk0/one_man_shop/blob/main/frontend/src/bindings.ts): `frontend/src/bindings.ts`
- [Settings state](https://github.com/0yk0/one_man_shop/blob/main/frontend/src/hooks/useSettings.ts): `frontend/src/hooks/useSettings.ts`
- [Print helper](https://github.com/0yk0/one_man_shop/blob/main/frontend/src/lib/print.ts): `frontend/src/lib/print.ts`
- [Customer display](https://github.com/0yk0/one_man_shop/blob/main/frontend/src/components/CustomerDisplay/CustomerDisplay.tsx): `frontend/src/components/CustomerDisplay/CustomerDisplay.tsx`

### Go Backend

- [App service](https://github.com/0yk0/one_man_shop/blob/main/app.go): `app.go`
- [POS handlers](https://github.com/0yk0/one_man_shop/tree/main/backend/handlers): `backend/handlers`
- [Backup service](https://github.com/0yk0/one_man_shop/blob/main/backend/handlers/backup.go): `backend/handlers/backup.go`
- [Display manager](https://github.com/0yk0/one_man_shop/blob/main/backend/display/state.go): `backend/display/state.go`
- [Display WebSocket](https://github.com/0yk0/one_man_shop/blob/main/backend/display/ws.go): `backend/display/ws.go`

### Local Data

- [PocketBase data](https://github.com/0yk0/one_man_shop/blob/main/backend/db/pocketbase.go): `backend/db/pocketbase.go`
- [Domain models](https://github.com/0yk0/one_man_shop/blob/main/backend/models/models.go): `backend/models/models.go`

### Other components

- **Shop operator**
- **Local filesystem**
- **UPI payment apps**
- **Thermal printer**

## Connections

- Shop operator → App routing: uses POS
- App routing → Shop setup: routes setup (evidence: `frontend/src/App.tsx`)
- App routing → POS checkout: routes checkout (evidence: `frontend/src/App.tsx`)
- App routing → Product catalog: routes catalog (evidence: `frontend/src/App.tsx`)
- App routing → Customer records: routes customers (evidence: `frontend/src/App.tsx`)
- App routing → Customer history: routes detail (evidence: `frontend/src/App.tsx`)
- App routing → Receipts and export: routes receipts (evidence: `frontend/src/App.tsx`)
- App routing → Sales reports: routes reports (evidence: `frontend/src/App.tsx`)
- App routing → Shop settings: routes settings (evidence: `frontend/src/App.tsx`)
- Shop setup → Wails bindings: calls setup methods (evidence: `frontend/src/components/SetupWizard.tsx`)
- POS checkout → Wails bindings: calls POS methods (evidence: `frontend/src/pages/POSScreen.tsx`)
- Product catalog → Wails bindings: calls catalog methods (evidence: `frontend/src/pages/ProductsPage.tsx`)
- Customer records → Wails bindings: calls customer methods (evidence: `frontend/src/pages/CustomersPage.tsx`)
- Customer history → Wails bindings: calls customer methods (evidence: `frontend/src/pages/CustomerDetailPage.tsx`)
- Receipts and export → Wails bindings: calls receipt methods (evidence: `frontend/src/pages/ReceiptsPage.tsx`)
- Sales reports → Wails bindings: renders report tabs (evidence: `frontend/src/pages/ReportsPage.tsx`)
- Shop settings → Settings state: uses settings state (evidence: `frontend/src/pages/SettingsPage.tsx`)
- Settings state → Wails bindings: calls settings methods (evidence: `frontend/src/hooks/useSettings.ts`)
- Wails bindings → App service: invokes Go methods
- App service → POS handlers: dispatches operations
- POS handlers → PocketBase data: reads and writes
- POS handlers → Backup service: exports backups
- Backup service → Local filesystem: writes backups
- POS handlers → Domain models: uses domain data
- POS checkout → UPI payment apps: presents payment QR
- Receipts and export → Print helper: prints receipts (evidence: `frontend/src/pages/ReceiptsPage.tsx`)
- Print helper → Wails bindings: calls print methods (evidence: `frontend/src/lib/print.ts`)
- Print helper → Thermal printer: sends print data
- POS checkout → Display manager: sends display updates
- Display manager → Display WebSocket: pushes display state
- Display WebSocket → Customer display: serves WebSocket state
