# frede43/stock_resto architecture

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

## Overview

Barstock is a restaurant/bar operations and point-of-sale platform: staff use role-aware dashboards and operational screens to manage sales, products and stock, kitchen work, credits, expenses, and reporting. The React frontend is paired with a Django backend and realtime/reporting components. The README is empty, and many domain files are unsampled, so the graph preserves those substantial product areas without guessing their call paths; edges are limited to relationships visible in excerpts or the SOURCE INDEX.

Main entry points: [`backend/sales/models.py`](https://github.com/frede43/stock_resto/blob/main/backend/sales/models.py) (Sales and tables), [`src/App.tsx`](https://github.com/frede43/stock_resto/blob/main/src/App.tsx) (App routing), [`backend/reports/tasks.py`](https://github.com/frede43/stock_resto/blob/main/backend/reports/tasks.py) (Report generation), [`backend/sales/services.py`](https://github.com/frede43/stock_resto/blob/main/backend/sales/services.py) (Sales workflows)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Staff application"]
  node_app["App routing<br/>[App.tsx]"]
  node_home["Role dashboards<br/>[Index.tsx]"]
  node_sales_ui["Sales workspace<br/>[Sales.tsx]"]
  node_stock_ui["Stock workspace<br/>[Stocks.tsx]"]
  node_kitchen_ui["Kitchen workspace<br/>[Kitchen.tsx]"]
  node_reports_ui["Reports workspace<br/>[Reports.tsx]"]
  node_auth["Authentication<br/>[use-auth.tsx]"]
  node_api_hooks["API data hooks<br/>[use-api.ts]"]
  node_api_service["API client<br/>[api.ts]"]
end

subgraph group_operations["Operations backend"]
  node_products[("Products and stock<br/>[models.py]")]
  node_sales[("Sales and tables<br/>[models.py]")]
  node_sales_service["Sales workflows<br/>[services.py]"]
  node_credits[("Customer credits<br/>[models.py]")]
  node_inventory[("Inventory<br/>[models.py]")]
  node_kitchen[("Kitchen operations<br/>[models.py]")]
  node_expenses[("Expenses<br/>[models.py]")]
end

subgraph group_insights["Reporting and alerts"]
  node_reports[("Report records<br/>[models.py]")]
  node_report_tasks["Report generation<br/>[tasks.py]"]
  node_report_stream["Report realtime<br/>[consumers.py]"]
  node_sales_stream["Sales realtime<br/>[consumers.py]"]
end

subgraph group_runtime["Shared runtime"]
  node_storage[("Session storage<br/>[storage.ts]")]
  node_notifications["Notifications<br/>[notifications.py]"]
end

node_staff(("Staff user"))

node_staff -->|"uses"| node_app
node_app -->|"provides auth"| node_auth
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_sales_ui
node_app -->|"routes to"| node_stock_ui
node_app -->|"routes to"| node_kitchen_ui
node_auth -->|"reads session"| node_storage
node_auth -->|"validates session"| node_api_service
node_home -->|"loads dashboard data"| node_api_hooks
node_sales_service -->|"uses sale records"| node_sales
node_sales_service -->|"dispatches updates"| node_sales_stream
node_sales_service -->|"sends notifications"| node_notifications
node_sales -->|"references products"| node_products
node_report_tasks -->|"creates reports"| node_reports
node_report_tasks -->|"aggregates sales"| node_sales
node_report_tasks -->|"reads product costs"| node_products
node_report_tasks -->|"totals expenses"| node_expenses
node_report_tasks -->|"announces reports"| node_notifications
node_report_stream -->|"reads report data"| node_reports
node_report_stream -->|"reads sales data"| node_sales
node_report_stream -->|"reads product data"| node_products
node_sales_stream -->|"reads sales data"| node_sales
node_sales_stream -->|"serializes updates"| node_sales
node_kitchen -->|"signals notifications"| node_notifications
node_sales -->|"uses stock movements"| node_inventory

click node_app "https://github.com/frede43/stock_resto/blob/main/src/App.tsx"
click node_home "https://github.com/frede43/stock_resto/blob/main/src/pages/Index.tsx"
click node_sales_ui "https://github.com/frede43/stock_resto/blob/main/src/pages/Sales.tsx"
click node_stock_ui "https://github.com/frede43/stock_resto/blob/main/src/pages/Stocks.tsx"
click node_kitchen_ui "https://github.com/frede43/stock_resto/blob/main/src/pages/Kitchen.tsx"
click node_reports_ui "https://github.com/frede43/stock_resto/blob/main/src/pages/Reports.tsx"
click node_auth "https://github.com/frede43/stock_resto/blob/main/src/hooks/use-auth.tsx"
click node_api_hooks "https://github.com/frede43/stock_resto/blob/main/src/hooks/use-api.ts"
click node_api_service "https://github.com/frede43/stock_resto/blob/main/src/services/api.ts"
click node_storage "https://github.com/frede43/stock_resto/blob/main/src/utils/storage.ts"
click node_products "https://github.com/frede43/stock_resto/blob/main/backend/products/models.py"
click node_sales "https://github.com/frede43/stock_resto/blob/main/backend/sales/models.py"
click node_sales_service "https://github.com/frede43/stock_resto/blob/main/backend/sales/services.py"
click node_credits "https://github.com/frede43/stock_resto/blob/main/backend/credits/models.py"
click node_inventory "https://github.com/frede43/stock_resto/blob/main/backend/inventory/models.py"
click node_kitchen "https://github.com/frede43/stock_resto/blob/main/backend/kitchen/models.py"
click node_expenses "https://github.com/frede43/stock_resto/blob/main/backend/expenses/models.py"
click node_reports "https://github.com/frede43/stock_resto/blob/main/backend/reports/models.py"
click node_report_tasks "https://github.com/frede43/stock_resto/blob/main/backend/reports/tasks.py"
click node_report_stream "https://github.com/frede43/stock_resto/blob/main/backend/reports/consumers.py"
click node_sales_stream "https://github.com/frede43/stock_resto/blob/main/backend/sales/consumers.py"
click node_notifications "https://github.com/frede43/stock_resto/blob/main/backend/core/notifications.py"

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_home,node_sales_ui,node_stock_ui,node_kitchen_ui,node_reports_ui,node_auth,node_api_hooks,node_api_service,node_staff toneBlue
class node_products,node_sales,node_sales_service,node_credits,node_inventory,node_kitchen,node_expenses toneAmber
class node_reports,node_report_tasks,node_report_stream,node_sales_stream toneMint
class node_storage,node_notifications toneRose
```

## Components

### Staff application

- [App routing](https://github.com/frede43/stock_resto/blob/main/src/App.tsx): `src/App.tsx`
- [Role dashboards](https://github.com/frede43/stock_resto/blob/main/src/pages/Index.tsx): `src/pages/Index.tsx`
- [Sales workspace](https://github.com/frede43/stock_resto/blob/main/src/pages/Sales.tsx): `src/pages/Sales.tsx`
- [Stock workspace](https://github.com/frede43/stock_resto/blob/main/src/pages/Stocks.tsx): `src/pages/Stocks.tsx`
- [Kitchen workspace](https://github.com/frede43/stock_resto/blob/main/src/pages/Kitchen.tsx): `src/pages/Kitchen.tsx`
- [Reports workspace](https://github.com/frede43/stock_resto/blob/main/src/pages/Reports.tsx): `src/pages/Reports.tsx`
- [Authentication](https://github.com/frede43/stock_resto/blob/main/src/hooks/use-auth.tsx): `src/hooks/use-auth.tsx`
- [API data hooks](https://github.com/frede43/stock_resto/blob/main/src/hooks/use-api.ts): `src/hooks/use-api.ts`
- [API client](https://github.com/frede43/stock_resto/blob/main/src/services/api.ts): `src/services/api.ts`

### Operations backend

- [Products and stock](https://github.com/frede43/stock_resto/blob/main/backend/products/models.py): `backend/products/models.py`
- [Sales and tables](https://github.com/frede43/stock_resto/blob/main/backend/sales/models.py): `backend/sales/models.py`
- [Sales workflows](https://github.com/frede43/stock_resto/blob/main/backend/sales/services.py): `backend/sales/services.py`
- [Customer credits](https://github.com/frede43/stock_resto/blob/main/backend/credits/models.py): `backend/credits/models.py`
- [Inventory](https://github.com/frede43/stock_resto/blob/main/backend/inventory/models.py): `backend/inventory/models.py`
- [Kitchen operations](https://github.com/frede43/stock_resto/blob/main/backend/kitchen/models.py): `backend/kitchen/models.py`
- [Expenses](https://github.com/frede43/stock_resto/blob/main/backend/expenses/models.py): `backend/expenses/models.py`

### Reporting and alerts

- [Report records](https://github.com/frede43/stock_resto/blob/main/backend/reports/models.py): `backend/reports/models.py`
- [Report generation](https://github.com/frede43/stock_resto/blob/main/backend/reports/tasks.py): `backend/reports/tasks.py`
- [Report realtime](https://github.com/frede43/stock_resto/blob/main/backend/reports/consumers.py): `backend/reports/consumers.py`
- [Sales realtime](https://github.com/frede43/stock_resto/blob/main/backend/sales/consumers.py): `backend/sales/consumers.py`

### Shared runtime

- [Session storage](https://github.com/frede43/stock_resto/blob/main/src/utils/storage.ts): `src/utils/storage.ts`
- [Notifications](https://github.com/frede43/stock_resto/blob/main/backend/core/notifications.py): `backend/core/notifications.py`

### Other components

- **Staff user**

## Connections

- Staff user → App routing: uses (evidence: `src/App.tsx`)
- App routing → Authentication: provides auth (evidence: `src/App.tsx`)
- App routing → Role dashboards: routes to (evidence: `src/App.tsx`)
- App routing → Sales workspace: routes to (evidence: `src/App.tsx`)
- App routing → Stock workspace: routes to (evidence: `src/App.tsx`)
- App routing → Kitchen workspace: routes to (evidence: `src/App.tsx`)
- Authentication → Session storage: reads session (evidence: `src/hooks/use-auth.tsx`)
- Authentication → API client: validates session (evidence: `src/hooks/use-auth.tsx`)
- Role dashboards → API data hooks: loads dashboard data (evidence: `src/pages/Index.tsx`)
- Sales workflows → Sales and tables: uses sale records (evidence: `backend/sales/services.py`)
- Sales workflows → Sales realtime: dispatches updates (evidence: `backend/sales/services.py`)
- Sales workflows → Notifications: sends notifications (evidence: `backend/sales/services.py`)
- Sales and tables → Products and stock: references products (evidence: `backend/sales/models.py`)
- Report generation → Report records: creates reports (evidence: `backend/reports/tasks.py`)
- Report generation → Sales and tables: aggregates sales (evidence: `backend/reports/tasks.py`)
- Report generation → Products and stock: reads product costs (evidence: `backend/reports/tasks.py`)
- Report generation → Expenses: totals expenses (evidence: `backend/reports/tasks.py`)
- Report generation → Notifications: announces reports (evidence: `backend/reports/tasks.py`)
- Report realtime → Report records: reads report data (evidence: `backend/reports/consumers.py`)
- Report realtime → Sales and tables: reads sales data (evidence: `backend/reports/consumers.py`)
- Report realtime → Products and stock: reads product data (evidence: `backend/reports/consumers.py`)
- Sales realtime → Sales and tables: reads sales data (evidence: `backend/sales/consumers.py`)
- Sales realtime → Sales and tables: serializes updates (evidence: `backend/sales/consumers.py`)
- Kitchen operations → Notifications: signals notifications (evidence: `backend/kitchen/signals.py`)
- Sales and tables → Inventory: uses stock movements (evidence: `backend/sales/models.py`)
