# rgc4/bazaar architecture

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

- Interactive diagram: https://gitdiagram.com/rgc4/bazaar
- Repository: https://github.com/rgc4/bazaar

## Overview

#### Purpose and Runtime
This is a TypeScript Next.js App Router storefront/template suite: multiple ecommerce storefront variants, product discovery, cart/checkout, customer account pages, and an admin/vendor dashboard. The primary runtime boundary is the Next application under `src/app`, configured by `next.config.ts`; static visual content is served from `public/assets/images`.

#### Route Entry Points and Composition
`src/app/layout.tsx` is the application-wide shell; `src/app/page.tsx` is the landing entry. Route groups isolate major shells without changing URLs:
- Storefront variants: `src/app/fashion-1/page.tsx`, `src/app/grocery-1/page.tsx`, `src/app/market-1/page.tsx`.
- Commerce routes: `src/app/products/[slug]/page.tsx`, `src/app/shops/[slug]/page.tsx`, `src/app/products/search/page.tsx`.
- Checkout flow: `src/app/(checkout)/cart/page.tsx`, `src/app/(checkout)/checkout/page.tsx`, `src/app/(checkout)/payment/page.tsx`.
- Dashboard shells: `src/app/(customer-dashboard)/layout.tsx`, `src/app/(admin-dashboard)/layout.tsx`.

Route pages generally delegate presentation to feature-specific assemblies in `src/pages-sections`.

#### Storefront Template Layer
Each visual shop variant has a route-level layout/page, a composed page-view, and section components. This supports distinct branded storefronts while reusing common cards, navigation, and layout primitives.
- Example composition: `src/app/fashion-1/page.tsx` → `src/pages-sections/fashion-1/page-view/fashion-1.tsx` → `src/pages-sections/fashion-1/section-1/section-1.tsx`.
- Shared storefront building blocks include `src/components/header/header.tsx`, `src/components/footer/footer-1.tsx`, and `src/components/product-cards/product-card-1/product-card.tsx`.
- Category-detail routes are explicit dynamic segments, e.g. `src/app/grocery-1/[category]/page.tsx` and `src/app/furniture-3/categories/[slug]/page.tsx`.

#### Data Access and Domain Boundary
The repository is currently backed by local mock/database modules rather than visible API route handlers or persistent infrastructure. UI-facing fetch adapters sit in `src/utils/__api__`, while their data sources are grouped in `src/__server__/__db__`.
- Product flows: `src/utils/__api__/products.ts`, `src/__server__/__db__/products/index.ts`, `src/models/Product.model.ts`.
- Storefront-specific data is isolated per template, e.g. `src/utils/__api__/grocery-1.ts` and `src/__server__/__db__/grocery-1/data.ts`.
- `src/utils/axiosInstance.ts` is the likely external HTTP integration seam. No concrete third-party backend, payment gateway, auth provider, or database service is identifiable from the tree.

#### Commerce State and Purchase Flow
Cart state is client-side context-driven: `src/contexts/CartContext.tsx` is accessed through `src/hooks/useCart.ts` and consumed by product-card/detail add-to-cart controls and cart views.
- Product selection begins in `src/pages-sections/product-details/product-intro/add-to-cart.tsx`.
- Cart rendering and editing are in `src/pages-sections/cart/page-view/cart.tsx`.
- Checkout, payment, and confirmation are staged in `src/pages-sections/checkout/page-view/checkout.tsx`, `src/pages-sections/payment/page-view/payment.tsx`, and `src/pages-sections/order-confirmation/page-view.tsx`.
- API-shaped checkout access is separated in `src/utils/__api__/checkout.ts`; it currently boundaries UI from mock or future service implementations.

