# ananiasileshi/tibebstore architecture

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

- Interactive diagram: https://gitdiagram.com/ananiasileshi/tibebstore
- Repository: https://github.com/ananiasileshi/tibebstore

## Overview

TibebStore is a multi-tenant marketplace for Ethiopian handicrafts. Buyers browse artisan storefronts, authenticate, place tenant-scoped orders, pay through Chapa, and track fulfillment; sellers manage products and orders, while administrators moderate listings and govern marketplace finances. The graph combines README-documented capabilities with the sampled order, authentication, review, and model code. Many routes and integrations were not sampled, so their documented relationships are shown with README evidence rather than implying unseen calls.

Main entry points: [`src/app/api/orders/route.ts`](https://github.com/ananiasileshi/tibebstore/blob/main/src/app/api/orders/route.ts) (Order placement), [`src/models/Order.ts`](https://github.com/ananiasileshi/tibebstore/blob/main/src/models/Order.ts) (Orders and fulfillment), [`src/app/api/reviews/route.ts`](https://github.com/ananiasileshi/tibebstore/blob/main/src/app/api/reviews/route.ts) (Verified reviews), [`src/app/api/payments/chapa/initialize/route.ts`](https://github.com/ananiasileshi/tibebstore/blob/main/src/app/api/payments/chapa/initialize/route.ts) (Chapa payments)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Marketplace experience"]
  node_storefronts["Tenant storefronts<br/>[page.tsx]"]
  node_product_browse["Product discovery"]
  node_product_detail["Product details"]
  node_auth_ui["Account experience<br/>[useAuth.tsx]"]
  node_reviews["Verified reviews<br/>[route.ts]"]
end

subgraph group_commerce["Commerce operations"]
  node_tenant_data[("Artisan tenants<br/>[Tenant.ts]")]
  node_product_data[("Product catalog<br/>[Product.ts]")]
  node_seller_ops["Seller operations<br/>[route.ts]"]
  node_order_api["Order placement<br/>[route.ts]"]
  node_order_data[("Orders and fulfillment<br/>[Order.ts]")]
  node_payment_api["Chapa payments<br/>[route.ts]"]
  node_escrow["Escrow and payouts<br/>[escrow.ts]"]
  node_review_data[("Review records<br/>[Review.ts]")]
end

subgraph group_governance["Marketplace governance"]
  node_moderation["Product moderation<br/>[route.ts]"]
  node_admin["Admin governance<br/>[route.ts]"]
  node_reports["Reports and analytics<br/>[route.ts]"]
end

subgraph group_platform["Platform services"]
  node_auth_api["Authentication API<br/>[route.ts]"]
  node_auth_core["Session and access<br/>[requireAuth.ts]"]
  node_database[("MongoDB connection<br/>[mongodb.ts]")]
  node_notifications["Notifications<br/>[notifications.ts]"]
end

node_visitors(("Buyers and sellers"))
node_chapa["Chapa"]

node_visitors -->|"visit"| node_storefronts
node_storefronts -.->|"browse listings"| node_product_browse
node_product_browse -.->|"open product"| node_product_detail
node_visitors -.->|"manage account"| node_auth_ui
node_auth_ui -->|"sign in or up"| node_auth_api
node_auth_api -.->|"establish session"| node_auth_core
node_storefronts -->|"tenant routing"| node_tenant_data
node_product_browse -->|"browse catalog"| node_product_data
node_seller_ops -->|"manage listings"| node_product_data
node_seller_ops -->|"manage storefront"| node_tenant_data
node_visitors -->|"place order"| node_order_api
node_order_api -->|"authorize request"| node_auth_core
node_order_api -->|"resolve tenant"| node_tenant_data
node_order_api -->|"validate products"| node_product_data
node_order_api -->|"create order"| node_order_data
node_order_api -->|"notify seller"| node_notifications
node_order_data -->|"payment lifecycle"| node_payment_api
node_payment_api -->|"initialize payment"| node_chapa
node_chapa -->|"send webhook"| node_payment_api
node_payment_api -->|"hold funds"| node_escrow
node_escrow -->|"update release state"| node_order_data
node_escrow -->|"calculate payout"| node_tenant_data
node_visitors -->|"review purchase"| node_reviews
node_reviews -->|"verify delivery"| node_order_data
node_reviews -->|"read and write"| node_review_data
node_admin -->|"review products"| node_moderation
node_admin -->|"inspect performance"| node_reports
node_moderation -->|"approve listings"| node_product_data
node_reports -->|"analyze commerce"| node_order_data
node_order_api -->|"connect"| node_database
node_reviews -->|"connect"| node_database

click node_storefronts "https://github.com/ananiasileshi/tibebstore/blob/main/src/app/tenant/%5Bslug%5D/page.tsx"
click node_product_browse "https://github.com/ananiasileshi/tibebstore/blob/main/src/components/products/ProductListingContainer.tsx"
click node_product_detail "https://github.com/ananiasileshi/tibebstore/blob/main/src/components/products/ProductDetailContainer.tsx"
click node_auth_ui "https://github.com/ananiasileshi/tibebstore/blob/main/src/hooks/useAuth.tsx"
click node_auth_api "https://github.com/ananiasileshi/tibebstore/blob/main/src/app/api/auth/sign-in/route.ts"
click node_auth_core "https://github.com/ananiasileshi/tibebstore/blob/main/src/lib/requireAuth.ts"
click node_tenant_data "https://github.com/ananiasileshi/tibebstore/blob/main/src/models/Tenant.ts"
click node_product_data "https://github.com/ananiasileshi/tibebstore/blob/main/src/models/Product.ts"
click node_seller_ops "https://github.com/ananiasileshi/tibebstore/blob/main/src/app/api/seller/products/route.ts"
click node_order_api "https://github.com/ananiasileshi/tibebstore/blob/main/src/app/api/orders/route.ts"
click node_order_data "https://github.com/ananiasileshi/tibebstore/blob/main/src/models/Order.ts"
click node_payment_api "https://github.com/ananiasileshi/tibebstore/blob/main/src/app/api/payments/chapa/initialize/route.ts"
click node_escrow "https://github.com/ananiasileshi/tibebstore/blob/main/src/lib/escrow.ts"
click node_reviews "https://github.com/ananiasileshi/tibebstore/blob/main/src/app/api/reviews/route.ts"
click node_review_data "https://github.com/ananiasileshi/tibebstore/blob/main/src/models/Review.ts"
click node_moderation "https://github.com/ananiasileshi/tibebstore/blob/main/src/app/api/admin/products/route.ts"
click node_admin "https://github.com/ananiasileshi/tibebstore/blob/main/src/app/api/admin/analytics/route.ts"
click node_reports "https://github.com/ananiasileshi/tibebstore/blob/main/src/app/api/reports/route.ts"
click node_database "https://github.com/ananiasileshi/tibebstore/blob/main/src/lib/mongodb.ts"
click node_notifications "https://github.com/ananiasileshi/tibebstore/blob/main/src/lib/notifications.ts"

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_storefronts,node_product_browse,node_product_detail,node_auth_ui,node_reviews toneBlue
class node_tenant_data,node_product_data,node_seller_ops,node_order_api,node_order_data,node_payment_api,node_escrow,node_review_data toneAmber
class node_moderation,node_admin,node_reports toneMint
class node_auth_api,node_auth_core,node_database,node_notifications toneRose
class node_visitors,node_chapa toneIndigo
```

## Components

### Marketplace experience

- [Tenant storefronts](https://github.com/ananiasileshi/tibebstore/blob/main/src/app/tenant/%5Bslug%5D/page.tsx): `src/app/tenant/[slug]/page.tsx`
- [Product discovery](https://github.com/ananiasileshi/tibebstore/blob/main/src/components/products/ProductListingContainer.tsx): `src/components/products/ProductListingContainer.tsx`
- [Product details](https://github.com/ananiasileshi/tibebstore/blob/main/src/components/products/ProductDetailContainer.tsx): `src/components/products/ProductDetailContainer.tsx`
- [Account experience](https://github.com/ananiasileshi/tibebstore/blob/main/src/hooks/useAuth.tsx): `src/hooks/useAuth.tsx`
- [Verified reviews](https://github.com/ananiasileshi/tibebstore/blob/main/src/app/api/reviews/route.ts): `src/app/api/reviews/route.ts`

### Commerce operations

- [Artisan tenants](https://github.com/ananiasileshi/tibebstore/blob/main/src/models/Tenant.ts): `src/models/Tenant.ts`
- [Product catalog](https://github.com/ananiasileshi/tibebstore/blob/main/src/models/Product.ts): `src/models/Product.ts`
- [Seller operations](https://github.com/ananiasileshi/tibebstore/blob/main/src/app/api/seller/products/route.ts): `src/app/api/seller/products/route.ts`
- [Order placement](https://github.com/ananiasileshi/tibebstore/blob/main/src/app/api/orders/route.ts): `src/app/api/orders/route.ts`
- [Orders and fulfillment](https://github.com/ananiasileshi/tibebstore/blob/main/src/models/Order.ts): `src/models/Order.ts`
- [Chapa payments](https://github.com/ananiasileshi/tibebstore/blob/main/src/app/api/payments/chapa/initialize/route.ts): `src/app/api/payments/chapa/initialize/route.ts`
- [Escrow and payouts](https://github.com/ananiasileshi/tibebstore/blob/main/src/lib/escrow.ts): `src/lib/escrow.ts`
- [Review records](https://github.com/ananiasileshi/tibebstore/blob/main/src/models/Review.ts): `src/models/Review.ts`

### Marketplace governance

- [Product moderation](https://github.com/ananiasileshi/tibebstore/blob/main/src/app/api/admin/products/route.ts): `src/app/api/admin/products/route.ts`
- [Admin governance](https://github.com/ananiasileshi/tibebstore/blob/main/src/app/api/admin/analytics/route.ts): `src/app/api/admin/analytics/route.ts`
- [Reports and analytics](https://github.com/ananiasileshi/tibebstore/blob/main/src/app/api/reports/route.ts): `src/app/api/reports/route.ts`

### Platform services

- [Authentication API](https://github.com/ananiasileshi/tibebstore/blob/main/src/app/api/auth/sign-in/route.ts): `src/app/api/auth/sign-in/route.ts`
- [Session and access](https://github.com/ananiasileshi/tibebstore/blob/main/src/lib/requireAuth.ts): `src/lib/requireAuth.ts`
- [MongoDB connection](https://github.com/ananiasileshi/tibebstore/blob/main/src/lib/mongodb.ts): `src/lib/mongodb.ts`
- [Notifications](https://github.com/ananiasileshi/tibebstore/blob/main/src/lib/notifications.ts): `src/lib/notifications.ts`

### Other components

- **Buyers and sellers**
- **Chapa**

## Connections

- Buyers and sellers → Tenant storefronts: visit
- Tenant storefronts → Product discovery: browse listings
- Product discovery → Product details: open product
- Buyers and sellers → Account experience: manage account
- Account experience → Authentication API: sign in or up (evidence: `src/hooks/useAuth.tsx`)
- Authentication API → Session and access: establish session
- Tenant storefronts → Artisan tenants: tenant routing
- Product discovery → Product catalog: browse catalog
- Seller operations → Product catalog: manage listings
- Seller operations → Artisan tenants: manage storefront
- Buyers and sellers → Order placement: place order
- Order placement → Session and access: authorize request (evidence: `src/app/api/orders/route.ts`)
- Order placement → Artisan tenants: resolve tenant (evidence: `src/app/api/orders/route.ts`)
- Order placement → Product catalog: validate products (evidence: `src/app/api/orders/route.ts`)
- Order placement → Orders and fulfillment: create order (evidence: `src/app/api/orders/route.ts`)
- Order placement → Notifications: notify seller (evidence: `src/app/api/orders/route.ts`)
- Orders and fulfillment → Chapa payments: payment lifecycle
- Chapa payments → Chapa: initialize payment
- Chapa → Chapa payments: send webhook
- Chapa payments → Escrow and payouts: hold funds
- Escrow and payouts → Orders and fulfillment: update release state
- Escrow and payouts → Artisan tenants: calculate payout
- Buyers and sellers → Verified reviews: review purchase
- Verified reviews → Orders and fulfillment: verify delivery (evidence: `src/app/api/reviews/route.ts`)
- Verified reviews → Review records: read and write (evidence: `src/app/api/reviews/route.ts`)
- Admin governance → Product moderation: review products
- Admin governance → Reports and analytics: inspect performance
- Product moderation → Product catalog: approve listings
- Reports and analytics → Orders and fulfillment: analyze commerce
- Order placement → MongoDB connection: connect (evidence: `src/app/api/orders/route.ts`)
- Verified reviews → MongoDB connection: connect (evidence: `src/app/api/reviews/route.ts`)
