# longnguyen1806/techwiz7-marketlink-egreen-basket architecture

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

- Interactive diagram: https://gitdiagram.com/longnguyen1806/techwiz7-marketlink-egreen-basket
- Repository: https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket

## Overview

MarketLink connects shoppers with local market producers. Shoppers discover products and markets, build a multi-stall cart, reserve pickup orders, then collect in person and may leave verified reviews. Farmers manage listings, stock, schedules and order fulfillment; administrators govern accounts, markets, moderation and reporting. The graph highlights checkout and order-state handling plus the supporting domain services. README documents additional capabilities not fully evidenced by sampled source; those are represented at subsystem level, with uncertain implementation links omitted.

Main entry points: [`frontend/src/pages`](https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/tree/main/frontend/src/pages) (Role-based web UI), [`backend/notifications/services.py`](https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/notifications/services.py) (Notifications), [`backend/catalog/models.py`](https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/catalog/models.py) (Product catalog), [`backend/orders/services/checkout_service.py`](https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/orders/services/checkout_service.py) (Checkout reservations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_web["Role-based web UI"]
  node_client_api["API clients"]
end

subgraph group_commerce["Shopping and fulfillment"]
  node_orders[("Orders and items<br/>[models.py]")]
  node_checkout["Checkout reservations"]
  node_order_fsm["Order lifecycle<br/>[fsm.py]"]
  node_reviews["Verified reviews<br/>[review_service.py]"]
  node_favorites["Favorites"]
end

subgraph group_market["Market and catalog"]
  node_catalog[("Product catalog<br/>[models.py]")]
  node_catalog_ai["AI listing review<br/>[service.py]"]
  node_markets[("Markets and pickup slots<br/>[models.py]")]
  node_market_service["Market schedule changes<br/>[market_service.py]"]
end

subgraph group_governance["Accounts and governance"]
  node_accounts[("Accounts and profiles<br/>[models.py]")]
  node_auth["Authentication<br/>[auth_service.py]"]
  node_system["Admin reports and flags"]
end

subgraph group_platform["Shared platform"]
  node_notifications["Notifications<br/>[services.py]"]
  node_notification_data[("Notification records<br/>[models.py]")]
  node_chat["AI marketplace assistant<br/>[services.py]"]
  node_database[("MySQL domain data")]
end

node_shopper(("Shopper"))
node_gemini{{"Gemini service"}}
node_maps{{"OpenStreetMap services"}}

node_shopper -->|"browses and orders"| node_web
node_web -.->|"requests data"| node_client_api
node_client_api -.->|"submits checkout"| node_checkout
node_checkout -->|"creates orders"| node_orders
node_checkout -->|"checks stock"| node_catalog
node_checkout -->|"records placement"| node_order_fsm
node_checkout -->|"checks customer"| node_accounts
node_order_fsm -->|"updates lifecycle"| node_orders
node_order_fsm -->|"adjusts stock"| node_catalog
node_order_fsm -->|"sends updates"| node_notifications
node_reviews -->|"checks completion"| node_orders
node_reviews -->|"raises review flags"| node_system
node_favorites -->|"references products"| node_catalog
node_catalog_ai -->|"reviews listings"| node_catalog
node_catalog_ai -.->|"requests evaluation"| node_gemini
node_catalog_ai -->|"reports decisions"| node_notifications
node_market_service -->|"updates schedules"| node_markets
node_market_service -->|"checks affected orders"| node_orders
node_market_service -->|"records history"| node_order_fsm
node_market_service -->|"notifies farmers"| node_notifications
node_auth -->|"authenticates users"| node_accounts
node_auth -->|"disconnects sessions"| node_notifications
node_notifications -->|"stores notifications"| node_notification_data
node_notifications -.->|"pushes updates"| node_shopper
node_chat -.->|"uses AI optionally"| node_gemini
node_web -.->|"discovers nearby markets"| node_maps
node_accounts -.->|"persists domain data"| node_database
node_catalog -.->|"persists domain data"| node_database
node_markets -.->|"persists domain data"| node_database
node_orders -.->|"persists domain data"| node_database
node_web -.->|"signs in"| node_auth
node_web -.->|"discovers listings"| node_catalog
node_web -.->|"submits reviews"| node_reviews

click node_web "https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/tree/main/frontend/src/pages"
click node_client_api "https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/tree/main/frontend/src/api"
click node_accounts "https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/accounts/models.py"
click node_auth "https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/accounts/services/auth_service.py"
click node_catalog "https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/catalog/models.py"
click node_catalog_ai "https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/catalog/ai_review/service.py"
click node_markets "https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/markets/models.py"
click node_market_service "https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/markets/services/market_service.py"
click node_orders "https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/orders/models.py"
click node_checkout "https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/orders/services/checkout_service.py"
click node_order_fsm "https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/orders/services/fsm.py"
click node_reviews "https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/reviews/services/review_service.py"
click node_favorites "https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/favorites/services/favorite_service.py"
click node_notifications "https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/notifications/services.py"
click node_notification_data "https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/notifications/models.py"
click node_chat "https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/chat_bot/services.py"
click node_system "https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/tree/main/backend/system"

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_client_api toneBlue
class node_orders,node_checkout,node_order_fsm,node_reviews,node_favorites toneAmber
class node_catalog,node_catalog_ai,node_markets,node_market_service toneMint
class node_accounts,node_auth,node_system toneRose
class node_notifications,node_notification_data,node_chat,node_database,node_shopper,node_gemini,node_maps toneIndigo
```

## Components

### Web application

- [Role-based web UI](https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/tree/main/frontend/src/pages): `frontend/src/pages`
- [API clients](https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/tree/main/frontend/src/api): `frontend/src/api`

### Shopping and fulfillment

- [Orders and items](https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/orders/models.py): `backend/orders/models.py`
- [Checkout reservations](https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/orders/services/checkout_service.py): `backend/orders/services/checkout_service.py`
- [Order lifecycle](https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/orders/services/fsm.py): `backend/orders/services/fsm.py`
- [Verified reviews](https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/reviews/services/review_service.py): `backend/reviews/services/review_service.py`
- [Favorites](https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/favorites/services/favorite_service.py): `backend/favorites/services/favorite_service.py`

### Market and catalog

- [Product catalog](https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/catalog/models.py): `backend/catalog/models.py`
- [AI listing review](https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/catalog/ai_review/service.py): `backend/catalog/ai_review/service.py`
- [Markets and pickup slots](https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/markets/models.py): `backend/markets/models.py`
- [Market schedule changes](https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/markets/services/market_service.py): `backend/markets/services/market_service.py`

### Accounts and governance

- [Accounts and profiles](https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/accounts/models.py): `backend/accounts/models.py`
- [Authentication](https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/accounts/services/auth_service.py): `backend/accounts/services/auth_service.py`
- [Admin reports and flags](https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/tree/main/backend/system): `backend/system`

### Shared platform

- [Notifications](https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/notifications/services.py): `backend/notifications/services.py`
- [Notification records](https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/notifications/models.py): `backend/notifications/models.py`
- [AI marketplace assistant](https://github.com/longnguyen1806/techwiz7-marketlink-egreen-basket/blob/main/backend/chat_bot/services.py): `backend/chat_bot/services.py`
- **MySQL domain data**

### Other components

- **Shopper**
- **Gemini service**
- **OpenStreetMap services**

## Connections

- Shopper → Role-based web UI: browses and orders (evidence: `README.md`)
- Role-based web UI → API clients: requests data
- API clients → Checkout reservations: submits checkout
- Checkout reservations → Orders and items: creates orders (evidence: `backend/orders/services/checkout_service.py`)
- Checkout reservations → Product catalog: checks stock (evidence: `backend/orders/services/checkout_service.py`)
- Checkout reservations → Order lifecycle: records placement (evidence: `backend/orders/services/checkout_service.py`)
- Checkout reservations → Accounts and profiles: checks customer (evidence: `backend/orders/services/checkout_service.py`)
- Order lifecycle → Orders and items: updates lifecycle (evidence: `backend/orders/services/fsm.py`)
- Order lifecycle → Product catalog: adjusts stock (evidence: `backend/orders/services/fsm.py`)
- Order lifecycle → Notifications: sends updates (evidence: `backend/orders/services/fsm.py`)
- Verified reviews → Orders and items: checks completion (evidence: `backend/reviews/services/review_service.py`)
- Verified reviews → Admin reports and flags: raises review flags (evidence: `backend/reviews/services/review_service.py`)
- Favorites → Product catalog: references products (evidence: `backend/favorites/services/favorite_service.py`)
- AI listing review → Product catalog: reviews listings (evidence: `backend/catalog/ai_review/service.py`)
- AI listing review → Gemini service: requests evaluation (evidence: `backend/catalog/ai_review/service.py`)
- AI listing review → Notifications: reports decisions (evidence: `backend/catalog/ai_review/service.py`)
- Market schedule changes → Markets and pickup slots: updates schedules (evidence: `backend/markets/services/market_service.py`)
- Market schedule changes → Orders and items: checks affected orders (evidence: `backend/markets/services/market_service.py`)
- Market schedule changes → Order lifecycle: records history (evidence: `backend/markets/services/market_service.py`)
- Market schedule changes → Notifications: notifies farmers (evidence: `backend/markets/services/market_service.py`)
- Authentication → Accounts and profiles: authenticates users (evidence: `backend/accounts/services/auth_service.py`)
- Authentication → Notifications: disconnects sessions (evidence: `backend/accounts/services/auth_service.py`)
- Notifications → Notification records: stores notifications (evidence: `backend/notifications/services.py`)
- Notifications → Shopper: pushes updates (evidence: `backend/notifications/services.py`)
- AI marketplace assistant → Gemini service: uses AI optionally (evidence: `backend/chat_bot/services.py`)
- Role-based web UI → OpenStreetMap services: discovers nearby markets (evidence: `README.md`)
- Accounts and profiles → MySQL domain data: persists domain data (evidence: `README.md`)
- Product catalog → MySQL domain data: persists domain data (evidence: `README.md`)
- Markets and pickup slots → MySQL domain data: persists domain data (evidence: `README.md`)
- Orders and items → MySQL domain data: persists domain data (evidence: `README.md`)
- Role-based web UI → Authentication: signs in (evidence: `README.md`)
- Role-based web UI → Product catalog: discovers listings (evidence: `README.md`)
- Role-based web UI → Verified reviews: submits reviews (evidence: `README.md`)
