# kairo-2081/shopniro architecture

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

- Interactive diagram: https://gitdiagram.com/kairo-2081/shopniro
- Repository: https://github.com/kairo-2081/shopniro

## Overview

ShopNiro is a multi-vendor marketplace. Customers discover products, manage carts, check out through supported payment methods, and follow orders; sellers manage products and bundles, riders handle delivery, and admins oversee marketplace operations. The frontend’s shared API client communicates with an Express API, whose domain routes use PostgreSQL for marketplace state. The README documents Gemini assistance, seller approval, payouts, support, and scheduled order/refund work. Some frontend and route wiring is unsampled, so those documented capabilities are shown without speculative internal call chains.

Main entry points: [`server/app.ts`](https://github.com/kairo-2081/shopniro/blob/main/server/app.ts) (HTTP API), [`src/lib/api.ts`](https://github.com/kairo-2081/shopniro/blob/main/src/lib/api.ts) (API client), [`server/db/index.ts`](https://github.com/kairo-2081/shopniro/blob/main/server/db/index.ts) (PostgreSQL), [`src/App.tsx`](https://github.com/kairo-2081/shopniro/blob/main/src/App.tsx) (Web application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Marketplace experience"]
  node_app["Web application<br/>[App.tsx]"]
  node_ai_assistant["Gemini assistant<br/>[GeminiChatbot.tsx]"]
end

subgraph group_commerce["Shopping and fulfillment"]
  node_storefront["Storefront<br/>[Storefront.tsx]"]
  node_checkout["Checkout<br/>[CheckoutModal.tsx]"]
  node_customer_orders["Customer orders<br/>[CustomerOrders.tsx]"]
end

subgraph group_operations["Marketplace operations"]
  node_seller_dashboard["Seller dashboard"]
  node_admin_dashboard["Admin dashboard<br/>[AdminDashboard.tsx]"]
  node_rider_dashboard["Rider dashboard<br/>[RiderDashboard.tsx]"]
end

subgraph group_backend["API and domain services"]
  node_api_client["API client<br/>[api.ts]"]
  node_api_app["HTTP API<br/>[app.ts]"]
  node_auth["Session authentication<br/>[auth.ts]"]
  node_orders["Orders and refunds<br/>[orders.routes.ts]"]
  node_payments["Payment processing<br/>[payment.routes.ts]"]
  node_products["Product catalog<br/>[products.routes.ts]"]
  node_ai_routes["AI assistance<br/>[ai.routes.ts]"]
  node_rider_routes["Rider delivery"]
  node_reviews["Product reviews<br/>[reviews.routes.ts]"]
  node_payouts["Seller payouts<br/>[payouts.routes.ts]"]
  node_support["Support requests<br/>[support.routes.ts]"]
end

subgraph group_platform["Persistence and integrations"]
  node_database[("PostgreSQL<br/>[index.ts]")]
  node_sslcommerz["SSLCOMMERZ gateway"]
  node_gemini["Gemini service"]
end

node_shopper(("Customer"))
node_seller(("Seller"))
node_rider(("Rider"))
node_admin(("Admin"))

node_shopper -->|"shops"| node_app
node_seller -->|"manages store"| node_seller_dashboard
node_admin -->|"oversees marketplace"| node_admin_dashboard
node_rider -->|"handles delivery"| node_rider_dashboard
node_app -->|"renders"| node_storefront
node_shopper -->|"discovers products"| node_storefront
node_storefront -.->|"starts checkout"| node_checkout
node_checkout -->|"requests checkout"| node_api_client
node_customer_orders -->|"loads orders"| node_api_client
node_seller_dashboard -->|"manages listings"| node_api_client
node_admin_dashboard -->|"loads operations"| node_api_client
node_rider_dashboard -.->|"updates delivery"| node_api_client
node_app -->|"uses"| node_api_client
node_api_client -->|"sends HTTP requests"| node_api_app
node_api_app -->|"authenticates sessions"| node_auth
node_api_app -->|"routes order requests"| node_orders
node_api_app -->|"routes payment requests"| node_payments
node_api_app -->|"routes catalog requests"| node_products
node_api_app -->|"routes AI requests"| node_ai_routes
node_api_app -->|"routes delivery requests"| node_rider_routes
node_api_app -->|"routes review requests"| node_reviews
node_orders -->|"reads and writes"| node_database
node_payments -->|"updates payment state"| node_database
node_payments -->|"starts gateway payment"| node_sslcommerz
node_products -.->|"reads and writes"| node_database
node_reviews -->|"reads and writes"| node_database
node_rider_routes -->|"reads and writes"| node_database
node_ai_assistant -.->|"requests assistance"| node_api_client
node_ai_routes -->|"loads marketplace context"| node_database
node_ai_routes -.->|"requests AI response"| node_gemini
node_payouts -.->|"records payouts"| node_database
node_support -.->|"stores requests"| node_database

click node_app "https://github.com/kairo-2081/shopniro/blob/main/src/App.tsx"
click node_storefront "https://github.com/kairo-2081/shopniro/blob/main/src/components/storefront/Storefront.tsx"
click node_checkout "https://github.com/kairo-2081/shopniro/blob/main/src/components/storefront/CheckoutModal.tsx"
click node_customer_orders "https://github.com/kairo-2081/shopniro/blob/main/src/components/customer/CustomerOrders.tsx"
click node_seller_dashboard "https://github.com/kairo-2081/shopniro/blob/main/src/components/seller/SellerDashboard.tsx"
click node_admin_dashboard "https://github.com/kairo-2081/shopniro/blob/main/src/components/admin/AdminDashboard.tsx"
click node_rider_dashboard "https://github.com/kairo-2081/shopniro/blob/main/src/components/rider/RiderDashboard.tsx"
click node_ai_assistant "https://github.com/kairo-2081/shopniro/blob/main/src/components/chat/GeminiChatbot.tsx"
click node_api_client "https://github.com/kairo-2081/shopniro/blob/main/src/lib/api.ts"
click node_api_app "https://github.com/kairo-2081/shopniro/blob/main/server/app.ts"
click node_auth "https://github.com/kairo-2081/shopniro/blob/main/server/middleware/auth.ts"
click node_orders "https://github.com/kairo-2081/shopniro/blob/main/server/routes/orders.routes.ts"
click node_payments "https://github.com/kairo-2081/shopniro/blob/main/server/routes/payment.routes.ts"
click node_products "https://github.com/kairo-2081/shopniro/blob/main/server/routes/products.routes.ts"
click node_ai_routes "https://github.com/kairo-2081/shopniro/blob/main/server/routes/ai.routes.ts"
click node_rider_routes "https://github.com/kairo-2081/shopniro/blob/main/server/routes/rider-delivery.routes.ts"
click node_reviews "https://github.com/kairo-2081/shopniro/blob/main/server/routes/reviews.routes.ts"
click node_database "https://github.com/kairo-2081/shopniro/blob/main/server/db/index.ts"
click node_sslcommerz "https://github.com/kairo-2081/shopniro/blob/main/server/services/sslcommerz.service.ts"
click node_payouts "https://github.com/kairo-2081/shopniro/blob/main/server/routes/payouts.routes.ts"
click node_support "https://github.com/kairo-2081/shopniro/blob/main/server/routes/support.routes.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_app,node_ai_assistant toneBlue
class node_storefront,node_checkout,node_customer_orders toneAmber
class node_seller_dashboard,node_admin_dashboard,node_rider_dashboard toneMint
class node_api_client,node_api_app,node_auth,node_orders,node_payments,node_products,node_ai_routes,node_rider_routes,node_reviews,node_payouts,node_support toneRose
class node_database,node_sslcommerz,node_gemini,node_shopper,node_seller,node_rider,node_admin toneIndigo
```

## Components

### Marketplace experience

- [Web application](https://github.com/kairo-2081/shopniro/blob/main/src/App.tsx): `src/App.tsx`
- [Gemini assistant](https://github.com/kairo-2081/shopniro/blob/main/src/components/chat/GeminiChatbot.tsx): `src/components/chat/GeminiChatbot.tsx`

### Shopping and fulfillment

- [Storefront](https://github.com/kairo-2081/shopniro/blob/main/src/components/storefront/Storefront.tsx): `src/components/storefront/Storefront.tsx`
- [Checkout](https://github.com/kairo-2081/shopniro/blob/main/src/components/storefront/CheckoutModal.tsx): `src/components/storefront/CheckoutModal.tsx`
- [Customer orders](https://github.com/kairo-2081/shopniro/blob/main/src/components/customer/CustomerOrders.tsx): `src/components/customer/CustomerOrders.tsx`

### Marketplace operations

- [Seller dashboard](https://github.com/kairo-2081/shopniro/blob/main/src/components/seller/SellerDashboard.tsx): `src/components/seller/SellerDashboard.tsx`
- [Admin dashboard](https://github.com/kairo-2081/shopniro/blob/main/src/components/admin/AdminDashboard.tsx): `src/components/admin/AdminDashboard.tsx`
- [Rider dashboard](https://github.com/kairo-2081/shopniro/blob/main/src/components/rider/RiderDashboard.tsx): `src/components/rider/RiderDashboard.tsx`

### API and domain services

- [API client](https://github.com/kairo-2081/shopniro/blob/main/src/lib/api.ts): `src/lib/api.ts`
- [HTTP API](https://github.com/kairo-2081/shopniro/blob/main/server/app.ts): `server/app.ts`
- [Session authentication](https://github.com/kairo-2081/shopniro/blob/main/server/middleware/auth.ts): `server/middleware/auth.ts`
- [Orders and refunds](https://github.com/kairo-2081/shopniro/blob/main/server/routes/orders.routes.ts): `server/routes/orders.routes.ts`
- [Payment processing](https://github.com/kairo-2081/shopniro/blob/main/server/routes/payment.routes.ts): `server/routes/payment.routes.ts`
- [Product catalog](https://github.com/kairo-2081/shopniro/blob/main/server/routes/products.routes.ts): `server/routes/products.routes.ts`
- [AI assistance](https://github.com/kairo-2081/shopniro/blob/main/server/routes/ai.routes.ts): `server/routes/ai.routes.ts`
- [Rider delivery](https://github.com/kairo-2081/shopniro/blob/main/server/routes/rider-delivery.routes.ts): `server/routes/rider-delivery.routes.ts`
- [Product reviews](https://github.com/kairo-2081/shopniro/blob/main/server/routes/reviews.routes.ts): `server/routes/reviews.routes.ts`
- [Seller payouts](https://github.com/kairo-2081/shopniro/blob/main/server/routes/payouts.routes.ts): `server/routes/payouts.routes.ts`
- [Support requests](https://github.com/kairo-2081/shopniro/blob/main/server/routes/support.routes.ts): `server/routes/support.routes.ts`

### Persistence and integrations

- [PostgreSQL](https://github.com/kairo-2081/shopniro/blob/main/server/db/index.ts): `server/db/index.ts`
- [SSLCOMMERZ gateway](https://github.com/kairo-2081/shopniro/blob/main/server/services/sslcommerz.service.ts): `server/services/sslcommerz.service.ts`
- **Gemini service**

### Other components

- **Customer**
- **Seller**
- **Rider**
- **Admin**

## Connections

- Customer → Web application: shops (evidence: `README.md`)
- Seller → Seller dashboard: manages store (evidence: `README.md`)
- Admin → Admin dashboard: oversees marketplace (evidence: `README.md`)
- Rider → Rider dashboard: handles delivery (evidence: `README.md`)
- Web application → Storefront: renders (evidence: `src/App.tsx`)
- Customer → Storefront: discovers products (evidence: `README.md`)
- Storefront → Checkout: starts checkout
- Checkout → API client: requests checkout (evidence: `src/components/storefront/CheckoutModal.tsx`)
- Customer orders → API client: loads orders (evidence: `src/components/customer/CustomerOrders.tsx`)
- Seller dashboard → API client: manages listings (evidence: `src/components/seller/SellerDashboard.tsx`)
- Admin dashboard → API client: loads operations (evidence: `src/components/admin/AdminDashboard.tsx`)
- Rider dashboard → API client: updates delivery
- Web application → API client: uses (evidence: `src/App.tsx`)
- API client → HTTP API: sends HTTP requests (evidence: `src/lib/api.ts`)
- HTTP API → Session authentication: authenticates sessions (evidence: `server/app.ts`)
- HTTP API → Orders and refunds: routes order requests (evidence: `server/app.ts`)
- HTTP API → Payment processing: routes payment requests (evidence: `server/app.ts`)
- HTTP API → Product catalog: routes catalog requests (evidence: `server/app.ts`)
- HTTP API → AI assistance: routes AI requests (evidence: `server/app.ts`)
- HTTP API → Rider delivery: routes delivery requests (evidence: `server/app.ts`)
- HTTP API → Product reviews: routes review requests (evidence: `server/app.ts`)
- Orders and refunds → PostgreSQL: reads and writes (evidence: `server/routes/orders.routes.ts`)
- Payment processing → PostgreSQL: updates payment state (evidence: `server/routes/payment.routes.ts`)
- Payment processing → SSLCOMMERZ gateway: starts gateway payment (evidence: `server/routes/payment.routes.ts`)
- Product catalog → PostgreSQL: reads and writes
- Product reviews → PostgreSQL: reads and writes (evidence: `server/routes/reviews.routes.ts`)
- Rider delivery → PostgreSQL: reads and writes (evidence: `server/routes/rider-delivery.routes.ts`)
- Gemini assistant → API client: requests assistance
- AI assistance → PostgreSQL: loads marketplace context (evidence: `server/routes/ai.routes.ts`)
- AI assistance → Gemini service: requests AI response
- Seller payouts → PostgreSQL: records payouts
- Support requests → PostgreSQL: stores requests
