# hazim47/delivery-accounting architecture

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

- Interactive diagram: https://gitdiagram.com/hazim47/delivery-accounting
- Repository: https://github.com/hazim47/delivery-accounting

## Overview

This repository implements a delivery-accounting application: staff import order spreadsheets, review and manage statements, and access restaurant, daily-report, dashboard, and settlement views. The frontend routes these workflows to an Express API backed by Sequelize/PostgreSQL. The import handler and statement/restaurant controllers show key data operations; other dashboard and settlement capabilities are documented by route/controller names, but their internal wiring is not sampled, so those links are kept at the API boundary.

Main entry points: [`delivery-accounting-frontend/src/App.jsx`](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-frontend/src/App.jsx) (Web routes), [`delivery-accounting-backend/src/controllers/importController.js`](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/controllers/importController.js) (Spreadsheet import), [`delivery-accounting-frontend/src/api/axios.js`](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-frontend/src/api/axios.js) (HTTP client), [`delivery-accounting-backend/src/app.js`](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/app.js) (Express API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web application"]
  node_web["Web routes<br/>[App.jsx]"]
  node_import_page["Order import<br/>[ImportOrders.jsx]"]
  node_statements_page["Statements<br/>[Statements.jsx]"]
  node_statement_detail["Statement review"]
  node_restaurant_page["Restaurant views<br/>[Restaurants.jsx]"]
  node_restaurant_detail["Restaurant detail"]
  node_reports_page["Daily reports<br/>[DailyReports.jsx]"]
  node_dashboard_page["Dashboard<br/>[Dashboard.jsx]"]
  node_api_client["HTTP client<br/>[axios.js]"]
end

subgraph group_api["API and access"]
  node_api_app["Express API<br/>[app.js]"]
  node_import_routes["Import routes<br/>[importRoutes.js]"]
  node_statement_routes["Statement routes<br/>[statementRoutes.js]"]
  node_restaurant_routes["Restaurant routes"]
  node_other_routes["Other API routes"]
end

subgraph group_accounting["Accounting workflows"]
  node_import_controller["Spreadsheet import"]
  node_statement_controller["Statement management"]
  node_restaurant_controller["Restaurant accounting"]
  node_daily_service["Daily report aggregation"]
  node_accounting_controllers["Other accounting controllers"]
end

subgraph group_data["Persistence"]
  node_db_config["Database connection<br/>[database.js]"]
  node_order_model[("Orders<br/>[Order.js]")]
  node_import_log_model[("Import records<br/>[ImportLog.js]")]
  node_restaurant_model[("Restaurants<br/>[Restaurant.js]")]
  node_driver_model[("Drivers<br/>[Driver.js]")]
  node_daily_model[("Daily reports<br/>[DailyReport.js]")]
end

node_staff(("Accounting staff"))
node_postgres[("PostgreSQL")]

node_staff -->|"uses"| node_web
node_web -->|"routes to"| node_import_page
node_web -->|"routes to"| node_statements_page
node_web -->|"routes to"| node_statement_detail
node_web -->|"routes to"| node_restaurant_page
node_web -->|"routes to"| node_restaurant_detail
node_web -->|"routes to"| node_reports_page
node_web -->|"routes to"| node_dashboard_page
node_import_page -->|"requests"| node_api_client
node_statements_page -->|"requests"| node_api_client
node_statement_detail -->|"requests"| node_api_client
node_restaurant_page -->|"requests"| node_api_client
node_restaurant_detail -->|"requests"| node_api_client
node_reports_page -->|"requests"| node_api_client
node_dashboard_page -->|"requests"| node_api_client
node_api_client -->|"HTTP calls"| node_api_app
node_api_app -->|"mounts"| node_import_routes
node_api_app -->|"mounts"| node_statement_routes
node_api_app -->|"mounts"| node_restaurant_routes
node_api_app -->|"mounts"| node_other_routes
node_import_routes -->|"dispatches"| node_import_controller
node_statement_routes -->|"dispatches"| node_statement_controller
node_restaurant_routes -->|"dispatches"| node_restaurant_controller
node_other_routes -->|"dispatches"| node_accounting_controllers
node_import_controller -->|"opens transaction"| node_db_config
node_import_controller -->|"creates and updates"| node_import_log_model
node_import_controller -->|"bulk inserts"| node_order_model
node_import_controller -->|"reads and creates"| node_restaurant_model
node_import_controller -->|"reads and updates"| node_driver_model
node_import_controller -->|"generates reports"| node_daily_service
node_daily_service -->|"reads and writes"| node_daily_model
node_statement_controller -->|"reads and edits"| node_order_model
node_statement_controller -->|"reads and updates"| node_import_log_model
node_restaurant_controller -->|"reads and writes"| node_restaurant_model
node_restaurant_controller -->|"queries orders"| node_order_model
node_order_model -->|"persists"| node_postgres
node_import_log_model -->|"persists"| node_postgres
node_restaurant_model -->|"persists"| node_postgres
node_driver_model -->|"persists"| node_postgres
node_daily_model -->|"persists"| node_postgres

click node_web "https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-frontend/src/App.jsx"
click node_import_page "https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-frontend/src/pages/ImportOrders.jsx"
click node_statements_page "https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-frontend/src/pages/Statements.jsx"
click node_statement_detail "https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-frontend/src/pages/StatementDetails.jsx"
click node_restaurant_page "https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-frontend/src/pages/Restaurants.jsx"
click node_restaurant_detail "https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-frontend/src/pages/RestaurantDetails.jsx"
click node_reports_page "https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-frontend/src/pages/DailyReports.jsx"
click node_dashboard_page "https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-frontend/src/pages/Dashboard.jsx"
click node_api_client "https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-frontend/src/api/axios.js"
click node_api_app "https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/app.js"
click node_import_routes "https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/routes/importRoutes.js"
click node_statement_routes "https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/routes/statementRoutes.js"
click node_restaurant_routes "https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/routes/restaurantRoutes.js"
click node_import_controller "https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/controllers/importController.js"
click node_statement_controller "https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/controllers/statementController.js"
click node_restaurant_controller "https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/controllers/restaurantController.js"
click node_daily_service "https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/services/dailyReportService.js"
click node_other_routes "https://github.com/hazim47/delivery-accounting/tree/main/delivery-accounting-backend/src/routes"
click node_accounting_controllers "https://github.com/hazim47/delivery-accounting/tree/main/delivery-accounting-backend/src/controllers"
click node_db_config "https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/config/database.js"
click node_order_model "https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/models/Order.js"
click node_import_log_model "https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/models/ImportLog.js"
click node_restaurant_model "https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/models/Restaurant.js"
click node_driver_model "https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/models/Driver.js"
click node_daily_model "https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/models/DailyReport.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_web,node_import_page,node_statements_page,node_statement_detail,node_restaurant_page,node_restaurant_detail,node_reports_page,node_dashboard_page,node_api_client toneBlue
class node_api_app,node_import_routes,node_statement_routes,node_restaurant_routes,node_other_routes,node_postgres toneAmber
class node_import_controller,node_statement_controller,node_restaurant_controller,node_daily_service,node_accounting_controllers toneMint
class node_db_config,node_order_model,node_import_log_model,node_restaurant_model,node_driver_model,node_daily_model toneRose
class node_staff toneIndigo
```

## Components

### Web application

- [Web routes](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-frontend/src/App.jsx): `delivery-accounting-frontend/src/App.jsx`
- [Order import](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-frontend/src/pages/ImportOrders.jsx): `delivery-accounting-frontend/src/pages/ImportOrders.jsx`
- [Statements](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-frontend/src/pages/Statements.jsx): `delivery-accounting-frontend/src/pages/Statements.jsx`
- [Statement review](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-frontend/src/pages/StatementDetails.jsx): `delivery-accounting-frontend/src/pages/StatementDetails.jsx`
- [Restaurant views](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-frontend/src/pages/Restaurants.jsx): `delivery-accounting-frontend/src/pages/Restaurants.jsx`
- [Restaurant detail](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-frontend/src/pages/RestaurantDetails.jsx): `delivery-accounting-frontend/src/pages/RestaurantDetails.jsx`
- [Daily reports](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-frontend/src/pages/DailyReports.jsx): `delivery-accounting-frontend/src/pages/DailyReports.jsx`
- [Dashboard](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-frontend/src/pages/Dashboard.jsx): `delivery-accounting-frontend/src/pages/Dashboard.jsx`
- [HTTP client](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-frontend/src/api/axios.js): `delivery-accounting-frontend/src/api/axios.js`

### API and access

- [Express API](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/app.js): `delivery-accounting-backend/src/app.js`
- [Import routes](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/routes/importRoutes.js): `delivery-accounting-backend/src/routes/importRoutes.js`
- [Statement routes](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/routes/statementRoutes.js): `delivery-accounting-backend/src/routes/statementRoutes.js`
- [Restaurant routes](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/routes/restaurantRoutes.js): `delivery-accounting-backend/src/routes/restaurantRoutes.js`
- [Other API routes](https://github.com/hazim47/delivery-accounting/tree/main/delivery-accounting-backend/src/routes): `delivery-accounting-backend/src/routes`

### Accounting workflows

- [Spreadsheet import](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/controllers/importController.js): `delivery-accounting-backend/src/controllers/importController.js`
- [Statement management](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/controllers/statementController.js): `delivery-accounting-backend/src/controllers/statementController.js`
- [Restaurant accounting](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/controllers/restaurantController.js): `delivery-accounting-backend/src/controllers/restaurantController.js`
- [Daily report aggregation](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/services/dailyReportService.js): `delivery-accounting-backend/src/services/dailyReportService.js`
- [Other accounting controllers](https://github.com/hazim47/delivery-accounting/tree/main/delivery-accounting-backend/src/controllers): `delivery-accounting-backend/src/controllers`

### Persistence

- [Database connection](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/config/database.js): `delivery-accounting-backend/src/config/database.js`
- [Orders](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/models/Order.js): `delivery-accounting-backend/src/models/Order.js`
- [Import records](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/models/ImportLog.js): `delivery-accounting-backend/src/models/ImportLog.js`
- [Restaurants](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/models/Restaurant.js): `delivery-accounting-backend/src/models/Restaurant.js`
- [Drivers](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/models/Driver.js): `delivery-accounting-backend/src/models/Driver.js`
- [Daily reports](https://github.com/hazim47/delivery-accounting/blob/main/delivery-accounting-backend/src/models/DailyReport.js): `delivery-accounting-backend/src/models/DailyReport.js`

### Other components

- **Accounting staff**
- **PostgreSQL**

## Connections

- Accounting staff → Web routes: uses
- Web routes → Order import: routes to
- Web routes → Statements: routes to
- Web routes → Statement review: routes to
- Web routes → Restaurant views: routes to
- Web routes → Restaurant detail: routes to
- Web routes → Daily reports: routes to
- Web routes → Dashboard: routes to
- Order import → HTTP client: requests
- Statements → HTTP client: requests
- Statement review → HTTP client: requests
- Restaurant views → HTTP client: requests
- Restaurant detail → HTTP client: requests
- Daily reports → HTTP client: requests
- Dashboard → HTTP client: requests
- HTTP client → Express API: HTTP calls
- Express API → Import routes: mounts
- Express API → Statement routes: mounts
- Express API → Restaurant routes: mounts
- Express API → Other API routes: mounts
- Import routes → Spreadsheet import: dispatches
- Statement routes → Statement management: dispatches
- Restaurant routes → Restaurant accounting: dispatches
- Other API routes → Other accounting controllers: dispatches
- Spreadsheet import → Database connection: opens transaction
- Spreadsheet import → Import records: creates and updates
- Spreadsheet import → Orders: bulk inserts
- Spreadsheet import → Restaurants: reads and creates
- Spreadsheet import → Drivers: reads and updates
- Spreadsheet import → Daily report aggregation: generates reports
- Daily report aggregation → Daily reports: reads and writes
- Statement management → Orders: reads and edits
- Statement management → Import records: reads and updates
- Restaurant accounting → Restaurants: reads and writes
- Restaurant accounting → Orders: queries orders
- Orders → PostgreSQL: persists
- Import records → PostgreSQL: persists
- Restaurants → PostgreSQL: persists
- Drivers → PostgreSQL: persists
- Daily reports → PostgreSQL: persists
