How rgc4/bazaar works
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: layout.tsx Application shell · products.ts Product data adapter · page.tsx Storefront routes · fashion-1.tsx Fashion page view
Components 31
Next runtime
- Next configuration
next.config.ts - Application shell
src/app/layout.tsx - Landing route
src/app/page.tsx
Storefront
- Storefront routes · Fashion, grocery, and market route entries.
src/app/fashion-1/page.tsx - Fashion page view
src/pages-sections/fashion-1/page-view/fashion-1.tsx - Storefront sections
src/pages-sections/fashion-1/section-1/section-1.tsx - Shared storefront UI · Reusable header, footer, and product cards.
src/components/header/header.tsx - Catalog routes
src/app/products/[slug]/page.tsx
Commerce flow
- Cart state
src/contexts/CartContext.tsx - Cart hook
src/hooks/useCart.ts - Add-to-cart control
src/pages-sections/product-details/product-intro/add-to-cart.tsx - Cart route
src/app/(checkout)/cart/page.tsx - Cart view
src/pages-sections/cart/page-view/cart.tsx - Checkout and payment · Checkout, payment, and confirmation stages.
src/pages-sections/checkout/page-view/checkout.tsx
Dashboards
- Customer dashboard shell
src/app/(customer-dashboard)/layout.tsx - Customer account pages · Addresses, orders, and account management.
src/pages-sections/customer-dashboard/orders/page-view/orders.tsx - Admin dashboard shell
src/app/(admin-dashboard)/layout.tsx - Vendor dashboard layout
src/components/layouts/vendor-dashboard/dashboard-layout.tsx - Admin management pages
src/pages-sections/vendor-dashboard/products/page-view/products.tsx
UI platform
- Theme and settings
src/theme/theme-provider.tsx - Localization
src/i18n/index.ts - Modal overlays · Login, mini-cart, and quick product view overlays.
src/app/@modal/(.)mini-cart/page.tsx
Data boundary
- Product data adapter
src/utils/__api__/products.ts - Product mock data
src/__server__/__db__/products/index.ts - Product model
src/models/Product.model.ts - Template data adapter
src/utils/__api__/grocery-1.ts - Template mock data
src/__server__/__db__/grocery-1/data.ts - Checkout adapter · Separates purchase UI from mock or future services.
src/utils/__api__/checkout.ts - Dashboard data adapter
src/utils/__api__/dashboard.ts - Dashboard mock data
src/__server__/__db__/dashboard/index.ts - HTTP integration seam · Likely boundary for future external services.
src/utils/axiosInstance.ts
Connections 30
- 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