# badaseshirishab/threadline architecture

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

- Interactive diagram: https://gitdiagram.com/badaseshirishab/threadline
- Repository: https://github.com/badaseshirishab/threadline

## Overview

Threadline is a multi-sided seller marketplace: customers browse and buy products, sellers apply and manage their catalog and orders, admins govern marketplace operations, and delivery partners handle delivery and return work. Each app has its own web frontend and API; the APIs share MongoDB schemas and messaging services. The principal customer journey runs from storefront browsing through cart/checkout and payment to order fulfillment. Several route implementations are not excerpted, so cross-service links and feature-level flows rely on README documentation rather than uninspected code.

Main entry points: [`customer/backend/src/server.js`](https://github.com/badaseshirishab/threadline/blob/main/customer/backend/src/server.js) (Customer API), [`admin/backend/src/server.js`](https://github.com/badaseshirishab/threadline/blob/main/admin/backend/src/server.js) (Admin API), [`seller/backend/src/server.js`](https://github.com/badaseshirishab/threadline/blob/main/seller/backend/src/server.js) (Seller API), [`delivery/backend/src/server.js`](https://github.com/badaseshirishab/threadline/blob/main/delivery/backend/src/server.js) (Delivery API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer storefront"]
  node_storefront["Storefront screens<br/>[App.js]"]
  node_store_state["Store state<br/>[StoreContext.js]"]
  node_customer_api["Customer API<br/>[server.js]"]
  node_customer_routes["Customer accounts<br/>[customers.js]"]
  node_catalog_routes["Product catalog<br/>[products.js]"]
  node_payments["Payments and reservations<br/>[payments.js]"]
end

subgraph group_seller["Seller operations"]
  node_seller_ui["Seller workspace<br/>[App.js]"]
  node_seller_state["Seller state<br/>[SellerContext.js]"]
  node_seller_api["Seller API<br/>[server.js]"]
  node_seller_routes["Seller management<br/>[sellers.js]"]
end

subgraph group_admin["Marketplace administration"]
  node_admin_ui["Admin workspace<br/>[App.js]"]
  node_admin_state["Admin state<br/>[AdminContext.js]"]
  node_admin_api["Admin API<br/>[server.js]"]
  node_admin_routes["Marketplace controls<br/>[admin.js]"]
end

subgraph group_delivery["Delivery operations"]
  node_delivery_ui["Delivery workspace<br/>[JobsContext.js]"]
  node_delivery_api_client["Delivery API client<br/>[client.js]"]
  node_delivery_api["Delivery API<br/>[server.js]"]
  node_delivery_routes["Delivery and returns<br/>[deliveries.js]"]
end

subgraph group_shared["Shared platform"]
  node_shared_models[("Shared schemas<br/>[models.js]")]
  node_otp["Verification codes<br/>[otp.js]"]
  node_notifications["Messaging<br/>[notify.js]"]
end

node_customer_actor(("Customer"))
node_seller_actor(("Seller"))
node_admin_actor(("Administrator"))
node_delivery_actor(("Delivery partner"))

node_customer_actor -->|"browses and buys"| node_storefront
node_storefront -->|"uses state"| node_store_state
node_store_state -->|"requests data"| node_customer_api
node_customer_api -->|"mounts accounts"| node_customer_routes
node_customer_api -->|"mounts catalog"| node_catalog_routes
node_customer_api -->|"releases expired payments"| node_payments
node_seller_actor -->|"manages shop"| node_seller_ui
node_seller_ui -->|"uses state"| node_seller_state
node_seller_state -->|"requests seller data"| node_seller_api
node_seller_api -->|"mounts management"| node_seller_routes
node_admin_actor -->|"governs marketplace"| node_admin_ui
node_admin_ui -->|"uses state"| node_admin_state
node_admin_state -->|"requests admin data"| node_admin_api
node_admin_api -->|"mounts controls"| node_admin_routes
node_delivery_actor -->|"handles assigned work"| node_delivery_ui
node_delivery_ui -->|"requests jobs"| node_delivery_api_client
node_delivery_api_client -->|"calls API"| node_delivery_api
node_delivery_api -->|"mounts deliveries"| node_delivery_routes
node_customer_api -->|"registers shared schemas"| node_shared_models
node_seller_api -->|"registers shared schemas"| node_shared_models
node_admin_api -->|"registers shared schemas"| node_shared_models
node_delivery_api -->|"registers shared schemas"| node_shared_models
node_customer_api -->|"supports customer verification"| node_otp
node_delivery_routes -->|"sends and checks codes"| node_otp
node_otp -->|"sends verification messages"| node_notifications
node_customer_api -->|"shares marketplace database"| node_seller_api
node_admin_api -->|"approves sellers and products"| node_seller_api
node_admin_api -->|"manages delivery partners"| node_delivery_api

click node_storefront "https://github.com/badaseshirishab/threadline/blob/main/customer/frontend/src/App.js"
click node_store_state "https://github.com/badaseshirishab/threadline/blob/main/customer/frontend/src/context/StoreContext.js"
click node_customer_api "https://github.com/badaseshirishab/threadline/blob/main/customer/backend/src/server.js"
click node_customer_routes "https://github.com/badaseshirishab/threadline/blob/main/customer/backend/src/routes/customers.js"
click node_catalog_routes "https://github.com/badaseshirishab/threadline/blob/main/customer/backend/src/routes/products.js"
click node_payments "https://github.com/badaseshirishab/threadline/blob/main/customer/backend/src/utils/payments.js"
click node_seller_ui "https://github.com/badaseshirishab/threadline/blob/main/seller/frontend/src/App.js"
click node_seller_state "https://github.com/badaseshirishab/threadline/blob/main/seller/frontend/src/context/SellerContext.js"
click node_seller_api "https://github.com/badaseshirishab/threadline/blob/main/seller/backend/src/server.js"
click node_seller_routes "https://github.com/badaseshirishab/threadline/blob/main/seller/backend/src/routes/sellers.js"
click node_admin_ui "https://github.com/badaseshirishab/threadline/blob/main/admin/frontend/src/App.js"
click node_admin_state "https://github.com/badaseshirishab/threadline/blob/main/admin/frontend/src/context/AdminContext.js"
click node_admin_api "https://github.com/badaseshirishab/threadline/blob/main/admin/backend/src/server.js"
click node_admin_routes "https://github.com/badaseshirishab/threadline/blob/main/admin/backend/src/routes/admin.js"
click node_delivery_ui "https://github.com/badaseshirishab/threadline/blob/main/delivery/frontend/src/context/JobsContext.js"
click node_delivery_api_client "https://github.com/badaseshirishab/threadline/blob/main/delivery/frontend/src/api/client.js"
click node_delivery_api "https://github.com/badaseshirishab/threadline/blob/main/delivery/backend/src/server.js"
click node_delivery_routes "https://github.com/badaseshirishab/threadline/blob/main/delivery/backend/src/routes/deliveries.js"
click node_shared_models "https://github.com/badaseshirishab/threadline/blob/main/shared/models.js"
click node_otp "https://github.com/badaseshirishab/threadline/blob/main/shared/otp.js"
click node_notifications "https://github.com/badaseshirishab/threadline/blob/main/shared/notify.js"

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_storefront,node_store_state,node_customer_api,node_customer_routes,node_catalog_routes,node_payments toneBlue
class node_seller_ui,node_seller_state,node_seller_api,node_seller_routes toneAmber
class node_admin_ui,node_admin_state,node_admin_api,node_admin_routes toneMint
class node_delivery_ui,node_delivery_api_client,node_delivery_api,node_delivery_routes toneRose
class node_shared_models,node_otp,node_notifications,node_customer_actor,node_seller_actor,node_admin_actor,node_delivery_actor toneIndigo
```

## Components

### Customer storefront

- [Storefront screens](https://github.com/badaseshirishab/threadline/blob/main/customer/frontend/src/App.js): `customer/frontend/src/App.js`
- [Store state](https://github.com/badaseshirishab/threadline/blob/main/customer/frontend/src/context/StoreContext.js): `customer/frontend/src/context/StoreContext.js`
- [Customer API](https://github.com/badaseshirishab/threadline/blob/main/customer/backend/src/server.js): `customer/backend/src/server.js`
- [Customer accounts](https://github.com/badaseshirishab/threadline/blob/main/customer/backend/src/routes/customers.js): `customer/backend/src/routes/customers.js`
- [Product catalog](https://github.com/badaseshirishab/threadline/blob/main/customer/backend/src/routes/products.js): `customer/backend/src/routes/products.js`
- [Payments and reservations](https://github.com/badaseshirishab/threadline/blob/main/customer/backend/src/utils/payments.js): `customer/backend/src/utils/payments.js`

### Seller operations

- [Seller workspace](https://github.com/badaseshirishab/threadline/blob/main/seller/frontend/src/App.js): `seller/frontend/src/App.js`
- [Seller state](https://github.com/badaseshirishab/threadline/blob/main/seller/frontend/src/context/SellerContext.js): `seller/frontend/src/context/SellerContext.js`
- [Seller API](https://github.com/badaseshirishab/threadline/blob/main/seller/backend/src/server.js): `seller/backend/src/server.js`
- [Seller management](https://github.com/badaseshirishab/threadline/blob/main/seller/backend/src/routes/sellers.js): `seller/backend/src/routes/sellers.js`

### Marketplace administration

- [Admin workspace](https://github.com/badaseshirishab/threadline/blob/main/admin/frontend/src/App.js): `admin/frontend/src/App.js`
- [Admin state](https://github.com/badaseshirishab/threadline/blob/main/admin/frontend/src/context/AdminContext.js): `admin/frontend/src/context/AdminContext.js`
- [Admin API](https://github.com/badaseshirishab/threadline/blob/main/admin/backend/src/server.js): `admin/backend/src/server.js`
- [Marketplace controls](https://github.com/badaseshirishab/threadline/blob/main/admin/backend/src/routes/admin.js): `admin/backend/src/routes/admin.js`

### Delivery operations

- [Delivery workspace](https://github.com/badaseshirishab/threadline/blob/main/delivery/frontend/src/context/JobsContext.js): `delivery/frontend/src/context/JobsContext.js`
- [Delivery API client](https://github.com/badaseshirishab/threadline/blob/main/delivery/frontend/src/api/client.js): `delivery/frontend/src/api/client.js`
- [Delivery API](https://github.com/badaseshirishab/threadline/blob/main/delivery/backend/src/server.js): `delivery/backend/src/server.js`
- [Delivery and returns](https://github.com/badaseshirishab/threadline/blob/main/delivery/backend/src/routes/deliveries.js): `delivery/backend/src/routes/deliveries.js`

### Shared platform

- [Shared schemas](https://github.com/badaseshirishab/threadline/blob/main/shared/models.js): `shared/models.js`
- [Verification codes](https://github.com/badaseshirishab/threadline/blob/main/shared/otp.js): `shared/otp.js`
- [Messaging](https://github.com/badaseshirishab/threadline/blob/main/shared/notify.js): `shared/notify.js`

### Other components

- **Customer**
- **Seller**
- **Administrator**
- **Delivery partner**

## Connections

- Customer → Storefront screens: browses and buys (evidence: `customer/frontend/src/App.js`)
- Storefront screens → Store state: uses state (evidence: `customer/frontend/src/App.js`)
- Store state → Customer API: requests data (evidence: `customer/frontend/src/context/StoreContext.js`)
- Customer API → Customer accounts: mounts accounts (evidence: `customer/backend/src/server.js`)
- Customer API → Product catalog: mounts catalog (evidence: `customer/backend/src/server.js`)
- Customer API → Payments and reservations: releases expired payments (evidence: `customer/backend/src/server.js`)
- Seller → Seller workspace: manages shop (evidence: `seller/frontend/src/App.js`)
- Seller workspace → Seller state: uses state (evidence: `seller/frontend/src/App.js`)
- Seller state → Seller API: requests seller data (evidence: `seller/frontend/src/context/SellerContext.js`)
- Seller API → Seller management: mounts management (evidence: `seller/backend/src/server.js`)
- Administrator → Admin workspace: governs marketplace (evidence: `admin/frontend/src/App.js`)
- Admin workspace → Admin state: uses state (evidence: `admin/frontend/src/App.js`)
- Admin state → Admin API: requests admin data (evidence: `admin/frontend/src/context/AdminContext.js`)
- Admin API → Marketplace controls: mounts controls (evidence: `admin/backend/src/server.js`)
- Delivery partner → Delivery workspace: handles assigned work (evidence: `README.md`)
- Delivery workspace → Delivery API client: requests jobs (evidence: `delivery/frontend/src/context/JobsContext.js`)
- Delivery API client → Delivery API: calls API (evidence: `README.md`)
- Delivery API → Delivery and returns: mounts deliveries (evidence: `delivery/backend/src/server.js`)
- Customer API → Shared schemas: registers shared schemas
- Seller API → Shared schemas: registers shared schemas
- Admin API → Shared schemas: registers shared schemas
- Delivery API → Shared schemas: registers shared schemas
- Customer API → Verification codes: supports customer verification
- Delivery and returns → Verification codes: sends and checks codes
- Verification codes → Messaging: sends verification messages (evidence: `shared/otp.js`)
- Customer API → Seller API: shares marketplace database (evidence: `README.md`)
- Admin API → Seller API: approves sellers and products (evidence: `README.md`)
- Admin API → Delivery API: manages delivery partners (evidence: `README.md`)
