# akumaaa5012/webte architecture

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

- Interactive diagram: https://gitdiagram.com/akumaaa5012/webte
- Repository: https://github.com/akumaaa5012/webte

## Overview

SproutRoute appears to be a role-based farm-to-restaurant ordering and delivery application. The likely user journey is restaurant ordering, farm fulfillment, and logistics delivery, with recurring schedules, stock management, notifications, and dashboards as supporting capabilities. The README excerpt is an academic declaration rather than product documentation, so capabilities and connections are inferred cautiously from the file tree and SOURCE INDEX; unsampled endpoints are represented at their existing directories.

Main entry points: [`api/orders/create.php`](https://github.com/akumaaa5012/webte/blob/main/api/orders/create.php) (Order management), [`api/helpers.php`](https://github.com/akumaaa5012/webte/blob/main/api/helpers.php) (Domain helpers), [`api/deliveries`](https://github.com/akumaaa5012/webte/tree/main/api/deliveries) (Delivery lifecycle), [`api/summary.php`](https://github.com/akumaaa5012/webte/blob/main/api/summary.php) (Dashboard summaries)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web clients"]
  node_buyer["Buyer portal<br/>[buyer.js]"]
  node_buyer_orders["Buyer orders<br/>[buyer-orders.js]"]
  node_seller["Seller portal<br/>[seller.js]"]
  node_logistics_ui["Logistics portal<br/>[logistics.js]"]
  node_app["Shared app client<br/>[app.js]"]
  node_offline[("Offline browser store<br/>[offline-db.js]")]
  node_service_worker["Service worker<br/>[sw.js]"]
end

subgraph group_commerce["Marketplace operations"]
  node_catalog["Farm product catalog"]
  node_categories_farms["Farm and category management"]
  node_orders["Order management<br/>[create.php]"]
  node_schedules["Recurring schedules<br/>[functions.php]"]
  node_stock["Stock rules<br/>[stock_rules.php]"]
  node_dashboard["Dashboard summaries<br/>[summary.php]"]
end

subgraph group_fulfillment["Delivery operations"]
  node_deliveries["Delivery lifecycle"]
  node_delivery_rules["Delivery rules"]
  node_providers["Logistics providers"]
  node_provider_validation["Provider validation"]
end

subgraph group_platform["Shared services"]
  node_auth["Authentication<br/>[login.php]"]
  node_common["API common services<br/>[common.php]"]
  node_helpers["Domain helpers<br/>[helpers.php]"]
  node_database[("Application database<br/>[db.php]")]
  node_notifications["Notifications"]
end

node_users(("Role-based users"))

node_users -.->|"uses"| node_buyer
node_users -.->|"uses"| node_seller
node_users -.->|"uses"| node_logistics_ui
node_buyer -.->|"opens"| node_buyer_orders
node_app -.->|"uses"| node_offline
node_app -.->|"registers"| node_service_worker
node_users -.->|"authenticates"| node_auth
node_auth -->|"requires"| node_common
node_common -->|"connects"| node_database
node_helpers -->|"queries"| node_database
node_buyer_orders -.->|"submits orders"| node_orders
node_seller -.->|"manages products"| node_catalog
node_seller -.->|"handles orders"| node_orders
node_orders -->|"uses"| node_helpers
node_orders -.->|"persists orders"| node_database
node_schedules -->|"uses"| node_helpers
node_schedules -.->|"creates deliveries"| node_orders
node_orders -->|"deducts stock"| node_stock
node_dashboard -->|"uses"| node_helpers
node_dashboard -->|"uses"| node_delivery_rules
node_dashboard -->|"uses"| node_stock
node_logistics_ui -.->|"updates deliveries"| node_deliveries
node_deliveries -->|"uses"| node_helpers
node_deliveries -->|"uses"| node_delivery_rules
node_deliveries -->|"updates order status"| node_orders
node_deliveries -.->|"assigns providers"| node_providers
node_providers -->|"validates with"| node_provider_validation
node_notifications -->|"uses"| node_helpers
node_notifications -->|"checks rules"| node_stock

click node_buyer "https://github.com/akumaaa5012/webte/blob/main/scripts/buyer.js"
click node_buyer_orders "https://github.com/akumaaa5012/webte/blob/main/scripts/buyer-orders.js"
click node_seller "https://github.com/akumaaa5012/webte/blob/main/scripts/seller.js"
click node_logistics_ui "https://github.com/akumaaa5012/webte/blob/main/scripts/logistics.js"
click node_app "https://github.com/akumaaa5012/webte/blob/main/scripts/app.js"
click node_offline "https://github.com/akumaaa5012/webte/blob/main/scripts/offline-db.js"
click node_service_worker "https://github.com/akumaaa5012/webte/blob/main/sw.js"
click node_auth "https://github.com/akumaaa5012/webte/blob/main/api/auth/login.php"
click node_common "https://github.com/akumaaa5012/webte/blob/main/api/common.php"
click node_helpers "https://github.com/akumaaa5012/webte/blob/main/api/helpers.php"
click node_database "https://github.com/akumaaa5012/webte/blob/main/api/db.php"
click node_catalog "https://github.com/akumaaa5012/webte/tree/main/api/products"
click node_categories_farms "https://github.com/akumaaa5012/webte/tree/main/api/farms"
click node_orders "https://github.com/akumaaa5012/webte/blob/main/api/orders/create.php"
click node_schedules "https://github.com/akumaaa5012/webte/blob/main/api/schedules/functions.php"
click node_stock "https://github.com/akumaaa5012/webte/blob/main/api/stock_rules.php"
click node_dashboard "https://github.com/akumaaa5012/webte/blob/main/api/summary.php"
click node_deliveries "https://github.com/akumaaa5012/webte/tree/main/api/deliveries"
click node_delivery_rules "https://github.com/akumaaa5012/webte/blob/main/api/deliveries/delivery_helpers.php"
click node_providers "https://github.com/akumaaa5012/webte/tree/main/api/logistics_providers"
click node_provider_validation "https://github.com/akumaaa5012/webte/blob/main/api/logistics_providers/validate_provider.php"
click node_notifications "https://github.com/akumaaa5012/webte/tree/main/api/notifications"

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_buyer,node_buyer_orders,node_seller,node_logistics_ui,node_app,node_offline,node_service_worker,node_users toneBlue
class node_catalog,node_categories_farms,node_orders,node_schedules,node_stock,node_dashboard toneAmber
class node_deliveries,node_delivery_rules,node_providers,node_provider_validation toneMint
class node_auth,node_common,node_helpers,node_database,node_notifications toneRose
```

## Components

### Web clients

- [Buyer portal](https://github.com/akumaaa5012/webte/blob/main/scripts/buyer.js): `scripts/buyer.js`
- [Buyer orders](https://github.com/akumaaa5012/webte/blob/main/scripts/buyer-orders.js): `scripts/buyer-orders.js`
- [Seller portal](https://github.com/akumaaa5012/webte/blob/main/scripts/seller.js): `scripts/seller.js`
- [Logistics portal](https://github.com/akumaaa5012/webte/blob/main/scripts/logistics.js): `scripts/logistics.js`
- [Shared app client](https://github.com/akumaaa5012/webte/blob/main/scripts/app.js): `scripts/app.js`
- [Offline browser store](https://github.com/akumaaa5012/webte/blob/main/scripts/offline-db.js): `scripts/offline-db.js`
- [Service worker](https://github.com/akumaaa5012/webte/blob/main/sw.js): `sw.js`

### Marketplace operations

- [Farm product catalog](https://github.com/akumaaa5012/webte/tree/main/api/products): `api/products`
- [Farm and category management](https://github.com/akumaaa5012/webte/tree/main/api/farms): `api/farms`
- [Order management](https://github.com/akumaaa5012/webte/blob/main/api/orders/create.php): `api/orders/create.php`
- [Recurring schedules](https://github.com/akumaaa5012/webte/blob/main/api/schedules/functions.php): `api/schedules/functions.php`
- [Stock rules](https://github.com/akumaaa5012/webte/blob/main/api/stock_rules.php): `api/stock_rules.php`
- [Dashboard summaries](https://github.com/akumaaa5012/webte/blob/main/api/summary.php): `api/summary.php`

### Delivery operations

- [Delivery lifecycle](https://github.com/akumaaa5012/webte/tree/main/api/deliveries): `api/deliveries`
- [Delivery rules](https://github.com/akumaaa5012/webte/blob/main/api/deliveries/delivery_helpers.php): `api/deliveries/delivery_helpers.php`
- [Logistics providers](https://github.com/akumaaa5012/webte/tree/main/api/logistics_providers): `api/logistics_providers`
- [Provider validation](https://github.com/akumaaa5012/webte/blob/main/api/logistics_providers/validate_provider.php): `api/logistics_providers/validate_provider.php`

### Shared services

- [Authentication](https://github.com/akumaaa5012/webte/blob/main/api/auth/login.php): `api/auth/login.php`
- [API common services](https://github.com/akumaaa5012/webte/blob/main/api/common.php): `api/common.php`
- [Domain helpers](https://github.com/akumaaa5012/webte/blob/main/api/helpers.php): `api/helpers.php`
- [Application database](https://github.com/akumaaa5012/webte/blob/main/api/db.php): `api/db.php`
- [Notifications](https://github.com/akumaaa5012/webte/tree/main/api/notifications): `api/notifications`

### Other components

- **Role-based users**

## Connections

- Role-based users → Buyer portal: uses
- Role-based users → Seller portal: uses
- Role-based users → Logistics portal: uses
- Buyer portal → Buyer orders: opens
- Shared app client → Offline browser store: uses
- Shared app client → Service worker: registers
- Role-based users → Authentication: authenticates
- Authentication → API common services: requires (evidence: `api/auth/login.php`)
- API common services → Application database: connects (evidence: `api/common.php`)
- Domain helpers → Application database: queries (evidence: `api/helpers.php`)
- Buyer orders → Order management: submits orders
- Seller portal → Farm product catalog: manages products
- Seller portal → Order management: handles orders
- Order management → Domain helpers: uses (evidence: `api/orders/create.php`)
- Order management → Application database: persists orders
- Recurring schedules → Domain helpers: uses (evidence: `api/schedules/functions.php`)
- Recurring schedules → Order management: creates deliveries
- Order management → Stock rules: deducts stock
- Dashboard summaries → Domain helpers: uses (evidence: `api/summary.php`)
- Dashboard summaries → Delivery rules: uses (evidence: `api/summary.php`)
- Dashboard summaries → Stock rules: uses (evidence: `api/summary.php`)
- Logistics portal → Delivery lifecycle: updates deliveries
- Delivery lifecycle → Domain helpers: uses (evidence: `api/deliveries/update_status.php`)
- Delivery lifecycle → Delivery rules: uses (evidence: `api/deliveries/update_status.php`)
- Delivery lifecycle → Order management: updates order status (evidence: `api/deliveries/update_status.php`)
- Delivery lifecycle → Logistics providers: assigns providers
- Logistics providers → Provider validation: validates with (evidence: `api/logistics_providers/read.php`)
- Notifications → Domain helpers: uses (evidence: `api/notifications/status_changes.php`)
- Notifications → Stock rules: checks rules (evidence: `api/notifications/low_stock.php`)
