Fresh produce demand orchestration for cluster-based supply
A commercial and operational architecture for many small household buyers, central planning, supply clusters, ledger-grade financial integrity, fulfilment, and analytics.
flowchart LR
%% DEMAND SIDE
subgraph Demand["Demand side: many small family buyers"]
H1["Family buyers"]
WEB["Web / Mobile storefront"]
SUB["Subscriptions / recurring baskets"]
CART["One-off orders"]
SLOT["Delivery slot selection"]
end
%% COMMERCE / FINANCIAL CORE
subgraph Commerce["Commerce + financial integrity"]
API["Commerce API"]
SQL["Cloud SQL / PostgreSQL
Orders, payments, subscriptions,
contracts, ledger, settlements"]
OUTBOX["Transactional outbox"]
PAY["Payment provider"]
end
%% EVENT CORE
subgraph Events["Core event backbone"]
PS["Pub/Sub topics"]
DE["Demand events"]
FE["Financial events"]
OE["Operational events"]
end
%% OPERATIONAL / PLANNING CORE
subgraph Planning["Demand pooling + orchestration"]
AGG["Demand aggregation service"]
POOLS["Firestore
Demand pools by SKU / zone / week"]
FC["Forecast + demand confidence"]
PLAN["Central planning / allocation engine"]
EXC["Firestore
Exceptions / shortages / alerts"]
end
%% SUPPLY SIDE
subgraph Supply["Supply side: cluster-based production"]
CL["Firestore
Cluster capacity snapshots"]
CCP["Firestore
Cluster crop programs"]
FWP["Firestore
Farm work packages"]
C1["Cluster coordinator"]
F1["Farm family units
30–40 farms per cluster"]
FAC["Growing facilities
500 sqm each"]
CONS["Harvest consolidation / packhouse"]
end
%% DELIVERY / CUSTOMER FULFILMENT
subgraph Fulfilment["Fulfilment + household delivery"]
DISP["Dispatch planning"]
DEL["Delivery to families"]
SUBS["Substitutions / shortage handling"]
CS["Customer notifications"]
end
%% ANALYTICS
subgraph Analytics["Analytics + planning intelligence"]
BQ["BigQuery
Orders, events, planning analytics"]
DASH["Planner dashboards"]
KPI["Forecast error / fill rate
cluster utilisation / churn"]
end
%% FLOWS
H1 --> WEB
WEB --> SUB
WEB --> CART
WEB --> SLOT
SUB --> API
CART --> API
SLOT --> API
API --> SQL
API --> PAY
SQL --> OUTBOX
OUTBOX --> PS
PS --> DE
PS --> FE
PS --> OE
DE --> AGG
AGG --> POOLS
POOLS --> FC
FC --> PLAN
PLAN --> CL
CL --> PLAN
PLAN --> CCP
PLAN --> FWP
PLAN --> EXC
CCP --> C1
C1 --> F1
F1 --> FAC
FAC --> CONS
CONS --> DISP
DISP --> DEL
EXC --> SUBS
SUBS --> CS
DEL --> CS
PS --> BQ
SQL --> BQ
POOLS --> BQ
CL --> BQ
CCP --> BQ
FWP --> BQ
BQ --> DASH
BQ --> KPI
%% Feedback loops
C1 -->|capacity changes / risks| PS
F1 -->|progress updates| PS
CONS -->|actual harvest| PS
DEL -->|fulfilment status| PS
CS -->|order edits / cancellations| API
%% Node classes
classDef demand fill:#eaf3ff,stroke:#7aa2f7,stroke-width:1.6px,color:#0f172a;
classDef commerce fill:#fff3e8,stroke:#f59e0b,stroke-width:1.6px,color:#0f172a;
classDef events fill:#eefbf5,stroke:#10b981,stroke-width:1.6px,color:#0f172a;
classDef planning fill:#f3efff,stroke:#8b5cf6,stroke-width:1.6px,color:#0f172a;
classDef supply fill:#ecfeff,stroke:#06b6d4,stroke-width:1.6px,color:#0f172a;
classDef fulfilment fill:#fff1f2,stroke:#f43f5e,stroke-width:1.6px,color:#0f172a;
classDef analytics fill:#f8fafc,stroke:#64748b,stroke-width:1.6px,color:#0f172a;
class H1,WEB,SUB,CART,SLOT demand;
class API,SQL,OUTBOX,PAY commerce;
class PS,DE,FE,OE events;
class AGG,POOLS,FC,PLAN,EXC planning;
class CL,CCP,FWP,C1,F1,FAC,CONS supply;
class DISP,DEL,SUBS,CS fulfilment;
class BQ,DASH,KPI analytics;
%% Subgraph styling
style Demand fill:#f8fbff,stroke:#c7ddff,stroke-width:2px,color:#0f172a
style Commerce fill:#fff9f2,stroke:#ffd299,stroke-width:2px,color:#0f172a
style Events fill:#f5fdf9,stroke:#98e2c0,stroke-width:2px,color:#0f172a
style Planning fill:#faf7ff,stroke:#d7c5ff,stroke-width:2px,color:#0f172a
style Supply fill:#f3fcff,stroke:#b7eff7,stroke-width:2px,color:#0f172a
style Fulfilment fill:#fff7f8,stroke:#ffc2ce,stroke-width:2px,color:#0f172a
style Analytics fill:#fafcff,stroke:#cbd5e1,stroke-width:2px,color:#0f172a
%% Default links
linkStyle default stroke:#64748b,stroke-width:1.7px,opacity:0.9
How to read this diagram
1. Read it from left to right: demand starts with household buyers, moves through commerce and planning, then flows into supply, fulfilment, and analytics.
2. Each coloured block represents one business layer, so the diagram shows not only software components but also the operating logic of the whole model.
3. The arrows at the bottom and the feedback loops show that this is not a one-way system: production, delivery, and customer changes continuously update planning.
flowchart TB
U["Family buyers / Planner / Cluster coordinator / Farm users"]
subgraph Edge["Edge + access"]
LB["Cloud Load Balancing
HTTPS entry"]
FE["Cloud Run
Frontend / BFF"]
AUTH["Identity / Auth"]
end
subgraph App["Application services on Cloud Run"]
ORD["Order service"]
SUBSVC["Subscription service"]
AGG["Demand aggregation service"]
PLAN["Planning / allocation service"]
PROD["Producer orchestration service"]
SETTLE["Settlement / payout service"]
NOTIF["Notification service"]
OUTBOXR["Outbox relay worker"]
end
subgraph Data["Operational + financial data"]
SQL["Cloud SQL PostgreSQL
Orders, payments, ledger,
contracts, settlements, outbox"]
FS["Firestore
Demand pools, cluster capacity,
cluster crop programs,
farm work packages, exceptions"]
GCS["Cloud Storage
Contracts, certificates,
photos, docs"]
SM["Secret Manager"]
end
subgraph Eventing["Async messaging"]
T1["Pub/Sub:
order-events"]
T2["Pub/Sub:
financial-events"]
T3["Pub/Sub:
operational-events"]
T4["Pub/Sub:
notification-events"]
end
subgraph Analytics["Analytics + reporting"]
BQ["BigQuery"]
DBSUB["Pub/Sub BigQuery subscription"]
BI["Dashboards / BI"]
end
subgraph Ops["Ops / release / observability"]
AR["Artifact Registry"]
CI["CI/CD pipeline"]
MON["Cloud Monitoring / Logging"]
SCH["Cloud Scheduler"]
end
U --> LB
LB --> FE
FE --> AUTH
FE --> ORD
FE --> SUBSVC
FE --> PROD
ORD --> SQL
SUBSVC --> SQL
SETTLE --> SQL
ORD --> FS
AGG --> FS
PLAN --> FS
PROD --> FS
ORD --> SM
SUBSVC --> SM
AGG --> SM
PLAN --> SM
PROD --> SM
SETTLE --> SM
NOTIF --> SM
ORD --> GCS
PROD --> GCS
SQL --> OUTBOXR
OUTBOXR --> T1
OUTBOXR --> T2
AGG --> T3
PLAN --> T3
PROD --> T3
SETTLE --> T2
NOTIF --> T4
T1 --> AGG
T1 --> NOTIF
T2 --> SETTLE
T2 --> NOTIF
T3 --> PLAN
T3 --> PROD
T3 --> NOTIF
T4 --> NOTIF
T1 --> DBSUB
T2 --> DBSUB
T3 --> DBSUB
DBSUB --> BQ
SQL --> BQ
FS --> BQ
BQ --> BI
CI --> AR
AR --> ORD
AR --> SUBSVC
AR --> AGG
AR --> PLAN
AR --> PROD
AR --> SETTLE
AR --> NOTIF
AR --> OUTBOXR
SCH --> PLAN
MON --> ORD
MON --> SUBSVC
MON --> AGG
MON --> PLAN
MON --> PROD
MON --> SETTLE
MON --> NOTIF
%% Node classes
classDef users fill:#eaf3ff,stroke:#7aa2f7,stroke-width:1.6px,color:#0f172a;
classDef edge fill:#eefbf5,stroke:#10b981,stroke-width:1.6px,color:#0f172a;
classDef app fill:#f3efff,stroke:#8b5cf6,stroke-width:1.6px,color:#0f172a;
classDef data fill:#fff3e8,stroke:#f59e0b,stroke-width:1.6px,color:#0f172a;
classDef eventing fill:#ecfeff,stroke:#06b6d4,stroke-width:1.6px,color:#0f172a;
classDef analytics fill:#fff1f2,stroke:#f43f5e,stroke-width:1.6px,color:#0f172a;
classDef ops fill:#f8fafc,stroke:#64748b,stroke-width:1.6px,color:#0f172a;
class U users;
class LB,FE,AUTH edge;
class ORD,SUBSVC,AGG,PLAN,PROD,SETTLE,NOTIF,OUTBOXR app;
class SQL,FS,GCS,SM data;
class T1,T2,T3,T4 eventing;
class BQ,DBSUB,BI analytics;
class AR,CI,MON,SCH ops;
%% Subgraph styling
style Edge fill:#f5fdf9,stroke:#98e2c0,stroke-width:2px,color:#0f172a
style App fill:#faf7ff,stroke:#d7c5ff,stroke-width:2px,color:#0f172a
style Data fill:#fff9f2,stroke:#ffd299,stroke-width:2px,color:#0f172a
style Eventing fill:#f3fcff,stroke:#b7eff7,stroke-width:2px,color:#0f172a
style Analytics fill:#fff7f8,stroke:#ffc2ce,stroke-width:2px,color:#0f172a
style Ops fill:#fafcff,stroke:#cbd5e1,stroke-width:2px,color:#0f172a
%% Default links
linkStyle default stroke:#64748b,stroke-width:1.7px,opacity:0.9
How to read this diagram
1. Read it from top to bottom: users enter through the edge layer, requests reach application services, then data, eventing, analytics, and operations support the platform underneath.
2. This is a deployment and infrastructure view, so the boxes represent cloud resources and services rather than only business functions.
3. Follow the arrows by type: some show live user traffic, some show event publishing and consumption, and others show monitoring, scheduling, and deployment flows.
flowchart LR
subgraph UG["6 User Groups"]
GROWERS["1. Growers"]
CONSUMERS["2. Consumers"]
SELLERS["3. Sellers"]
BUYERS["4. Buyers"]
DEVELOPERS["5. Platform Developers"]
ADMINS["6. Platform Admin / Management
Marketing / Branding / Sales"]
end
subgraph UI["UI / UX Dashboards"]
GD["Grower Dashboard"]
CD["Consumer App / Dashboard"]
SD["Seller Dashboard"]
BD["Buyer Portal / Dashboard"]
DD["Developer Console / DevOps Workspace"]
AD["Admin / Management Suite"]
end
GROWERS --> GD
CONSUMERS --> CD
SELLERS --> SD
BUYERS --> BD
DEVELOPERS --> DD
ADMINS --> AD
subgraph XP["Shared Experience + Application Layer"]
AUTH["Identity / Roles / Permissions"]
API["API Gateway / App Services"]
NOTIF["Notifications / Email / SMS / Push"]
CMS["Content / Branding / Campaign Management"]
CRM["CRM / Sales / Customer Support"]
DASH["Shared KPI / Reporting Widgets"]
end
GD --> API
CD --> API
SD --> API
BD --> API
DD --> API
AD --> API
GD --> AUTH
CD --> AUTH
SD --> AUTH
BD --> AUTH
DD --> AUTH
AD --> AUTH
API --> NOTIF
API --> CMS
API --> CRM
API --> DASH
subgraph CORE["Core Business Modules"]
DEMAND["Demand Capture + Subscriptions"]
ORDERS["Orders + Payments + Contracts"]
POOLS["Demand Pooling by SKU / Zone / Week"]
ALLOC["Cluster Allocation + Farm Work Packages"]
SUPPLY["Supply / Capacity / Crop Program"]
FULFIL["Harvest Consolidation + Delivery Fulfilment"]
MKT["Marketing / Campaign / Promotions"]
end
API --> DEMAND
API --> ORDERS
API --> POOLS
API --> ALLOC
API --> SUPPLY
API --> FULFIL
API --> MKT
subgraph AI["AI / Data / Intelligence Layer"]
ANNO["AI Annotation Engine
for raw images / sensor / field data"]
BDA["Big Data Analytics Engine
for user input + event + operational data"]
PLANAI["AI Farming Planning Engine"]
DSS["Operation Decision Support
+ Recommendation Engine"]
RECO["Consumer / Buyer Recommendation Engine"]
end
DEMAND --> BDA
ORDERS --> BDA
POOLS --> BDA
SUPPLY --> BDA
FULFIL --> BDA
SUPPLY --> PLANAI
POOLS --> PLANAI
BDA --> PLANAI
PLANAI --> DSS
BDA --> DSS
DEMAND --> RECO
ORDERS --> RECO
BDA --> RECO
SUPPLY --> ANNO
ANNO --> BDA
subgraph DATA["Cloud Data + Platform Backend"]
SQL["SQL Database
Orders / Payments / Ledger / Contracts"]
DOC["Document Database
Demand Pools / Capacity / Work Packages"]
OBJ["Object Storage
Raw data / images / documents / media"]
BUS["Pub/Sub Event Backbone"]
WH["Big Data Warehouse"]
end
ORDERS --> SQL
DEMAND --> SQL
POOLS --> DOC
ALLOC --> DOC
SUPPLY --> DOC
FULFIL --> DOC
DEMAND --> BUS
ORDERS --> BUS
POOLS --> BUS
ALLOC --> BUS
SUPPLY --> BUS
FULFIL --> BUS
ANNO --> OBJ
API --> OBJ
BUS --> WH
SQL --> WH
DOC --> WH
OBJ --> WH
BDA --> WH
PLANAI --> WH
DSS --> WH
RECO --> WH
DSS --> GD
RECO --> CD
RECO --> BD
DASH --> SD
DASH --> AD
BDA --> AD
PLANAI --> AD
CRM --> SD
CRM --> AD
CMS --> CD
CMS --> SD
%% Node classes
classDef users fill:#eaf3ff,stroke:#7aa2f7,stroke-width:1.6px,color:#0f172a;
classDef ui fill:#eefbf5,stroke:#10b981,stroke-width:1.6px,color:#0f172a;
classDef experience fill:#fff3e8,stroke:#f59e0b,stroke-width:1.6px,color:#0f172a;
classDef core fill:#f3efff,stroke:#8b5cf6,stroke-width:1.6px,color:#0f172a;
classDef ai fill:#ecfeff,stroke:#06b6d4,stroke-width:1.6px,color:#0f172a;
classDef data fill:#fff1f2,stroke:#f43f5e,stroke-width:1.6px,color:#0f172a;
class GROWERS,CONSUMERS,SELLERS,BUYERS,DEVELOPERS,ADMINS users;
class GD,CD,SD,BD,DD,AD ui;
class AUTH,API,NOTIF,CMS,CRM,DASH experience;
class DEMAND,ORDERS,POOLS,ALLOC,SUPPLY,FULFIL,MKT core;
class ANNO,BDA,PLANAI,DSS,RECO ai;
class SQL,DOC,OBJ,BUS,WH data;
%% Subgraph styling
style UG fill:#f8fbff,stroke:#c7ddff,stroke-width:2px,color:#0f172a
style UI fill:#f5fdf9,stroke:#98e2c0,stroke-width:2px,color:#0f172a
style XP fill:#fff9f2,stroke:#ffd299,stroke-width:2px,color:#0f172a
style CORE fill:#faf7ff,stroke:#d7c5ff,stroke-width:2px,color:#0f172a
style AI fill:#f3fcff,stroke:#b7eff7,stroke-width:2px,color:#0f172a
style DATA fill:#fff7f8,stroke:#ffc2ce,stroke-width:2px,color:#0f172a
%% Default links
linkStyle default stroke:#64748b,stroke-width:1.7px,opacity:0.9
How to read this diagram
1. Read it from left to right: user groups connect to their dashboards, dashboards connect to shared platform services, and those services connect to core business modules.
2. The middle of the diagram explains what the platform actually does operationally, while the lower layers show how AI, data, and infrastructure support those functions.
3. The returning arrows into dashboards show where insights come back to users, for example through recommendations, decision support, reporting, and management views.