# tech-applywizz-git-account/snackify_inventory_tool architecture

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

- Interactive diagram: https://gitdiagram.com/tech-applywizz-git-account/snackify_inventory_tool
- Repository: https://github.com/tech-applywizz-git-account/snackify_inventory_tool

## Overview

Applyways Office Pantry is an office operations product for employee meal ordering and reviews, pantry inventory, purchases, bill approval, and administrative reporting. The principal documented procurement workflow extracts uploaded invoices, converts their lines into reviewable stock classifications, then applies approved stock changes through an idempotent ledger. The graph also includes meal, request, and guest-order capabilities visible in the route and page structure. Source excerpts are selective; unsampled subsystems are represented at their existing route or page paths, and uncertain wiring is omitted.

Main entry points: [`frontend/src/App.jsx`](https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/frontend/src/App.jsx) (Web application), [`backend/src/lib/supabase.js`](https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/backend/src/lib/supabase.js) (Supabase data and auth), [`frontend/src/lib/api.js`](https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/frontend/src/lib/api.js) (Frontend API client), [`backend/src/server.js`](https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/backend/src/server.js) (Express API server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_webapp["Web application<br/>[App.jsx]"]
  node_auth["Session and profile<br/>[useAuth.js]"]
  node_mealbooking["Meal booking<br/>[MealBooking.jsx]"]
  node_guestorders["Guest meals<br/>[Guest.jsx]"]
  node_mealreviews["Meal reviews<br/>[MealReviews.jsx]"]
  node_requests["Staff requests<br/>[RequestSubmit.jsx]"]
  node_adminui["Admin operations<br/>[Admin.jsx]"]
  node_billui["Bill approval<br/>[BillUpload.jsx]"]
  node_api_client["Frontend API client<br/>[api.js]"]
end

subgraph group_api["Application API"]
  node_server["Express API server<br/>[server.js]"]
  node_mealroutes["Meals and cafeteria routes<br/>[meals.js]"]
  node_billroutes["Bill intake and approval<br/>[bills.js]"]
  node_inventoryroutes["Inventory and products<br/>[inventory.js]"]
  node_requestroutes["Request handling<br/>[requests.js]"]
  node_reviewroutes["Meal review handling<br/>[mealReviews.js]"]
end

subgraph group_operations["Pantry operations"]
  node_conversion["Product conversion"]
  node_purchase["Purchase application<br/>[applyPurchase.js]"]
  node_stocktake["Stock-taking<br/>[stockTake.js]"]
end

subgraph group_integrations["State and integrations"]
  node_database[("Supabase data and auth<br/>[supabase.js]")]
  node_openai["OpenAI services<br/>[openai.js]"]
  node_telegram["Telegram purchase workflow<br/>[telegramWebhook.js]"]
  node_printagent["Meal print agent<br/>[index.js]"]
end

node_staff(("Employees and staff"))
node_admins(("Operations admins"))
node_printer["Office receipt printer"]

node_staff -->|"use"| node_webapp
node_admins -->|"manage"| node_webapp
node_webapp -->|"checks sessions"| node_auth
node_webapp -->|"routes to"| node_mealbooking
node_webapp -->|"routes to"| node_guestorders
node_webapp -->|"routes to"| node_mealreviews
node_webapp -->|"routes to"| node_requests
node_webapp -->|"routes to"| node_adminui
node_webapp -->|"routes to"| node_billui
node_mealbooking -->|"uses"| node_api_client
node_guestorders -->|"uses"| node_api_client
node_mealreviews -->|"uses"| node_api_client
node_requests -->|"uses"| node_api_client
node_adminui -->|"uses"| node_api_client
node_billui -->|"uses"| node_api_client
node_api_client -->|"calls API"| node_server
node_server -->|"dispatches"| node_mealroutes
node_server -->|"dispatches"| node_billroutes
node_server -->|"dispatches"| node_inventoryroutes
node_server -->|"dispatches"| node_requestroutes
node_server -->|"dispatches"| node_reviewroutes
node_billroutes -->|"stores bill rows"| node_database
node_billroutes -->|"processes invoice lines"| node_conversion
node_conversion -->|"reads rules; saves results"| node_database
node_conversion -.->|"classifies unmatched"| node_openai
node_billroutes -->|"applies approved stock"| node_database
node_inventoryroutes -->|"reads and writes stock"| node_database
node_mealroutes -->|"reads and writes meals"| node_database
node_requestroutes -->|"stores requests"| node_database
node_reviewroutes -->|"stores reviews"| node_database
node_telegram -.->|"extracts purchases"| node_openai
node_telegram -->|"applies purchase"| node_purchase
node_telegram -->|"runs stock-take"| node_stocktake
node_telegram -->|"reads and writes"| node_database
node_printagent -->|"reads print jobs"| node_database
node_printagent -->|"prints receipts"| node_printer

click node_webapp "https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/frontend/src/App.jsx"
click node_auth "https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/frontend/src/hooks/useAuth.js"
click node_mealbooking "https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/frontend/src/pages/MealBooking.jsx"
click node_guestorders "https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/frontend/src/pages/Guest.jsx"
click node_mealreviews "https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/frontend/src/pages/MealReviews.jsx"
click node_requests "https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/frontend/src/pages/RequestSubmit.jsx"
click node_adminui "https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/frontend/src/pages/Admin.jsx"
click node_billui "https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/frontend/src/pages/BillUpload.jsx"
click node_api_client "https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/frontend/src/lib/api.js"
click node_server "https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/backend/src/server.js"
click node_mealroutes "https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/backend/src/routes/meals.js"
click node_billroutes "https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/backend/src/routes/bills.js"
click node_inventoryroutes "https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/backend/src/routes/inventory.js"
click node_requestroutes "https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/backend/src/routes/requests.js"
click node_reviewroutes "https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/backend/src/routes/mealReviews.js"
click node_conversion "https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/backend/src/lib/productConversion.js"
click node_purchase "https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/backend/src/lib/applyPurchase.js"
click node_stocktake "https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/backend/src/lib/stockTake.js"
click node_database "https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/backend/src/lib/supabase.js"
click node_openai "https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/backend/src/lib/openai.js"
click node_telegram "https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/backend/src/routes/telegramWebhook.js"
click node_printagent "https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/print-agent/index.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_webapp,node_auth,node_mealbooking,node_guestorders,node_mealreviews,node_requests,node_adminui,node_billui,node_api_client toneBlue
class node_server,node_mealroutes,node_billroutes,node_inventoryroutes,node_requestroutes,node_reviewroutes toneAmber
class node_conversion,node_purchase,node_stocktake toneMint
class node_database,node_openai,node_telegram,node_printagent toneRose
class node_staff,node_admins,node_printer toneIndigo
```

## Components

### User experience

- [Web application](https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Session and profile](https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/frontend/src/hooks/useAuth.js): `frontend/src/hooks/useAuth.js`
- [Meal booking](https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/frontend/src/pages/MealBooking.jsx): `frontend/src/pages/MealBooking.jsx`
- [Guest meals](https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/frontend/src/pages/Guest.jsx): `frontend/src/pages/Guest.jsx`
- [Meal reviews](https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/frontend/src/pages/MealReviews.jsx): `frontend/src/pages/MealReviews.jsx`
- [Staff requests](https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/frontend/src/pages/RequestSubmit.jsx): `frontend/src/pages/RequestSubmit.jsx`
- [Admin operations](https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/frontend/src/pages/Admin.jsx): `frontend/src/pages/Admin.jsx`
- [Bill approval](https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/frontend/src/pages/BillUpload.jsx): `frontend/src/pages/BillUpload.jsx`
- [Frontend API client](https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/frontend/src/lib/api.js): `frontend/src/lib/api.js`

### Application API

- [Express API server](https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/backend/src/server.js): `backend/src/server.js`
- [Meals and cafeteria routes](https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/backend/src/routes/meals.js): `backend/src/routes/meals.js`
- [Bill intake and approval](https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/backend/src/routes/bills.js): `backend/src/routes/bills.js`
- [Inventory and products](https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/backend/src/routes/inventory.js): `backend/src/routes/inventory.js`
- [Request handling](https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/backend/src/routes/requests.js): `backend/src/routes/requests.js`
- [Meal review handling](https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/backend/src/routes/mealReviews.js): `backend/src/routes/mealReviews.js`

### Pantry operations

- [Product conversion](https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/backend/src/lib/productConversion.js): `backend/src/lib/productConversion.js`
- [Purchase application](https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/backend/src/lib/applyPurchase.js): `backend/src/lib/applyPurchase.js`
- [Stock-taking](https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/backend/src/lib/stockTake.js): `backend/src/lib/stockTake.js`

### State and integrations

- [Supabase data and auth](https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/backend/src/lib/supabase.js): `backend/src/lib/supabase.js`
- [OpenAI services](https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/backend/src/lib/openai.js): `backend/src/lib/openai.js`
- [Telegram purchase workflow](https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/backend/src/routes/telegramWebhook.js): `backend/src/routes/telegramWebhook.js`
- [Meal print agent](https://github.com/tech-applywizz-git-account/snackify_inventory_tool/blob/main/print-agent/index.js): `print-agent/index.js`

### Other components

- **Employees and staff**
- **Operations admins**
- **Office receipt printer**

## Connections

- Employees and staff → Web application: use
- Operations admins → Web application: manage
- Web application → Session and profile: checks sessions
- Web application → Meal booking: routes to
- Web application → Guest meals: routes to
- Web application → Meal reviews: routes to
- Web application → Staff requests: routes to
- Web application → Admin operations: routes to
- Web application → Bill approval: routes to
- Meal booking → Frontend API client: uses
- Guest meals → Frontend API client: uses
- Meal reviews → Frontend API client: uses
- Staff requests → Frontend API client: uses
- Admin operations → Frontend API client: uses
- Bill approval → Frontend API client: uses
- Frontend API client → Express API server: calls API
- Express API server → Meals and cafeteria routes: dispatches
- Express API server → Bill intake and approval: dispatches
- Express API server → Inventory and products: dispatches
- Express API server → Request handling: dispatches
- Express API server → Meal review handling: dispatches
- Bill intake and approval → Supabase data and auth: stores bill rows
- Bill intake and approval → Product conversion: processes invoice lines
- Product conversion → Supabase data and auth: reads rules; saves results
- Product conversion → OpenAI services: classifies unmatched
- Bill intake and approval → Supabase data and auth: applies approved stock
- Inventory and products → Supabase data and auth: reads and writes stock
- Meals and cafeteria routes → Supabase data and auth: reads and writes meals
- Request handling → Supabase data and auth: stores requests
- Meal review handling → Supabase data and auth: stores reviews
- Telegram purchase workflow → OpenAI services: extracts purchases
- Telegram purchase workflow → Purchase application: applies purchase
- Telegram purchase workflow → Stock-taking: runs stock-take
- Telegram purchase workflow → Supabase data and auth: reads and writes
- Meal print agent → Supabase data and auth: reads print jobs
- Meal print agent → Office receipt printer: prints receipts
