# georgi-0d/pos-horeca architecture

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

- Interactive diagram: https://gitdiagram.com/georgi-0d/pos-horeca
- Repository: https://github.com/georgi-0d/pos-horeca

## Overview

POS Horeca is a desktop point-of-sale app for restaurant staff, built with a Tauri webview frontend, Rust command handlers, and PostgreSQL. The main workflow is staff PIN login, selecting or reserving a table, creating an order and adding products, then recording payment; payment also frees the table, updates stock, and creates an invoice. Separate capabilities cover kitchen tickets, inventory and catalog administration, employee/settings management, and sales and shift reports. Frontend and command wiring are supported by sampled source; some unsampled command behavior is represented only at module level.

Main entry points: [`src-tauri/src/lib.rs`](https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/lib.rs) (Command dispatcher), [`src-tauri/src/db.rs`](https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/db.rs) (Database pool), [`src-tauri/src/commands/order.rs`](https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/order.rs) (Order lifecycle), [`src-tauri/src/commands/auth.rs`](https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/auth.rs) (PIN authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["POS client"]
  node_webview["POS interface<br/>[main.js]"]
end

subgraph group_runtime["Tauri runtime"]
  node_runtime["Command dispatcher<br/>[lib.rs]"]
  node_sessions[("Active sessions<br/>[auth.rs]")]
  node_models["Domain models"]
end

subgraph group_commerce["Service workflow"]
  node_auth["PIN authentication<br/>[auth.rs]"]
  node_tables["Tables and reservations<br/>[table.rs]"]
  node_orders["Order lifecycle<br/>[order.rs]"]
  node_order_items["Order items<br/>[order_item.rs]"]
  node_payments["Payment recording<br/>[payment.rs]"]
  node_invoices["Invoices<br/>[invoice.rs]"]
  node_kitchen["Kitchen tickets<br/>[kitchen.rs]"]
end

subgraph group_management["Operations and reporting"]
  node_catalog["Products and categories<br/>[product.rs]"]
  node_categories["Category management<br/>[category.rs]"]
  node_inventory["Inventory<br/>[inventory.rs]"]
  node_admin["Product administration<br/>[admin.rs]"]
  node_employees["Employee administration<br/>[employees.rs]"]
  node_settings["Application settings<br/>[settings.rs]"]
  node_reports["Sales and shift reports<br/>[report.rs]"]
end

subgraph group_persistence["Persistence"]
  node_pool["Database pool<br/>[db.rs]"]
  node_postgres[("PostgreSQL")]
end

node_staff(("POS staff"))

node_staff -->|"uses"| node_webview
node_webview -->|"invokes commands"| node_runtime
node_runtime -->|"dispatches"| node_auth
node_runtime -->|"dispatches"| node_tables
node_runtime -->|"dispatches"| node_orders
node_runtime -->|"dispatches"| node_order_items
node_runtime -->|"dispatches"| node_payments
node_runtime -->|"dispatches"| node_invoices
node_runtime -->|"dispatches"| node_kitchen
node_runtime -->|"dispatches"| node_catalog
node_runtime -->|"dispatches"| node_categories
node_runtime -->|"dispatches"| node_inventory
node_runtime -->|"dispatches"| node_admin
node_runtime -->|"dispatches"| node_employees
node_runtime -->|"dispatches"| node_settings
node_runtime -->|"dispatches"| node_reports
node_runtime -->|"creates pool"| node_pool
node_auth -->|"stores sessions"| node_sessions
node_orders -->|"updates stock"| node_inventory
node_orders -->|"sets table status"| node_tables
node_auth -->|"queries"| node_pool
node_tables -->|"reads and writes"| node_pool
node_orders -->|"reads and writes"| node_pool
node_order_items -->|"reads and writes"| node_pool
node_payments -->|"reads and writes"| node_pool
node_invoices -->|"reads and writes"| node_pool
node_kitchen -->|"reads and writes"| node_pool
node_catalog -->|"reads and writes"| node_pool
node_categories -->|"reads and writes"| node_pool
node_inventory -->|"reads and writes"| node_pool
node_admin -->|"reads and writes"| node_pool
node_employees -->|"reads and writes"| node_pool
node_settings -->|"reads and writes"| node_pool
node_reports -->|"queries"| node_pool
node_pool -->|"connects"| node_postgres
node_orders -.->|"uses order item model"| node_models

click node_webview "https://github.com/georgi-0d/pos-horeca/blob/main/src/main.js"
click node_runtime "https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/lib.rs"
click node_auth "https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/auth.rs"
click node_sessions "https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/auth.rs"
click node_tables "https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/table.rs"
click node_orders "https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/order.rs"
click node_order_items "https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/order_item.rs"
click node_payments "https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/payment.rs"
click node_invoices "https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/invoice.rs"
click node_kitchen "https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/kitchen.rs"
click node_catalog "https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/product.rs"
click node_categories "https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/category.rs"
click node_inventory "https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/inventory.rs"
click node_admin "https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/admin.rs"
click node_employees "https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/employees.rs"
click node_settings "https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/settings.rs"
click node_reports "https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/report.rs"
click node_pool "https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/db.rs"
click node_models "https://github.com/georgi-0d/pos-horeca/tree/main/src-tauri/src/models"

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_webview toneBlue
class node_runtime,node_sessions,node_models toneAmber
class node_auth,node_tables,node_orders,node_order_items,node_payments,node_invoices,node_kitchen toneMint
class node_catalog,node_categories,node_inventory,node_admin,node_employees,node_settings,node_reports toneRose
class node_pool,node_postgres,node_staff toneIndigo
```

## Components

### POS client

- [POS interface](https://github.com/georgi-0d/pos-horeca/blob/main/src/main.js): `src/main.js`

### Tauri runtime

- [Command dispatcher](https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/lib.rs): `src-tauri/src/lib.rs`
- [Active sessions](https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/auth.rs): `src-tauri/src/commands/auth.rs`
- [Domain models](https://github.com/georgi-0d/pos-horeca/tree/main/src-tauri/src/models): `src-tauri/src/models`

### Service workflow

- [PIN authentication](https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/auth.rs): `src-tauri/src/commands/auth.rs`
- [Tables and reservations](https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/table.rs): `src-tauri/src/commands/table.rs`
- [Order lifecycle](https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/order.rs): `src-tauri/src/commands/order.rs`
- [Order items](https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/order_item.rs): `src-tauri/src/commands/order_item.rs`
- [Payment recording](https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/payment.rs): `src-tauri/src/commands/payment.rs`
- [Invoices](https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/invoice.rs): `src-tauri/src/commands/invoice.rs`
- [Kitchen tickets](https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/kitchen.rs): `src-tauri/src/commands/kitchen.rs`

### Operations and reporting

- [Products and categories](https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/product.rs): `src-tauri/src/commands/product.rs`
- [Category management](https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/category.rs): `src-tauri/src/commands/category.rs`
- [Inventory](https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/inventory.rs): `src-tauri/src/commands/inventory.rs`
- [Product administration](https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/admin.rs): `src-tauri/src/commands/admin.rs`
- [Employee administration](https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/employees.rs): `src-tauri/src/commands/employees.rs`
- [Application settings](https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/settings.rs): `src-tauri/src/commands/settings.rs`
- [Sales and shift reports](https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/commands/report.rs): `src-tauri/src/commands/report.rs`

### Persistence

- [Database pool](https://github.com/georgi-0d/pos-horeca/blob/main/src-tauri/src/db.rs): `src-tauri/src/db.rs`
- **PostgreSQL**

### Other components

- **POS staff**

## Connections

- POS staff → POS interface: uses
- POS interface → Command dispatcher: invokes commands
- Command dispatcher → PIN authentication: dispatches
- Command dispatcher → Tables and reservations: dispatches
- Command dispatcher → Order lifecycle: dispatches
- Command dispatcher → Order items: dispatches
- Command dispatcher → Payment recording: dispatches
- Command dispatcher → Invoices: dispatches
- Command dispatcher → Kitchen tickets: dispatches
- Command dispatcher → Products and categories: dispatches
- Command dispatcher → Category management: dispatches
- Command dispatcher → Inventory: dispatches
- Command dispatcher → Product administration: dispatches
- Command dispatcher → Employee administration: dispatches
- Command dispatcher → Application settings: dispatches
- Command dispatcher → Sales and shift reports: dispatches
- Command dispatcher → Database pool: creates pool
- PIN authentication → Active sessions: stores sessions
- Order lifecycle → Inventory: updates stock
- Order lifecycle → Tables and reservations: sets table status
- PIN authentication → Database pool: queries
- Tables and reservations → Database pool: reads and writes
- Order lifecycle → Database pool: reads and writes
- Order items → Database pool: reads and writes
- Payment recording → Database pool: reads and writes
- Invoices → Database pool: reads and writes
- Kitchen tickets → Database pool: reads and writes
- Products and categories → Database pool: reads and writes
- Category management → Database pool: reads and writes
- Inventory → Database pool: reads and writes
- Product administration → Database pool: reads and writes
- Employee administration → Database pool: reads and writes
- Application settings → Database pool: reads and writes
- Sales and shift reports → Database pool: queries
- Database pool → PostgreSQL: connects
- Order lifecycle → Domain models: uses order item model
