# ratmir26/startup architecture

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

- Interactive diagram: https://gitdiagram.com/ratmir26/startup
- Repository: https://github.com/ratmir26/startup

## Overview

Эсеп is a browser-based cash-register and stock-accounting MVP for cafés in Kyrgyzstan. The main workflow records a sale, automatically deducts recipe ingredients, signals low stock, and supports inventory counts that calculate discrepancies and estimated leakage in soms. The app also provides stock movements, shift history, role restrictions, and a dashboard with revenue, COGS, and food-cost metrics. The source excerpts show the app’s state and domain logic; some screen and shift behavior is documented in the README, so unsampled implementation details are not expanded.

Main entry points: [`app/app.js`](https://github.com/ratmir26/startup/blob/main/app/app.js) (App controller), [`app/domain.js`](https://github.com/ratmir26/startup/blob/main/app/domain.js) (Accounting rules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_operations["Café operations"]
  node_app["App controller<br/>[app.js]"]
  node_register["Cash register<br/>[app.js]"]
  node_stock["Stock control<br/>[app.js]"]
  node_movements["Stock ledger<br/>[app.js]"]
end

subgraph group_accounting["Accounting and insights"]
  node_inventory["Inventory count<br/>[app.js]"]
  node_leakage["Discrepancy and leakage<br/>[domain.js]"]
  node_metrics["Sales and cost metrics<br/>[domain.js]"]
  node_dashboard["Dashboard and history<br/>[app.js]"]
  node_domain["Accounting rules<br/>[domain.js]"]
end

subgraph group_state["State and persistence"]
  node_state["App state<br/>[app.js]"]
  node_browserstore[("Browser localStorage")]
end

node_staff(("Café staff"))

node_staff -->|"uses"| node_app
node_app -->|"renders"| node_register
node_app -->|"renders"| node_stock
node_app -->|"renders"| node_inventory
node_app -->|"renders"| node_dashboard
node_register -->|"checks ingredients"| node_domain
node_register -->|"records sales"| node_state
node_stock -->|"checks low stock"| node_domain
node_stock -->|"shows entries"| node_movements
node_inventory -->|"calculates counts"| node_domain
node_inventory -->|"reports discrepancy"| node_leakage
node_dashboard -->|"shows metrics"| node_metrics
node_dashboard -->|"shows leakage"| node_leakage
node_domain -->|"calculates"| node_metrics
node_domain -->|"calculates"| node_leakage
node_app -->|"manages"| node_state
node_state -->|"reads and writes"| node_browserstore

click node_app "https://github.com/ratmir26/startup/blob/main/app/app.js"
click node_register "https://github.com/ratmir26/startup/blob/main/app/app.js"
click node_stock "https://github.com/ratmir26/startup/blob/main/app/app.js"
click node_movements "https://github.com/ratmir26/startup/blob/main/app/app.js"
click node_inventory "https://github.com/ratmir26/startup/blob/main/app/app.js"
click node_leakage "https://github.com/ratmir26/startup/blob/main/app/domain.js"
click node_metrics "https://github.com/ratmir26/startup/blob/main/app/domain.js"
click node_dashboard "https://github.com/ratmir26/startup/blob/main/app/app.js"
click node_domain "https://github.com/ratmir26/startup/blob/main/app/domain.js"
click node_state "https://github.com/ratmir26/startup/blob/main/app/app.js"

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_register,node_stock,node_movements toneBlue
class node_inventory,node_leakage,node_metrics,node_dashboard,node_domain toneAmber
class node_state,node_browserstore toneMint
class node_staff toneIndigo
```

## Components

### Café operations

- [App controller](https://github.com/ratmir26/startup/blob/main/app/app.js): `app/app.js`
- [Cash register](https://github.com/ratmir26/startup/blob/main/app/app.js): `app/app.js`
- [Stock control](https://github.com/ratmir26/startup/blob/main/app/app.js): `app/app.js`
- [Stock ledger](https://github.com/ratmir26/startup/blob/main/app/app.js): `app/app.js`

### Accounting and insights

- [Inventory count](https://github.com/ratmir26/startup/blob/main/app/app.js): `app/app.js`
- [Discrepancy and leakage](https://github.com/ratmir26/startup/blob/main/app/domain.js): `app/domain.js`
- [Sales and cost metrics](https://github.com/ratmir26/startup/blob/main/app/domain.js): `app/domain.js`
- [Dashboard and history](https://github.com/ratmir26/startup/blob/main/app/app.js): `app/app.js`
- [Accounting rules](https://github.com/ratmir26/startup/blob/main/app/domain.js): `app/domain.js`

### State and persistence

- [App state](https://github.com/ratmir26/startup/blob/main/app/app.js): `app/app.js`
- **Browser localStorage**

### Other components

- **Café staff**

## Connections

- Café staff → App controller: uses (evidence: `README.md`)
- App controller → Cash register: renders (evidence: `app/app.js`)
- App controller → Stock control: renders (evidence: `app/app.js`)
- App controller → Inventory count: renders (evidence: `app/app.js`)
- App controller → Dashboard and history: renders (evidence: `app/app.js`)
- Cash register → Accounting rules: checks ingredients (evidence: `app/app.js`)
- Cash register → App state: records sales (evidence: `README.md`)
- Stock control → Accounting rules: checks low stock (evidence: `app/app.js`)
- Stock control → Stock ledger: shows entries (evidence: `app/app.js`)
- Inventory count → Accounting rules: calculates counts (evidence: `app/app.js`)
- Inventory count → Discrepancy and leakage: reports discrepancy (evidence: `README.md`)
- Dashboard and history → Sales and cost metrics: shows metrics (evidence: `app/app.js`)
- Dashboard and history → Discrepancy and leakage: shows leakage (evidence: `README.md`)
- Accounting rules → Sales and cost metrics: calculates (evidence: `app/domain.js`)
- Accounting rules → Discrepancy and leakage: calculates (evidence: `app/domain.js`)
- App controller → App state: manages (evidence: `app/app.js`)
- App state → Browser localStorage: reads and writes (evidence: `app/app.js`)
