# jamesaltamia/filsync architecture

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

- Interactive diagram: https://gitdiagram.com/jamesaltamia/filsync
- Repository: https://github.com/jamesaltamia/filsync

## Overview

This is a school canteen and retail operations system: staff sign in, then manage inventory, customers, sales/orders, reports, canteen billing, water transactions, stock-room movements, and settings. The React client routes users to these workflows and calls a Laravel API; API routes dispatch to domain controllers and services. Authentication is the clearest fully evidenced client-to-server path. Other frontend-to-API links are represented only where endpoint calls or route dispatches are visible. Several page/service and controller implementations were not sampled, so those internal relationships are omitted rather than inferred.

Main entry points: [`client/src/App.tsx`](https://github.com/jamesaltamia/filsync/blob/main/client/src/App.tsx) (Route application), [`server/routes/api.php`](https://github.com/jamesaltamia/filsync/blob/main/server/routes/api.php) (API routes), [`server/app/Models/Product.php`](https://github.com/jamesaltamia/filsync/blob/main/server/app/Models/Product.php) (Products and categories), [`server/app/Models/Order.php`](https://github.com/jamesaltamia/filsync/blob/main/server/app/Models/Order.php) (Orders and items)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["Route application<br/>[App.tsx]"]
  node_authui["Auth state<br/>[AuthContext.tsx]"]
  node_authsvc["Auth client<br/>[authService.ts]"]
  node_dashboard["Dashboard<br/>[DashboardPage.tsx]"]
  node_inventoryui["Inventory<br/>[InventoryPage.tsx]"]
  node_salesui["Sales checkout<br/>[SalesPage.tsx]"]
  node_ordersui["Order history"]
  node_customersui["Customers<br/>[CustomersPage.tsx]"]
  node_reportsui["Reports<br/>[ReportsPage.tsx]"]
  node_canteenui["Canteen<br/>[CanteenPage.tsx]"]
  node_waterui["Water station<br/>[WaterPage.tsx]"]
  node_stockui["Stock room<br/>[StockRoomPage.tsx]"]
  node_settingsui["Settings<br/>[SettingsPage.tsx]"]
end

subgraph group_server["API and operations"]
  node_api["API routes<br/>[api.php]"]
  node_authctl["Authentication<br/>[AuthController.php]"]
  node_dashboardctl["Dashboard data"]
  node_inventoryctl["Inventory management"]
  node_ordersctl["Orders and sales"]
  node_customersctl["Customer management"]
  node_reportsctl["Report generation"]
  node_canteenctl["Canteen billing"]
  node_waterctl["Water transactions"]
  node_stockctl["Stock-room operations"]
  node_settingsctl["Settings management"]
  node_inventorysvc["Inventory rules"]
  node_reportsvc["Report calculations<br/>[ReportService.php]"]
end

subgraph group_domain["Business data"]
  node_product["Products and categories<br/>[Product.php]"]
  node_order["Orders and items<br/>[Order.php]"]
  node_customer["Customer records<br/>[Customer.php]"]
  node_user["User accounts<br/>[User.php]"]
  node_stockroomdata["Stock-room records"]
end

node_staff(("Staff user"))

node_staff -->|"opens"| node_app
node_app -->|"provides auth"| node_authui
node_app -->|"routes"| node_dashboard
node_app -->|"routes"| node_inventoryui
node_app -->|"routes"| node_salesui
node_app -->|"routes"| node_ordersui
node_app -->|"routes"| node_customersui
node_app -->|"routes"| node_reportsui
node_app -->|"routes"| node_canteenui
node_app -->|"routes"| node_waterui
node_app -->|"routes"| node_stockui
node_app -->|"routes"| node_settingsui
node_authui -->|"requests auth"| node_authsvc
node_authsvc -->|"calls auth endpoints"| node_api
node_api -->|"dispatches auth"| node_authctl
node_api -->|"dispatches dashboard"| node_dashboardctl
node_api -->|"dispatches inventory"| node_inventoryctl
node_api -->|"dispatches orders"| node_ordersctl
node_api -->|"dispatches customers"| node_customersctl
node_api -->|"dispatches reports"| node_reportsctl
node_api -->|"dispatches canteen"| node_canteenctl
node_api -->|"dispatches water"| node_waterctl
node_api -->|"dispatches stock room"| node_stockctl
node_api -->|"dispatches settings"| node_settingsctl
node_authctl -->|"uses accounts"| node_user
node_inventoryctl -->|"gets low stock"| node_inventorysvc
node_inventoryctl -->|"manages products"| node_product
node_dashboardctl -->|"queries products"| node_product
node_dashboardctl -->|"queries orders"| node_order
node_customersctl -->|"manages customers"| node_customer
node_reportsctl -->|"uses calculations"| node_reportsvc
node_reportsvc -->|"queries sales"| node_order
node_inventorysvc -->|"queries stock"| node_product
node_stockctl -->|"manages stock"| node_stockroomdata
node_order -->|"relates customer"| node_customer
node_product -->|"relates order items"| node_order

click node_app "https://github.com/jamesaltamia/filsync/blob/main/client/src/App.tsx"
click node_authui "https://github.com/jamesaltamia/filsync/blob/main/client/src/contexts/AuthContext.tsx"
click node_authsvc "https://github.com/jamesaltamia/filsync/blob/main/client/src/services/authService.ts"
click node_dashboard "https://github.com/jamesaltamia/filsync/blob/main/client/src/pages/Dashboard/DashboardPage.tsx"
click node_inventoryui "https://github.com/jamesaltamia/filsync/blob/main/client/src/pages/Inventory/InventoryPage.tsx"
click node_salesui "https://github.com/jamesaltamia/filsync/blob/main/client/src/pages/Sales/SalesPage.tsx"
click node_ordersui "https://github.com/jamesaltamia/filsync/blob/main/client/src/pages/OrdersHistory/OrdersHistoryPage.tsx"
click node_customersui "https://github.com/jamesaltamia/filsync/blob/main/client/src/pages/Customers/CustomersPage.tsx"
click node_reportsui "https://github.com/jamesaltamia/filsync/blob/main/client/src/pages/Reports/ReportsPage.tsx"
click node_canteenui "https://github.com/jamesaltamia/filsync/blob/main/client/src/pages/Canteen/CanteenPage.tsx"
click node_waterui "https://github.com/jamesaltamia/filsync/blob/main/client/src/pages/WaterStation/WaterPage.tsx"
click node_stockui "https://github.com/jamesaltamia/filsync/blob/main/client/src/pages/StockRoom/StockRoomPage.tsx"
click node_settingsui "https://github.com/jamesaltamia/filsync/blob/main/client/src/pages/Settings/SettingsPage.tsx"
click node_api "https://github.com/jamesaltamia/filsync/blob/main/server/routes/api.php"
click node_authctl "https://github.com/jamesaltamia/filsync/blob/main/server/app/Http/Controllers/AuthController.php"
click node_dashboardctl "https://github.com/jamesaltamia/filsync/blob/main/server/app/Http/Controllers/DashboardController.php"
click node_inventoryctl "https://github.com/jamesaltamia/filsync/blob/main/server/app/Http/Controllers/InventoryController.php"
click node_ordersctl "https://github.com/jamesaltamia/filsync/blob/main/server/app/Http/Controllers/OrderController.php"
click node_customersctl "https://github.com/jamesaltamia/filsync/blob/main/server/app/Http/Controllers/CustomerController.php"
click node_reportsctl "https://github.com/jamesaltamia/filsync/blob/main/server/app/Http/Controllers/ReportController.php"
click node_canteenctl "https://github.com/jamesaltamia/filsync/blob/main/server/app/Http/Controllers/CanteenController.php"
click node_waterctl "https://github.com/jamesaltamia/filsync/blob/main/server/app/Http/Controllers/WaterTransactionController.php"
click node_stockctl "https://github.com/jamesaltamia/filsync/blob/main/server/app/Http/Controllers/StockRoomController.php"
click node_settingsctl "https://github.com/jamesaltamia/filsync/blob/main/server/app/Http/Controllers/SettingsController.php"
click node_inventorysvc "https://github.com/jamesaltamia/filsync/blob/main/server/app/Services/InventoryService.php"
click node_reportsvc "https://github.com/jamesaltamia/filsync/blob/main/server/app/Services/ReportService.php"
click node_product "https://github.com/jamesaltamia/filsync/blob/main/server/app/Models/Product.php"
click node_order "https://github.com/jamesaltamia/filsync/blob/main/server/app/Models/Order.php"
click node_customer "https://github.com/jamesaltamia/filsync/blob/main/server/app/Models/Customer.php"
click node_user "https://github.com/jamesaltamia/filsync/blob/main/server/app/Models/User.php"
click node_stockroomdata "https://github.com/jamesaltamia/filsync/blob/main/server/app/Models/StockRoomProduct.php"

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_authui,node_authsvc,node_dashboard,node_inventoryui,node_salesui,node_ordersui,node_customersui,node_reportsui,node_canteenui,node_waterui,node_stockui,node_settingsui,node_staff toneBlue
class node_api,node_authctl,node_dashboardctl,node_inventoryctl,node_ordersctl,node_customersctl,node_reportsctl,node_canteenctl,node_waterctl,node_stockctl,node_settingsctl,node_inventorysvc,node_reportsvc toneAmber
class node_product,node_order,node_customer,node_user,node_stockroomdata toneMint
```

## Components

### Web client

- [Route application](https://github.com/jamesaltamia/filsync/blob/main/client/src/App.tsx): `client/src/App.tsx`
- [Auth state](https://github.com/jamesaltamia/filsync/blob/main/client/src/contexts/AuthContext.tsx): `client/src/contexts/AuthContext.tsx`
- [Auth client](https://github.com/jamesaltamia/filsync/blob/main/client/src/services/authService.ts): `client/src/services/authService.ts`
- [Dashboard](https://github.com/jamesaltamia/filsync/blob/main/client/src/pages/Dashboard/DashboardPage.tsx): `client/src/pages/Dashboard/DashboardPage.tsx`
- [Inventory](https://github.com/jamesaltamia/filsync/blob/main/client/src/pages/Inventory/InventoryPage.tsx): `client/src/pages/Inventory/InventoryPage.tsx`
- [Sales checkout](https://github.com/jamesaltamia/filsync/blob/main/client/src/pages/Sales/SalesPage.tsx): `client/src/pages/Sales/SalesPage.tsx`
- [Order history](https://github.com/jamesaltamia/filsync/blob/main/client/src/pages/OrdersHistory/OrdersHistoryPage.tsx): `client/src/pages/OrdersHistory/OrdersHistoryPage.tsx`
- [Customers](https://github.com/jamesaltamia/filsync/blob/main/client/src/pages/Customers/CustomersPage.tsx): `client/src/pages/Customers/CustomersPage.tsx`
- [Reports](https://github.com/jamesaltamia/filsync/blob/main/client/src/pages/Reports/ReportsPage.tsx): `client/src/pages/Reports/ReportsPage.tsx`
- [Canteen](https://github.com/jamesaltamia/filsync/blob/main/client/src/pages/Canteen/CanteenPage.tsx): `client/src/pages/Canteen/CanteenPage.tsx`
- [Water station](https://github.com/jamesaltamia/filsync/blob/main/client/src/pages/WaterStation/WaterPage.tsx): `client/src/pages/WaterStation/WaterPage.tsx`
- [Stock room](https://github.com/jamesaltamia/filsync/blob/main/client/src/pages/StockRoom/StockRoomPage.tsx): `client/src/pages/StockRoom/StockRoomPage.tsx`
- [Settings](https://github.com/jamesaltamia/filsync/blob/main/client/src/pages/Settings/SettingsPage.tsx): `client/src/pages/Settings/SettingsPage.tsx`

### API and operations

- [API routes](https://github.com/jamesaltamia/filsync/blob/main/server/routes/api.php): `server/routes/api.php`
- [Authentication](https://github.com/jamesaltamia/filsync/blob/main/server/app/Http/Controllers/AuthController.php): `server/app/Http/Controllers/AuthController.php`
- [Dashboard data](https://github.com/jamesaltamia/filsync/blob/main/server/app/Http/Controllers/DashboardController.php): `server/app/Http/Controllers/DashboardController.php`
- [Inventory management](https://github.com/jamesaltamia/filsync/blob/main/server/app/Http/Controllers/InventoryController.php): `server/app/Http/Controllers/InventoryController.php`
- [Orders and sales](https://github.com/jamesaltamia/filsync/blob/main/server/app/Http/Controllers/OrderController.php): `server/app/Http/Controllers/OrderController.php`
- [Customer management](https://github.com/jamesaltamia/filsync/blob/main/server/app/Http/Controllers/CustomerController.php): `server/app/Http/Controllers/CustomerController.php`
- [Report generation](https://github.com/jamesaltamia/filsync/blob/main/server/app/Http/Controllers/ReportController.php): `server/app/Http/Controllers/ReportController.php`
- [Canteen billing](https://github.com/jamesaltamia/filsync/blob/main/server/app/Http/Controllers/CanteenController.php): `server/app/Http/Controllers/CanteenController.php`
- [Water transactions](https://github.com/jamesaltamia/filsync/blob/main/server/app/Http/Controllers/WaterTransactionController.php): `server/app/Http/Controllers/WaterTransactionController.php`
- [Stock-room operations](https://github.com/jamesaltamia/filsync/blob/main/server/app/Http/Controllers/StockRoomController.php): `server/app/Http/Controllers/StockRoomController.php`
- [Settings management](https://github.com/jamesaltamia/filsync/blob/main/server/app/Http/Controllers/SettingsController.php): `server/app/Http/Controllers/SettingsController.php`
- [Inventory rules](https://github.com/jamesaltamia/filsync/blob/main/server/app/Services/InventoryService.php): `server/app/Services/InventoryService.php`
- [Report calculations](https://github.com/jamesaltamia/filsync/blob/main/server/app/Services/ReportService.php): `server/app/Services/ReportService.php`

### Business data

- [Products and categories](https://github.com/jamesaltamia/filsync/blob/main/server/app/Models/Product.php): `server/app/Models/Product.php`
- [Orders and items](https://github.com/jamesaltamia/filsync/blob/main/server/app/Models/Order.php): `server/app/Models/Order.php`
- [Customer records](https://github.com/jamesaltamia/filsync/blob/main/server/app/Models/Customer.php): `server/app/Models/Customer.php`
- [User accounts](https://github.com/jamesaltamia/filsync/blob/main/server/app/Models/User.php): `server/app/Models/User.php`
- [Stock-room records](https://github.com/jamesaltamia/filsync/blob/main/server/app/Models/StockRoomProduct.php): `server/app/Models/StockRoomProduct.php`

### Other components

- **Staff user**

## Connections

- Staff user → Route application: opens (evidence: `client/src/App.tsx`)
- Route application → Auth state: provides auth (evidence: `client/src/App.tsx`)
- Route application → Dashboard: routes (evidence: `client/src/App.tsx`)
- Route application → Inventory: routes (evidence: `client/src/App.tsx`)
- Route application → Sales checkout: routes (evidence: `client/src/App.tsx`)
- Route application → Order history: routes (evidence: `client/src/App.tsx`)
- Route application → Customers: routes (evidence: `client/src/App.tsx`)
- Route application → Reports: routes (evidence: `client/src/App.tsx`)
- Route application → Canteen: routes (evidence: `client/src/App.tsx`)
- Route application → Water station: routes (evidence: `client/src/App.tsx`)
- Route application → Stock room: routes (evidence: `client/src/App.tsx`)
- Route application → Settings: routes (evidence: `client/src/App.tsx`)
- Auth state → Auth client: requests auth (evidence: `client/src/contexts/AuthContext.tsx`)
- Auth client → API routes: calls auth endpoints (evidence: `client/src/services/authService.ts`)
- API routes → Authentication: dispatches auth (evidence: `server/routes/api.php`)
- API routes → Dashboard data: dispatches dashboard (evidence: `server/routes/api.php`)
- API routes → Inventory management: dispatches inventory (evidence: `server/routes/api.php`)
- API routes → Orders and sales: dispatches orders (evidence: `server/routes/api.php`)
- API routes → Customer management: dispatches customers (evidence: `server/routes/api.php`)
- API routes → Report generation: dispatches reports (evidence: `server/routes/api.php`)
- API routes → Canteen billing: dispatches canteen (evidence: `server/routes/api.php`)
- API routes → Water transactions: dispatches water (evidence: `server/routes/api.php`)
- API routes → Stock-room operations: dispatches stock room (evidence: `server/routes/api.php`)
- API routes → Settings management: dispatches settings (evidence: `server/routes/api.php`)
- Authentication → User accounts: uses accounts (evidence: `server/app/Http/Controllers/AuthController.php`)
- Inventory management → Inventory rules: gets low stock (evidence: `server/app/Http/Controllers/InventoryController.php`)
- Inventory management → Products and categories: manages products (evidence: `server/app/Http/Controllers/InventoryController.php`)
- Dashboard data → Products and categories: queries products (evidence: `server/app/Http/Controllers/DashboardController.php`)
- Dashboard data → Orders and items: queries orders (evidence: `server/app/Http/Controllers/DashboardController.php`)
- Customer management → Customer records: manages customers (evidence: `server/app/Http/Controllers/CustomerController.php`)
- Report generation → Report calculations: uses calculations (evidence: `server/app/Http/Controllers/ReportController.php`)
- Report calculations → Orders and items: queries sales (evidence: `server/app/Services/ReportService.php`)
- Inventory rules → Products and categories: queries stock (evidence: `server/app/Services/InventoryService.php`)
- Stock-room operations → Stock-room records: manages stock (evidence: `server/app/Http/Controllers/StockRoomController.php`)
- Orders and items → Customer records: relates customer (evidence: `server/app/Models/Order.php`)
- Products and categories → Orders and items: relates order items (evidence: `server/app/Models/Product.php`)
