# haimni/freshflow-b2b-ordering-platform architecture

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

- Interactive diagram: https://gitdiagram.com/haimni/freshflow-b2b-ordering-platform
- Repository: https://github.com/haimni/freshflow-b2b-ordering-platform

## Overview

FreshFlow is a B2B ordering platform with a React client and FastAPI backend. The intended customer journey spans registration or login, customer catalog access, order placement and order history; administrators have catalog, inventory and order-management areas. The tree identifies these domain areas, but most page, route and service implementations were not sampled, so uncertain call wiring is omitted. The sampled authentication flow and application/router setup support the explicit connections shown.

Main entry points: [`server/app/api/v1/router.py`](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/api/v1/router.py) (Versioned router), [`server/app/api/v1/routes/auth.py`](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/api/v1/routes/auth.py) (Auth routes), [`client/src/api/http.ts`](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/api/http.ts) (HTTP transport), [`client/src/App.tsx`](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/App.tsx) (App shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["App shell<br/>[App.tsx]"]
  node_home["Home and auth UI<br/>[HomePage.tsx]"]
  node_dashboard["Role dashboard<br/>[DashboardPage.tsx]"]
  node_customer_catalog_ui["Customer catalog"]
  node_customer_orders_ui["Customer orders"]
  node_cart["Cart panel<br/>[CartPanel.tsx]"]
  node_admin_catalog_ui["Admin catalog"]
  node_admin_inventory_ui["Admin inventory"]
  node_admin_orders_ui["Admin orders"]
  node_client_auth["Auth API client<br/>[auth.ts]"]
  node_client_catalog["Catalog API clients<br/>[customerCatalog.ts]"]
  node_client_orders["Order API clients<br/>[customerOrders.ts]"]
  node_client_admin["Admin API clients<br/>[adminCatalog.ts]"]
  node_client_http["HTTP transport<br/>[http.ts]"]
end

subgraph group_backend["API backend"]
  node_server["FastAPI application<br/>[main.py]"]
  node_router["Versioned router<br/>[router.py]"]
  node_auth_routes["Auth routes<br/>[auth.py]"]
  node_customer_routes["Customer routes"]
  node_order_routes["Order routes<br/>[customer_orders.py]"]
  node_admin_routes["Admin routes"]
end

subgraph group_domain["Domain services"]
  node_auth_service["Authentication<br/>[auth.py]"]
  node_registration["Customer registration<br/>[registration.py]"]
  node_catalog_service["Catalog services"]
  node_orders_service["Order services<br/>[orders.py]"]
  node_inventory_service["Inventory services<br/>[inventory.py]"]
  node_admin_catalog_service["Admin catalog services<br/>[admin_catalog.py]"]
  node_admin_orders_service["Admin order services<br/>[admin_orders.py]"]
end

subgraph group_data["Identity and data"]
  node_auth_deps["Auth and roles<br/>[auth.py]"]
  node_security["Token security<br/>[security.py]"]
  node_db_session["DB sessions<br/>[session.py]"]
  node_models["Domain models"]
  node_database[("SQL database")]
end

node_user(("Customer or admin"))
node_api_service{{"API service"}}

node_user -->|"uses"| node_app
node_app -->|"shows"| node_home
node_app -->|"shows"| node_dashboard
node_app -->|"restores session"| node_client_auth
node_client_auth -->|"requests"| node_client_http
node_client_catalog -->|"requests"| node_client_http
node_client_orders -->|"requests"| node_client_http
node_client_admin -->|"requests"| node_client_http
node_client_http -->|"HTTP"| node_api_service
node_server -->|"mounts"| node_router
node_router -->|"dispatches"| node_auth_routes
node_router -->|"dispatches"| node_customer_routes
node_router -->|"dispatches"| node_order_routes
node_router -->|"dispatches"| node_admin_routes
node_api_service -->|"serves requests"| node_server
node_auth_routes -->|"authenticates"| node_auth_service
node_auth_routes -->|"registers customer"| node_registration
node_auth_routes -->|"creates token"| node_security
node_auth_routes -->|"requires user"| node_auth_deps
node_auth_service -->|"queries through"| node_db_session
node_auth_service -->|"verifies password"| node_security
node_auth_deps -->|"decodes token"| node_security
node_auth_deps -->|"loads user"| node_db_session
node_db_session -->|"connects"| node_database
node_models -->|"maps entities"| node_database

click node_app "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/App.tsx"
click node_home "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/pages/HomePage.tsx"
click node_dashboard "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/pages/DashboardPage.tsx"
click node_customer_catalog_ui "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/pages/CustomerCatalogPage.tsx"
click node_customer_orders_ui "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/pages/CustomerOrdersPage.tsx"
click node_cart "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/components/CartPanel.tsx"
click node_admin_catalog_ui "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/pages/AdminCatalogPage.tsx"
click node_admin_inventory_ui "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/pages/AdminInventoryPage.tsx"
click node_admin_orders_ui "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/pages/AdminOrdersPage.tsx"
click node_client_auth "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/api/auth.ts"
click node_client_catalog "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/api/customerCatalog.ts"
click node_client_orders "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/api/customerOrders.ts"
click node_client_admin "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/api/adminCatalog.ts"
click node_client_http "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/api/http.ts"
click node_server "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/main.py"
click node_router "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/api/v1/router.py"
click node_auth_routes "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/api/v1/routes/auth.py"
click node_customer_routes "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/api/v1/routes/customer_catalog.py"
click node_order_routes "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/api/v1/routes/customer_orders.py"
click node_admin_routes "https://github.com/haimni/freshflow-b2b-ordering-platform/tree/main/server/app/api/v1/routes"
click node_auth_service "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/services/auth.py"
click node_registration "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/services/registration.py"
click node_catalog_service "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/services/customer_catalog.py"
click node_orders_service "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/services/orders.py"
click node_inventory_service "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/services/inventory.py"
click node_admin_catalog_service "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/services/admin_catalog.py"
click node_admin_orders_service "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/services/admin_orders.py"
click node_auth_deps "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/deps/auth.py"
click node_security "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/core/security.py"
click node_db_session "https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/db/session.py"
click node_models "https://github.com/haimni/freshflow-b2b-ordering-platform/tree/main/server/app/models"

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_dashboard,node_customer_catalog_ui,node_customer_orders_ui,node_cart,node_admin_catalog_ui,node_admin_inventory_ui,node_admin_orders_ui,node_client_auth,node_client_catalog,node_client_orders,node_client_admin,node_client_http toneBlue
class node_server,node_router,node_auth_routes,node_customer_routes,node_order_routes,node_admin_routes toneAmber
class node_auth_service,node_registration,node_catalog_service,node_orders_service,node_inventory_service,node_admin_catalog_service,node_admin_orders_service,node_api_service toneMint
class node_auth_deps,node_security,node_db_session,node_models,node_database toneRose
class node_user toneIndigo
```

## Components

### Web client

- [App shell](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/App.tsx): `client/src/App.tsx`
- [Home and auth UI](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/pages/HomePage.tsx): `client/src/pages/HomePage.tsx`
- [Role dashboard](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/pages/DashboardPage.tsx): `client/src/pages/DashboardPage.tsx`
- [Customer catalog](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/pages/CustomerCatalogPage.tsx): `client/src/pages/CustomerCatalogPage.tsx`
- [Customer orders](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/pages/CustomerOrdersPage.tsx): `client/src/pages/CustomerOrdersPage.tsx`
- [Cart panel](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/components/CartPanel.tsx): `client/src/components/CartPanel.tsx`
- [Admin catalog](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/pages/AdminCatalogPage.tsx): `client/src/pages/AdminCatalogPage.tsx`
- [Admin inventory](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/pages/AdminInventoryPage.tsx): `client/src/pages/AdminInventoryPage.tsx`
- [Admin orders](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/pages/AdminOrdersPage.tsx): `client/src/pages/AdminOrdersPage.tsx`
- [Auth API client](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/api/auth.ts): `client/src/api/auth.ts`
- [Catalog API clients](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/api/customerCatalog.ts): `client/src/api/customerCatalog.ts`
- [Order API clients](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/api/customerOrders.ts): `client/src/api/customerOrders.ts`
- [Admin API clients](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/api/adminCatalog.ts): `client/src/api/adminCatalog.ts`
- [HTTP transport](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/client/src/api/http.ts): `client/src/api/http.ts`

### API backend

- [FastAPI application](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/main.py): `server/app/main.py`
- [Versioned router](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/api/v1/router.py): `server/app/api/v1/router.py`
- [Auth routes](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/api/v1/routes/auth.py): `server/app/api/v1/routes/auth.py`
- [Customer routes](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/api/v1/routes/customer_catalog.py): `server/app/api/v1/routes/customer_catalog.py`
- [Order routes](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/api/v1/routes/customer_orders.py): `server/app/api/v1/routes/customer_orders.py`
- [Admin routes](https://github.com/haimni/freshflow-b2b-ordering-platform/tree/main/server/app/api/v1/routes): `server/app/api/v1/routes`

### Domain services

- [Authentication](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/services/auth.py): `server/app/services/auth.py`
- [Customer registration](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/services/registration.py): `server/app/services/registration.py`
- [Catalog services](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/services/customer_catalog.py): `server/app/services/customer_catalog.py`
- [Order services](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/services/orders.py): `server/app/services/orders.py`
- [Inventory services](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/services/inventory.py): `server/app/services/inventory.py`
- [Admin catalog services](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/services/admin_catalog.py): `server/app/services/admin_catalog.py`
- [Admin order services](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/services/admin_orders.py): `server/app/services/admin_orders.py`

### Identity and data

- [Auth and roles](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/deps/auth.py): `server/app/deps/auth.py`
- [Token security](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/core/security.py): `server/app/core/security.py`
- [DB sessions](https://github.com/haimni/freshflow-b2b-ordering-platform/blob/main/server/app/db/session.py): `server/app/db/session.py`
- [Domain models](https://github.com/haimni/freshflow-b2b-ordering-platform/tree/main/server/app/models): `server/app/models`
- **SQL database**

### Other components

- **Customer or admin**
- **API service**

## Connections

- Customer or admin → App shell: uses
- App shell → Home and auth UI: shows
- App shell → Role dashboard: shows
- App shell → Auth API client: restores session
- Auth API client → HTTP transport: requests
- Catalog API clients → HTTP transport: requests
- Order API clients → HTTP transport: requests
- Admin API clients → HTTP transport: requests
- HTTP transport → API service: HTTP
- FastAPI application → Versioned router: mounts
- Versioned router → Auth routes: dispatches
- Versioned router → Customer routes: dispatches
- Versioned router → Order routes: dispatches
- Versioned router → Admin routes: dispatches
- API service → FastAPI application: serves requests
- Auth routes → Authentication: authenticates
- Auth routes → Customer registration: registers customer
- Auth routes → Token security: creates token
- Auth routes → Auth and roles: requires user
- Authentication → DB sessions: queries through
- Authentication → Token security: verifies password
- Auth and roles → Token security: decodes token
- Auth and roles → DB sessions: loads user
- DB sessions → SQL database: connects
- Domain models → SQL database: maps entities