#### Account, Admin, and Dashboard Domains
Customer routes provide addresses, orders, payment methods, profile, tickets, and wish lists; admin routes manage catalog, customers, sellers, orders, payouts, reviews, and refunds.
- Customer account composition: `src/pages-sections/customer-dashboard/address/page-view/address.tsx`, `src/pages-sections/customer-dashboard/orders/page-view/orders.tsx`.
- Admin dashboard layout/navigation: `src/components/layouts/vendor-dashboard/dashboard-layout.tsx`, `src/components/layouts/vendor-dashboard/dashboard-navigation.ts`.
- Administrative page assemblies and data adapters: `src/pages-sections/vendor-dashboard/products/page-view/products.tsx`, `src/utils/__api__/dashboard.ts`, `src/__server__/__db__/dashboard/index.ts`.

#### Cross-Cutting UI Platform
The shared UI platform provides theming, settings, translations, reusable interaction primitives, and modal interception routes.
- Theme configuration/provider: `src/theme/theme-provider.tsx`, `src/theme/theme-options.ts`.
- User-configurable UI settings: `src/contexts/SettingContext.tsx`, `src/hooks/useSettings.ts`.
- Localization resources: `src/i18n/index.ts`, `src/i18n/resource.ts`.
- Parallel/intercepted UI overlays support login, mini-cart, and quick product view via `src/app/@modal/default.tsx`, `src/app/@modal/(.)mini-cart/page.tsx`, and `src/app/@modal/(.)products/[slug]/view/page.tsx`.

