# frede43/agriktech architecture

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

- Interactive diagram: https://gitdiagram.com/frede43/agriktech
- Repository: https://github.com/frede43/agriktech

## Overview

AgriConnect Burundi is a bilingual agricultural marketplace connecting buyers, farmers, delivery workers, and administrators. The principal journey is product discovery and cart checkout, followed by escrow payment, delivery confirmation, and release of funds; supporting branches cover authentication, QR traceability, OBR tax reporting, and rural services. The README documents the frontend/API boundary and major capabilities; the sampled excerpts do not expose most router internals, so uncertain backend calls are omitted.

Main entry points: [`backend/main.py`](https://github.com/frede43/agriktech/blob/main/backend/main.py) (FastAPI application), [`lib/api-config.ts`](https://github.com/frede43/agriktech/blob/main/lib/api-config.ts) (API client), [`lib/LanguageContext.tsx`](https://github.com/frede43/agriktech/blob/main/lib/LanguageContext.tsx) (French / Kirundi), [`app/produits/page.tsx`](https://github.com/frede43/agriktech/blob/main/app/produits/page.tsx) (Marketplace pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_market_ui["Marketplace pages<br/>[page.tsx]"]
  node_buyer_ui["Buyer workspace<br/>[page.tsx]"]
  node_farmer_ui["Farmer workspace<br/>[page.tsx]"]
  node_delivery_ui["Delivery workspace<br/>[page.tsx]"]
  node_admin_ui["Admin workspace<br/>[page.tsx]"]
  node_auth_ui["OTP access<br/>[page.tsx]"]
end

subgraph group_commerce["Marketplace commerce"]
  node_products["Product catalogue<br/>[products.py]"]
  node_cart["Cart validation<br/>[cart.py]"]
  node_orders["Orders and escrow<br/>[orders.py]"]
  node_payments["Payments<br/>[payments.py]"]
  node_delivery_ops["Delivery missions<br/>[orders.py]"]
  node_trace["QR traceability<br/>[page.tsx]"]
  node_wallet["Wallet and withdrawals<br/>[wallet.py]"]
end

subgraph group_operations["Platform operations"]
  node_obr["OBR tax reporting<br/>[obr.py]"]
  node_ecosystem["Co-ops and credit<br/>[cooperatives.py]"]
  node_community["Messaging and disputes<br/>[messages.py]"]
  node_weather["Weather and market<br/>[weather.py]"]
end

subgraph group_foundation["Shared foundation"]
  node_api_client["API client<br/>[api-config.ts]"]
  node_offline["Offline queue<br/>[offline.ts]"]
  node_language["French / Kirundi"]
  node_api["FastAPI application<br/>[main.py]"]
  node_database[("Application database<br/>[database.py]")]
  node_models["Domain models<br/>[models.py]"]
end

node_buyer(("Buyer"))
node_farmer(("Farmer"))
node_delivery(("Delivery worker"))
node_admin(("Administrator"))
node_sms["SMS provider"]
node_mobile_money["Mobile money provider"]
node_weather_service["Open-Meteo"]

node_buyer -->|"browses"| node_market_ui
node_buyer -->|"manages orders"| node_buyer_ui
node_farmer -->|"manages sales"| node_farmer_ui
node_delivery -->|"handles missions"| node_delivery_ui
node_admin -->|"administers platform"| node_admin_ui
node_market_ui -->|"fetches catalogue"| node_api_client
node_buyer_ui -->|"fetches data"| node_api_client
node_admin_ui -->|"fetches data"| node_api_client
node_delivery_ui -->|"fetches data"| node_api_client
node_auth_ui -->|"requests OTP"| node_api_client
node_api_client -->|"calls backend"| node_api
node_api -->|"registers routes"| node_products
node_api -->|"registers routes"| node_orders
node_api -->|"registers routes"| node_wallet
node_api -->|"registers routes"| node_cart
node_api -->|"registers routes"| node_payments
node_api -->|"registers routes"| node_obr
node_api -->|"serves capabilities"| node_ecosystem
node_api -->|"serves capabilities"| node_community
node_api -->|"serves forecasts"| node_weather
node_trace -->|"loads trace"| node_api_client
node_offline -->|"replays queued products"| node_api_client
node_language -->|"provides translations"| node_market_ui
node_language -->|"provides translations"| node_buyer_ui
node_language -->|"provides translations"| node_admin_ui
node_models -->|"uses database layer"| node_database
node_delivery_ops -.->|"coordinates delivery"| node_orders
node_orders -.->|"escrows funds"| node_payments
node_payments -.->|"charges provider"| node_mobile_money
node_auth_ui -.->|"requests OTP delivery"| node_sms
node_weather -.->|"gets forecasts"| node_weather_service
node_obr -->|"reports tax"| node_admin

click node_market_ui "https://github.com/frede43/agriktech/blob/main/app/produits/page.tsx"
click node_buyer_ui "https://github.com/frede43/agriktech/blob/main/app/acheteur/page.tsx"
click node_farmer_ui "https://github.com/frede43/agriktech/blob/main/app/fermier/page.tsx"
click node_delivery_ui "https://github.com/frede43/agriktech/blob/main/app/logistique/page.tsx"
click node_admin_ui "https://github.com/frede43/agriktech/blob/main/app/admin/page.tsx"
click node_auth_ui "https://github.com/frede43/agriktech/blob/main/app/connexion/page.tsx"
click node_api_client "https://github.com/frede43/agriktech/blob/main/lib/api-config.ts"
click node_offline "https://github.com/frede43/agriktech/blob/main/lib/offline.ts"
click node_language "https://github.com/frede43/agriktech/blob/main/lib/LanguageContext.tsx"
click node_api "https://github.com/frede43/agriktech/blob/main/backend/main.py"
click node_products "https://github.com/frede43/agriktech/blob/main/backend/routers/products.py"
click node_cart "https://github.com/frede43/agriktech/blob/main/backend/routers/cart.py"
click node_orders "https://github.com/frede43/agriktech/blob/main/backend/routers/orders.py"
click node_payments "https://github.com/frede43/agriktech/blob/main/backend/routers/payments.py"
click node_delivery_ops "https://github.com/frede43/agriktech/blob/main/backend/routers/orders.py"
click node_trace "https://github.com/frede43/agriktech/blob/main/app/trace/%5Btoken%5D/page.tsx"
click node_wallet "https://github.com/frede43/agriktech/blob/main/backend/routers/wallet.py"
click node_obr "https://github.com/frede43/agriktech/blob/main/backend/routers/obr.py"
click node_ecosystem "https://github.com/frede43/agriktech/blob/main/backend/routers/cooperatives.py"
click node_community "https://github.com/frede43/agriktech/blob/main/backend/routers/messages.py"
click node_weather "https://github.com/frede43/agriktech/blob/main/backend/routers/weather.py"
click node_database "https://github.com/frede43/agriktech/blob/main/backend/database.py"
click node_models "https://github.com/frede43/agriktech/blob/main/backend/models.py"

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_market_ui,node_buyer_ui,node_farmer_ui,node_delivery_ui,node_admin_ui,node_auth_ui toneBlue
class node_products,node_cart,node_orders,node_payments,node_delivery_ops,node_trace,node_wallet toneAmber
class node_obr,node_ecosystem,node_community,node_weather toneMint
class node_api_client,node_offline,node_language,node_api,node_database,node_models,node_delivery toneRose
class node_buyer,node_farmer,node_admin,node_sms,node_mobile_money,node_weather_service toneIndigo
```

## Components

### User experience

- [Marketplace pages](https://github.com/frede43/agriktech/blob/main/app/produits/page.tsx): `app/produits/page.tsx`
- [Buyer workspace](https://github.com/frede43/agriktech/blob/main/app/acheteur/page.tsx): `app/acheteur/page.tsx`
- [Farmer workspace](https://github.com/frede43/agriktech/blob/main/app/fermier/page.tsx): `app/fermier/page.tsx`
- [Delivery workspace](https://github.com/frede43/agriktech/blob/main/app/logistique/page.tsx): `app/logistique/page.tsx`
- [Admin workspace](https://github.com/frede43/agriktech/blob/main/app/admin/page.tsx): `app/admin/page.tsx`
- [OTP access](https://github.com/frede43/agriktech/blob/main/app/connexion/page.tsx): `app/connexion/page.tsx`

### Marketplace commerce

- [Product catalogue](https://github.com/frede43/agriktech/blob/main/backend/routers/products.py): `backend/routers/products.py`
- [Cart validation](https://github.com/frede43/agriktech/blob/main/backend/routers/cart.py): `backend/routers/cart.py`
- [Orders and escrow](https://github.com/frede43/agriktech/blob/main/backend/routers/orders.py): `backend/routers/orders.py`
- [Payments](https://github.com/frede43/agriktech/blob/main/backend/routers/payments.py): `backend/routers/payments.py`
- [Delivery missions](https://github.com/frede43/agriktech/blob/main/backend/routers/orders.py): `backend/routers/orders.py`
- [QR traceability](https://github.com/frede43/agriktech/blob/main/app/trace/%5Btoken%5D/page.tsx): `app/trace/[token]/page.tsx`
- [Wallet and withdrawals](https://github.com/frede43/agriktech/blob/main/backend/routers/wallet.py): `backend/routers/wallet.py`

### Platform operations

- [OBR tax reporting](https://github.com/frede43/agriktech/blob/main/backend/routers/obr.py): `backend/routers/obr.py`
- [Co-ops and credit](https://github.com/frede43/agriktech/blob/main/backend/routers/cooperatives.py): `backend/routers/cooperatives.py`
- [Messaging and disputes](https://github.com/frede43/agriktech/blob/main/backend/routers/messages.py): `backend/routers/messages.py`
- [Weather and market](https://github.com/frede43/agriktech/blob/main/backend/routers/weather.py): `backend/routers/weather.py`

### Shared foundation

- [API client](https://github.com/frede43/agriktech/blob/main/lib/api-config.ts): `lib/api-config.ts`
- [Offline queue](https://github.com/frede43/agriktech/blob/main/lib/offline.ts): `lib/offline.ts`
- [French / Kirundi](https://github.com/frede43/agriktech/blob/main/lib/LanguageContext.tsx): `lib/LanguageContext.tsx`
- [FastAPI application](https://github.com/frede43/agriktech/blob/main/backend/main.py): `backend/main.py`
- [Application database](https://github.com/frede43/agriktech/blob/main/backend/database.py): `backend/database.py`
- [Domain models](https://github.com/frede43/agriktech/blob/main/backend/models.py): `backend/models.py`

### Other components

- **Buyer**
- **Farmer**
- **Delivery worker**
- **Administrator**
- **SMS provider**
- **Mobile money provider**
- **Open-Meteo**

## Connections

- Buyer → Marketplace pages: browses (evidence: `README.md`)
- Buyer → Buyer workspace: manages orders (evidence: `README.md`)
- Farmer → Farmer workspace: manages sales (evidence: `README.md`)
- Delivery worker → Delivery workspace: handles missions (evidence: `README.md`)
- Administrator → Admin workspace: administers platform (evidence: `README.md`)
- Marketplace pages → API client: fetches catalogue (evidence: `app/produits/page.tsx`)
- Buyer workspace → API client: fetches data (evidence: `app/acheteur/page.tsx`)
- Admin workspace → API client: fetches data (evidence: `app/admin/page.tsx`)
- Delivery workspace → API client: fetches data (evidence: `app/logistique/page.tsx`)
- OTP access → API client: requests OTP (evidence: `app/connexion/page.tsx`)
- API client → FastAPI application: calls backend (evidence: `README.md`)
- FastAPI application → Product catalogue: registers routes (evidence: `backend/main.py`)
- FastAPI application → Orders and escrow: registers routes (evidence: `backend/main.py`)
- FastAPI application → Wallet and withdrawals: registers routes (evidence: `backend/main.py`)
- FastAPI application → Cart validation: registers routes (evidence: `README.md`)
- FastAPI application → Payments: registers routes (evidence: `README.md`)
- FastAPI application → OBR tax reporting: registers routes (evidence: `README.md`)
- FastAPI application → Co-ops and credit: serves capabilities (evidence: `README.md`)
- FastAPI application → Messaging and disputes: serves capabilities (evidence: `README.md`)
- FastAPI application → Weather and market: serves forecasts (evidence: `README.md`)
- QR traceability → API client: loads trace (evidence: `app/trace/[token]/page.tsx`)
- Offline queue → API client: replays queued products (evidence: `lib/offline.ts`)
- French / Kirundi → Marketplace pages: provides translations (evidence: `lib/LanguageContext.tsx`)
- French / Kirundi → Buyer workspace: provides translations (evidence: `lib/LanguageContext.tsx`)
- French / Kirundi → Admin workspace: provides translations (evidence: `lib/LanguageContext.tsx`)
- Domain models → Application database: uses database layer (evidence: `backend/models.py`)
- Delivery missions → Orders and escrow: coordinates delivery
- Orders and escrow → Payments: escrows funds
- Payments → Mobile money provider: charges provider
- OTP access → SMS provider: requests OTP delivery (evidence: `README.md`)
- Weather and market → Open-Meteo: gets forecasts (evidence: `README.md`)
- OBR tax reporting → Administrator: reports tax (evidence: `README.md`)
