# usamadevops/bakery-point-of-sale architecture

> Architecture diagram of the GitHub repository usamadevops/bakery-point-of-sale, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/usamadevops/bakery-point-of-sale
- Repository: https://github.com/usamadevops/bakery-point-of-sale

## Overview

This is a prototype desktop point-of-sale application: a cashier works through the Electron-rendered interface to manage products and categories, serve customers, record sales, and configure the store. The documented product areas are represented by the UI and API domain modules; the sampled backend shows transaction persistence and inventory decrement after paid sales. The source excerpts establish Electron startup, API mounting, and transaction-to-inventory calls, but do not show UI-to-API requests, so those links are dashed and marked unverified.

Main entry points: [`server.js`](https://github.com/usamadevops/bakery-point-of-sale/blob/master/server.js) (HTTP API server), [`index.html`](https://github.com/usamadevops/bakery-point-of-sale/blob/master/index.html) (POS screens), [`api/transactions.js`](https://github.com/usamadevops/bakery-point-of-sale/blob/master/api/transactions.js) (Transactions API), [`api/inventory.js`](https://github.com/usamadevops/bakery-point-of-sale/blob/master/api/inventory.js) (Inventory API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop interface"]
  node_pos_ui["POS screens<br/>[index.html]"]
  node_pos_logic["POS interactions<br/>[pos.js]"]
  node_product_filter["Product filter<br/>[product-filter.js]"]
end

subgraph group_backend["API and operations"]
  node_inventory_api["Inventory API<br/>[inventory.js]"]
  node_categories_api["Categories API<br/>[categories.js]"]
  node_customers_api["Customers API<br/>[customers.js]"]
  node_transactions_api["Transactions API<br/>[transactions.js]"]
  node_users_api["Users and login<br/>[users.js]"]
  node_settings_api["Store settings<br/>[settings.js]"]
end

subgraph group_records["Local records"]
  node_inventory_db[("Inventory records<br/>[inventory.db]")]
  node_categories_db[("Category records<br/>[categories.db]")]
  node_customers_db[("Customer records<br/>[customers.db]")]
  node_transactions_db[("Transaction records<br/>[transactions.db]")]
  node_users_db[("User records<br/>[users.db]")]
  node_settings_db[("Settings records<br/>[settings.db]")]
end

subgraph group_runtime["Application runtime"]
  node_app_start["Electron startup<br/>[start.js]"]
  node_http_server["HTTP API server<br/>[server.js]"]
end

node_cashier(("Cashier"))

node_cashier -.->|"uses"| node_pos_ui
node_pos_ui -->|"loads"| node_pos_logic
node_pos_ui -->|"loads"| node_product_filter
node_pos_logic -.->|"sends requests"| node_http_server
node_app_start -->|"starts"| node_http_server
node_app_start -->|"opens"| node_pos_ui
node_http_server -->|"mounts"| node_inventory_api
node_http_server -->|"mounts"| node_categories_api
node_http_server -->|"mounts"| node_customers_api
node_http_server -->|"mounts"| node_transactions_api
node_http_server -->|"mounts"| node_users_api
node_http_server -->|"mounts"| node_settings_api
node_inventory_api -->|"reads and writes"| node_inventory_db
node_categories_api -->|"reads and writes"| node_categories_db
node_customers_api -->|"reads and writes"| node_customers_db
node_transactions_api -->|"reads and writes"| node_transactions_db
node_users_api -->|"reads and writes"| node_users_db
node_settings_api -->|"reads and writes"| node_settings_db
node_transactions_api -->|"decrements stock"| node_inventory_api

click node_pos_ui "https://github.com/usamadevops/bakery-point-of-sale/blob/master/index.html"
click node_pos_logic "https://github.com/usamadevops/bakery-point-of-sale/blob/master/assets/js/pos.js"
click node_product_filter "https://github.com/usamadevops/bakery-point-of-sale/blob/master/assets/js/product-filter.js"
click node_app_start "https://github.com/usamadevops/bakery-point-of-sale/blob/master/start.js"
click node_http_server "https://github.com/usamadevops/bakery-point-of-sale/blob/master/server.js"
click node_inventory_api "https://github.com/usamadevops/bakery-point-of-sale/blob/master/api/inventory.js"
click node_categories_api "https://github.com/usamadevops/bakery-point-of-sale/blob/master/api/categories.js"
click node_customers_api "https://github.com/usamadevops/bakery-point-of-sale/blob/master/api/customers.js"
click node_transactions_api "https://github.com/usamadevops/bakery-point-of-sale/blob/master/api/transactions.js"
click node_users_api "https://github.com/usamadevops/bakery-point-of-sale/blob/master/api/users.js"
click node_settings_api "https://github.com/usamadevops/bakery-point-of-sale/blob/master/api/settings.js"
click node_inventory_db "https://github.com/usamadevops/bakery-point-of-sale/blob/master/undefined/POS/server/databases/inventory.db"
click node_categories_db "https://github.com/usamadevops/bakery-point-of-sale/blob/master/undefined/POS/server/databases/categories.db"
click node_customers_db "https://github.com/usamadevops/bakery-point-of-sale/blob/master/undefined/POS/server/databases/customers.db"
click node_transactions_db "https://github.com/usamadevops/bakery-point-of-sale/blob/master/undefined/POS/server/databases/transactions.db"
click node_users_db "https://github.com/usamadevops/bakery-point-of-sale/blob/master/undefined/POS/server/databases/users.db"
click node_settings_db "https://github.com/usamadevops/bakery-point-of-sale/blob/master/undefined/POS/server/databases/settings.db"

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_pos_ui,node_pos_logic,node_product_filter toneBlue
class node_inventory_api,node_categories_api,node_customers_api,node_transactions_api,node_users_api,node_settings_api toneAmber
class node_inventory_db,node_categories_db,node_customers_db,node_transactions_db,node_users_db,node_settings_db toneMint
class node_app_start,node_http_server toneRose
class node_cashier toneIndigo
```

## Components

### Desktop interface

- [POS screens](https://github.com/usamadevops/bakery-point-of-sale/blob/master/index.html): `index.html`
- [POS interactions](https://github.com/usamadevops/bakery-point-of-sale/blob/master/assets/js/pos.js): `assets/js/pos.js`
- [Product filter](https://github.com/usamadevops/bakery-point-of-sale/blob/master/assets/js/product-filter.js): `assets/js/product-filter.js`

### API and operations

- [Inventory API](https://github.com/usamadevops/bakery-point-of-sale/blob/master/api/inventory.js): `api/inventory.js`
- [Categories API](https://github.com/usamadevops/bakery-point-of-sale/blob/master/api/categories.js): `api/categories.js`
- [Customers API](https://github.com/usamadevops/bakery-point-of-sale/blob/master/api/customers.js): `api/customers.js`
- [Transactions API](https://github.com/usamadevops/bakery-point-of-sale/blob/master/api/transactions.js): `api/transactions.js`
- [Users and login](https://github.com/usamadevops/bakery-point-of-sale/blob/master/api/users.js): `api/users.js`
- [Store settings](https://github.com/usamadevops/bakery-point-of-sale/blob/master/api/settings.js): `api/settings.js`

### Local records

- [Inventory records](https://github.com/usamadevops/bakery-point-of-sale/blob/master/undefined/POS/server/databases/inventory.db): `undefined/POS/server/databases/inventory.db`
- [Category records](https://github.com/usamadevops/bakery-point-of-sale/blob/master/undefined/POS/server/databases/categories.db): `undefined/POS/server/databases/categories.db`
- [Customer records](https://github.com/usamadevops/bakery-point-of-sale/blob/master/undefined/POS/server/databases/customers.db): `undefined/POS/server/databases/customers.db`
- [Transaction records](https://github.com/usamadevops/bakery-point-of-sale/blob/master/undefined/POS/server/databases/transactions.db): `undefined/POS/server/databases/transactions.db`
- [User records](https://github.com/usamadevops/bakery-point-of-sale/blob/master/undefined/POS/server/databases/users.db): `undefined/POS/server/databases/users.db`
- [Settings records](https://github.com/usamadevops/bakery-point-of-sale/blob/master/undefined/POS/server/databases/settings.db): `undefined/POS/server/databases/settings.db`

### Application runtime

- [Electron startup](https://github.com/usamadevops/bakery-point-of-sale/blob/master/start.js): `start.js`
- [HTTP API server](https://github.com/usamadevops/bakery-point-of-sale/blob/master/server.js): `server.js`

### Other components

- **Cashier**

## Connections

- Cashier → POS screens: uses (evidence: `README.md`)
- POS screens → POS interactions: loads
- POS screens → Product filter: loads
- POS interactions → HTTP API server: sends requests
- Electron startup → HTTP API server: starts (evidence: `start.js`)
- Electron startup → POS screens: opens (evidence: `start.js`)
- HTTP API server → Inventory API: mounts (evidence: `server.js`)
- HTTP API server → Categories API: mounts (evidence: `server.js`)
- HTTP API server → Customers API: mounts (evidence: `server.js`)
- HTTP API server → Transactions API: mounts (evidence: `server.js`)
- HTTP API server → Users and login: mounts (evidence: `server.js`)
- HTTP API server → Store settings: mounts (evidence: `server.js`)
- Inventory API → Inventory records: reads and writes (evidence: `api/inventory.js`)
- Categories API → Category records: reads and writes (evidence: `api/categories.js`)
- Customers API → Customer records: reads and writes (evidence: `api/customers.js`)
- Transactions API → Transaction records: reads and writes (evidence: `api/transactions.js`)
- Users and login → User records: reads and writes (evidence: `api/users.js`)
- Store settings → Settings records: reads and writes (evidence: `api/settings.js`)
- Transactions API → Inventory API: decrements stock (evidence: `api/transactions.js`)