Main entry points: [`src/app/layout.tsx`](https://github.com/rgc4/bazaar/blob/main/src/app/layout.tsx) (Application shell), [`src/utils/__api__/products.ts`](https://github.com/rgc4/bazaar/blob/main/src/utils/__api__/products.ts) (Product data adapter), [`src/app/fashion-1/page.tsx`](https://github.com/rgc4/bazaar/blob/main/src/app/fashion-1/page.tsx) (Storefront routes), [`src/pages-sections/fashion-1/page-view/fashion-1.tsx`](https://github.com/rgc4/bazaar/blob/main/src/pages-sections/fashion-1/page-view/fashion-1.tsx) (Fashion page view)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Next runtime"]
  node_next_config["Next configuration<br/>Next.js config<br/>[next.config.ts]"]
  node_app_shell["Application shell<br/>root layout<br/>[layout.tsx]"]
  node_landing["Landing route<br/>App Router page<br/>[page.tsx]"]
end

subgraph group_storefront["Storefront"]
  node_storefront_routes["Storefront routes<br/>variant pages<br/>[page.tsx]"]
  node_fashion_page_view["Fashion page view<br/>page assembly<br/>[fashion-1.tsx]"]
  node_fashion_sections["Storefront sections<br/>section components<br/>[section-1.tsx]"]
  node_shared_storefront_ui["Shared storefront UI<br/>cards and chrome<br/>[header.tsx]"]
  node_catalog_routes["Catalog routes<br/>[page.tsx]"]
end

subgraph group_commerce["Commerce flow"]
  node_cart_context{{"Cart state<br/>client context<br/>[CartContext.tsx]"}}
  node_cart_hook["Cart hook<br/>context access<br/>[useCart.ts]"]
  node_add_to_cart["Add-to-cart control<br/>product interaction<br/>[add-to-cart.tsx]"]
  node_cart_route["Cart route<br/>checkout route<br/>[page.tsx]"]
  node_cart_view["Cart view<br/>page assembly<br/>[cart.tsx]"]
  node_checkout_stages["Checkout and payment<br/>purchase assemblies<br/>[checkout.tsx]"]
end

subgraph group_dashboard["Dashboards"]
  node_customer_shell["Customer dashboard shell<br/>route-group layout<br/>[layout.tsx]"]
  node_customer_pages["Customer account pages<br/>dashboard assemblies<br/>[orders.tsx]"]
  node_admin_shell["Admin dashboard shell<br/>route-group layout<br/>[layout.tsx]"]
  node_vendor_layout["Vendor dashboard layout<br/>dashboard navigation"]
  node_admin_pages["Admin management pages<br/>dashboard assemblies<br/>[products.tsx]"]
end

subgraph group_platform["UI platform"]
  node_theme_and_settings{{"Theme and settings<br/>UI providers<br/>[theme-provider.tsx]"}}
  node_localization["Localization<br/>i18n resources<br/>[index.ts]"]
  node_modal_overlays["Modal overlays<br/>parallel intercepted routes<br/>[page.tsx]"]
end

subgraph group_data["Data boundary"]
  node_product_api["Product data adapter<br/>UI fetch adapter<br/>[products.ts]"]
  node_product_db[("Product mock data<br/>local database module<br/>[index.ts]")]
  node_product_model["Product model<br/>domain model<br/>[Product.model.ts]"]
  node_template_data["Template data adapter<br/>storefront fetch adapter<br/>[grocery-1.ts]"]
  node_template_db[("Template mock data<br/>local database module<br/>[data.ts]")]
  node_checkout_api["Checkout adapter<br/>service seam<br/>[checkout.ts]"]
  node_dashboard_api["Dashboard data adapter<br/>UI fetch adapter<br/>[dashboard.ts]"]
  node_dashboard_db[("Dashboard mock data<br/>local database module<br/>[index.ts]")]
  node_http_seam["HTTP integration seam<br/>Axios instance<br/>[axiosInstance.ts]"]
end

node_next_config -.->|"configures"| node_app_shell
node_app_shell -->|"hosts"| node_landing
node_app_shell -->|"hosts"| node_storefront_routes
node_app_shell -->|"hosts"| node_catalog_routes
node_app_shell -->|"hosts"| node_customer_shell
node_app_shell -->|"hosts"| node_admin_shell
node_app_shell -->|"provides"| node_theme_and_settings
node_app_shell -->|"initializes"| node_localization
node_app_shell -->|"renders parallel slot"| node_modal_overlays
node_storefront_routes -->|"delegates to"| node_fashion_page_view
node_fashion_page_view -->|"composes"| node_fashion_sections
node_fashion_page_view -->|"reuses"| node_shared_storefront_ui
node_catalog_routes -->|"loads products"| node_product_api
node_storefront_routes -->|"loads template data"| node_template_data
node_template_data -->|"reads"| node_template_db
node_product_api -->|"reads"| node_product_db
node_product_api -->|"uses"| node_product_model
node_add_to_cart -->|"uses"| node_cart_hook
node_cart_hook -->|"accesses"| node_cart_context
node_cart_route -->|"delegates to"| node_cart_view
node_cart_view -->|"reads and edits"| node_cart_hook
node_cart_view -->|"continues to"| node_checkout_stages
node_checkout_stages -->|"uses"| node_checkout_api
node_customer_shell -->|"composes"| node_customer_pages
node_admin_shell -->|"uses"| node_vendor_layout
node_vendor_layout -->|"navigates"| node_admin_pages
node_admin_pages -->|"loads and manages"| node_dashboard_api
node_dashboard_api -->|"reads"| node_dashboard_db
node_product_api -.->|"future external calls"| node_http_seam
node_checkout_api -.->|"future external calls"| node_http_seam

click node_next_config "https://github.com/rgc4/bazaar/blob/main/next.config.ts"
click node_app_shell "https://github.com/rgc4/bazaar/blob/main/src/app/layout.tsx"
click node_landing "https://github.com/rgc4/bazaar/blob/main/src/app/page.tsx"
click node_storefront_routes "https://github.com/rgc4/bazaar/blob/main/src/app/fashion-1/page.tsx"
click node_fashion_page_view "https://github.com/rgc4/bazaar/blob/main/src/pages-sections/fashion-1/page-view/fashion-1.tsx"
click node_fashion_sections "https://github.com/rgc4/bazaar/blob/main/src/pages-sections/fashion-1/section-1/section-1.tsx"
click node_shared_storefront_ui "https://github.com/rgc4/bazaar/blob/main/src/components/header/header.tsx"
click node_catalog_routes "https://github.com/rgc4/bazaar/blob/main/src/app/products/%5Bslug%5D/page.tsx"
click node_cart_context "https://github.com/rgc4/bazaar/blob/main/src/contexts/CartContext.tsx"
click node_cart_hook "https://github.com/rgc4/bazaar/blob/main/src/hooks/useCart.ts"
click node_add_to_cart "https://github.com/rgc4/bazaar/blob/main/src/pages-sections/product-details/product-intro/add-to-cart.tsx"
click node_cart_route "https://github.com/rgc4/bazaar/blob/main/src/app/(checkout)/cart/page.tsx"
click node_cart_view "https://github.com/rgc4/bazaar/blob/main/src/pages-sections/cart/page-view/cart.tsx"
click node_checkout_stages "https://github.com/rgc4/bazaar/blob/main/src/pages-sections/checkout/page-view/checkout.tsx"
click node_customer_shell "https://github.com/rgc4/bazaar/blob/main/src/app/(customer-dashboard)/layout.tsx"
click node_customer_pages "https://github.com/rgc4/bazaar/blob/main/src/pages-sections/customer-dashboard/orders/page-view/orders.tsx"
click node_admin_shell "https://github.com/rgc4/bazaar/blob/main/src/app/(admin-dashboard)/layout.tsx"
click node_vendor_layout "https://github.com/rgc4/bazaar/blob/main/src/components/layouts/vendor-dashboard/dashboard-layout.tsx"
click node_admin_pages "https://github.com/rgc4/bazaar/blob/main/src/pages-sections/vendor-dashboard/products/page-view/products.tsx"
click node_theme_and_settings "https://github.com/rgc4/bazaar/blob/main/src/theme/theme-provider.tsx"
click node_localization "https://github.com/rgc4/bazaar/blob/main/src/i18n/index.ts"
click node_modal_overlays "https://github.com/rgc4/bazaar/blob/main/src/app/%40modal/(.)mini-cart/page.tsx"
click node_product_api "https://github.com/rgc4/bazaar/blob/main/src/utils/__api__/products.ts"
click node_product_db "https://github.com/rgc4/bazaar/blob/main/src/__server__/__db__/products/index.ts"
click node_product_model "https://github.com/rgc4/bazaar/blob/main/src/models/Product.model.ts"
click node_template_data "https://github.com/rgc4/bazaar/blob/main/src/utils/__api__/grocery-1.ts"
click node_template_db "https://github.com/rgc4/bazaar/blob/main/src/__server__/__db__/grocery-1/data.ts"
click node_checkout_api "https://github.com/rgc4/bazaar/blob/main/src/utils/__api__/checkout.ts"
click node_dashboard_api "https://github.com/rgc4/bazaar/blob/main/src/utils/__api__/dashboard.ts"
click node_dashboard_db "https://github.com/rgc4/bazaar/blob/main/src/__server__/__db__/dashboard/index.ts"
click node_http_seam "https://github.com/rgc4/bazaar/blob/main/src/utils/axiosInstance.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_next_config,node_app_shell,node_landing toneBlue
class node_storefront_routes,node_fashion_page_view,node_fashion_sections,node_shared_storefront_ui,node_catalog_routes toneAmber
class node_cart_context,node_cart_hook,node_add_to_cart,node_cart_route,node_cart_view,node_checkout_stages toneMint
class node_customer_shell,node_customer_pages,node_admin_shell,node_vendor_layout,node_admin_pages toneRose
class node_theme_and_settings,node_localization,node_modal_overlays toneIndigo
class node_product_api,node_product_db,node_product_model,node_template_data,node_template_db,node_checkout_api,node_dashboard_api,node_dashboard_db,node_http_seam toneTeal
```

## Components

### Next runtime

- [Next configuration](https://github.com/rgc4/bazaar/blob/main/next.config.ts): Next.js config · `next.config.ts`
- [Application shell](https://github.com/rgc4/bazaar/blob/main/src/app/layout.tsx): root layout · `src/app/layout.tsx`
- [Landing route](https://github.com/rgc4/bazaar/blob/main/src/app/page.tsx): App Router page · `src/app/page.tsx`

### Storefront

- [Storefront routes](https://github.com/rgc4/bazaar/blob/main/src/app/fashion-1/page.tsx): variant pages · Fashion, grocery, and market route entries. · `src/app/fashion-1/page.tsx`
- [Fashion page view](https://github.com/rgc4/bazaar/blob/main/src/pages-sections/fashion-1/page-view/fashion-1.tsx): page assembly · `src/pages-sections/fashion-1/page-view/fashion-1.tsx`
- [Storefront sections](https://github.com/rgc4/bazaar/blob/main/src/pages-sections/fashion-1/section-1/section-1.tsx): section components · `src/pages-sections/fashion-1/section-1/section-1.tsx`
- [Shared storefront UI](https://github.com/rgc4/bazaar/blob/main/src/components/header/header.tsx): cards and chrome · Reusable header, footer, and product cards. · `src/components/header/header.tsx`
- [Catalog routes](https://github.com/rgc4/bazaar/blob/main/src/app/products/%5Bslug%5D/page.tsx): dynamic product, shop, category and search pages · `src/app/products/[slug]/page.tsx`

### Commerce flow

- [Cart state](https://github.com/rgc4/bazaar/blob/main/src/contexts/CartContext.tsx): client context · `src/contexts/CartContext.tsx`
- [Cart hook](https://github.com/rgc4/bazaar/blob/main/src/hooks/useCart.ts): context access · `src/hooks/useCart.ts`
- [Add-to-cart control](https://github.com/rgc4/bazaar/blob/main/src/pages-sections/product-details/product-intro/add-to-cart.tsx): product interaction · `src/pages-sections/product-details/product-intro/add-to-cart.tsx`
- [Cart route](https://github.com/rgc4/bazaar/blob/main/src/app/(checkout)/cart/page.tsx): checkout route · `src/app/(checkout)/cart/page.tsx`
- [Cart view](https://github.com/rgc4/bazaar/blob/main/src/pages-sections/cart/page-view/cart.tsx): page assembly · `src/pages-sections/cart/page-view/cart.tsx`
- [Checkout and payment](https://github.com/rgc4/bazaar/blob/main/src/pages-sections/checkout/page-view/checkout.tsx): purchase assemblies · Checkout, payment, and confirmation stages. · `src/pages-sections/checkout/page-view/checkout.tsx`

### Dashboards

- [Customer dashboard shell](https://github.com/rgc4/bazaar/blob/main/src/app/(customer-dashboard)/layout.tsx): route-group layout · `src/app/(customer-dashboard)/layout.tsx`
- [Customer account pages](https://github.com/rgc4/bazaar/blob/main/src/pages-sections/customer-dashboard/orders/page-view/orders.tsx): dashboard assemblies · Addresses, orders, and account management. · `src/pages-sections/customer-dashboard/orders/page-view/orders.tsx`
- [Admin dashboard shell](https://github.com/rgc4/bazaar/blob/main/src/app/(admin-dashboard)/layout.tsx): route-group layout · `src/app/(admin-dashboard)/layout.tsx`
- [Vendor dashboard layout](https://github.com/rgc4/bazaar/blob/main/src/components/layouts/vendor-dashboard/dashboard-layout.tsx): dashboard navigation · `src/components/layouts/vendor-dashboard/dashboard-layout.tsx`
- [Admin management pages](https://github.com/rgc4/bazaar/blob/main/src/pages-sections/vendor-dashboard/products/page-view/products.tsx): dashboard assemblies · `src/pages-sections/vendor-dashboard/products/page-view/products.tsx`

### UI platform

- [Theme and settings](https://github.com/rgc4/bazaar/blob/main/src/theme/theme-provider.tsx): UI providers · `src/theme/theme-provider.tsx`
- [Localization](https://github.com/rgc4/bazaar/blob/main/src/i18n/index.ts): i18n resources · `src/i18n/index.ts`
- [Modal overlays](https://github.com/rgc4/bazaar/blob/main/src/app/%40modal/(.)mini-cart/page.tsx): parallel intercepted routes · Login, mini-cart, and quick product view overlays. · `src/app/@modal/(.)mini-cart/page.tsx`

### Data boundary

- [Product data adapter](https://github.com/rgc4/bazaar/blob/main/src/utils/__api__/products.ts): UI fetch adapter · `src/utils/__api__/products.ts`
- [Product mock data](https://github.com/rgc4/bazaar/blob/main/src/__server__/__db__/products/index.ts): local database module · `src/__server__/__db__/products/index.ts`
- [Product model](https://github.com/rgc4/bazaar/blob/main/src/models/Product.model.ts): domain model · `src/models/Product.model.ts`
- [Template data adapter](https://github.com/rgc4/bazaar/blob/main/src/utils/__api__/grocery-1.ts): storefront fetch adapter · `src/utils/__api__/grocery-1.ts`
- [Template mock data](https://github.com/rgc4/bazaar/blob/main/src/__server__/__db__/grocery-1/data.ts): local database module · `src/__server__/__db__/grocery-1/data.ts`
- [Checkout adapter](https://github.com/rgc4/bazaar/blob/main/src/utils/__api__/checkout.ts): service seam · Separates purchase UI from mock or future services. · `src/utils/__api__/checkout.ts`
- [Dashboard data adapter](https://github.com/rgc4/bazaar/blob/main/src/utils/__api__/dashboard.ts): UI fetch adapter · `src/utils/__api__/dashboard.ts`
- [Dashboard mock data](https://github.com/rgc4/bazaar/blob/main/src/__server__/__db__/dashboard/index.ts): local database module · `src/__server__/__db__/dashboard/index.ts`
- [HTTP integration seam](https://github.com/rgc4/bazaar/blob/main/src/utils/axiosInstance.ts): Axios instance · Likely boundary for future external services. · `src/utils/axiosInstance.ts`

## Connections

- Next configuration → Application shell: configures
- Application shell → Landing route: hosts
- Application shell → Storefront routes: hosts
- Application shell → Catalog routes: hosts
- Application shell → Customer dashboard shell: hosts
- Application shell → Admin dashboard shell: hosts
- Application shell → Theme and settings: provides
- Application shell → Localization: initializes
- Application shell → Modal overlays: renders parallel slot
- Storefront routes → Fashion page view: delegates to
- Fashion page view → Storefront sections: composes
- Fashion page view → Shared storefront UI: reuses
- Catalog routes → Product data adapter: loads products
- Storefront routes → Template data adapter: loads template data
- Template data adapter → Template mock data: reads
- Product data adapter → Product mock data: reads
- Product data adapter → Product model: uses
- Add-to-cart control → Cart hook: uses
- Cart hook → Cart state: accesses
- Cart route → Cart view: delegates to
- Cart view → Cart hook: reads and edits
- Cart view → Checkout and payment: continues to
- Checkout and payment → Checkout adapter: uses
- Customer dashboard shell → Customer account pages: composes
- Admin dashboard shell → Vendor dashboard layout: uses
- Vendor dashboard layout → Admin management pages: navigates
- Admin management pages → Dashboard data adapter: loads and manages
- Dashboard data adapter → Dashboard mock data: reads
- Product data adapter → HTTP integration seam: future external calls
- Checkout adapter → HTTP integration seam: future external calls
