# bajrayejoon/react-exclusive-ecommerce architecture

> Architecture diagram of the GitHub repository bajrayejoon/react-exclusive-ecommerce, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bajrayejoon/react-exclusive-ecommerce
- Repository: https://github.com/bajrayejoon/react-exclusive-ecommerce

## Overview

##### Main Application Architecture

a) Frontend Layer (Client-Side)
- Split into two main portals:
- User Portal (`/src/user-portal`)
- Admin Portal (`/src/admin`)
- Common Components (`/src/common`)

##### Core Components Breakdown

For the User Portal:
- Authentication System
- Product Catalog
- Shopping Cart
- Checkout System
- User Profile
- Wishlist
- Multi-language Support (indicated by locales directory)
- Payment Integration (Khalti)

For the Admin Portal:
- Dashboard
- CMS Management
- Product Management
- User Management
- Analytics
- Banner Management
- Flash Sales
- Discount Management

##### Data Flow and State Management
- Recoil state management (indicated by atoms folder)
- API integration layers
- Authentication flow

**[Frontend Application]**
- User Portal
- Public Routes
- Home
- Product Catalog
- Authentication
- Protected Routes
- Cart
- Checkout
- User Profile

- Admin Portal
- Protected Routes
- Dashboard
- CMS
- Products
- Analytics

- Common Components
- UI Components
- API Layer
- Utilities

- External Services
- Payment Gateway
- API Backend

Important Elements to Include:

##### Technical Stack Indicators
- React + TypeScript
- Vite
- Recoil for state management
- Tailwind CSS
- React Router

- High-level architecture visibility
- Detailed component relationships
- Clear data flow patterns
- Security boundaries

Key Relationships to Emphasize:
##### Product catalog filtering and search

Remember to:
- Brief descriptions for complex interactions
- Error handling paths
- Asynchronous operations

- The application's overall architecture
- How different components interact
- The data flow between user and admin portals
- Integration points with external services
- State management patterns
- Security boundaries and protected routes

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        UserPortal["User Portal"]
        AdminPortal["Admin Portal"]
        Common["Common Components"]
    end

    subgraph "User Portal Components"
        Auth["Authentication System"]
        Cart["Shopping Cart"]
        Checkout["Checkout System"]
        Lang["Multi-language Support"]
        Payment["Payment Integration"]
        Wish["Wishlist"]
        State["State Management"]
        
        UserPortal --> Auth
        UserPortal --> Cart
        UserPortal --> Checkout
        UserPortal --> Lang
        UserPortal --> Payment
        UserPortal --> Wish
        UserPortal --> State
    end

    subgraph "Admin Portal Components"
        Dashboard["Dashboard"]
        CMS["CMS Management"]
        ProductMgmt["Product Management"]
        UserMgmt["User Management"]
        Analytics["Analytics"]
        Banner["Banner Management"]
        Flash["Flash Sales"]
        Discount["Discount Management"]
        
        AdminPortal --> Dashboard
        AdminPortal --> CMS
        AdminPortal --> ProductMgmt
        AdminPortal --> UserMgmt
        AdminPortal --> Analytics
        AdminPortal --> Banner
        AdminPortal --> Flash
        AdminPortal --> Discount
    end

    subgraph "External Services"
        PaymentGateway["Payment Gateway"]
        APIBackend["API Backend"]
    end

    Common --> UserPortal
    Common --> AdminPortal
    Payment --> PaymentGateway
    UserPortal --> APIBackend
    AdminPortal --> APIBackend

    classDef default fill:#f9f9f9,stroke:#333,stroke-width:1px
    classDef userPortal fill:#dae8fc,stroke:#6c8ebf
    classDef adminPortal fill:#d5e8d4,stroke:#82b366
    classDef common fill:#f5f5f5,stroke:#666666
    classDef external fill:#fff2cc,stroke:#d6b656

    class UserPortal,Auth,Cart,Checkout,Lang,Payment,Wish,State userPortal
    class AdminPortal,Dashboard,CMS,ProductMgmt,UserMgmt,Analytics,Banner,Flash,Discount adminPortal
    class Common common
    class PaymentGateway,APIBackend external

    click UserPortal "https://github.com/BajraYeJoon/react-exclusive-ecommerce/tree/main/src/user-portal"
    click AdminPortal "https://github.com/BajraYeJoon/react-exclusive-ecommerce/tree/main/src/admin"
    click Auth "https://github.com/BajraYeJoon/react-exclusive-ecommerce/tree/main/src/user-portal/site/auth"
    click ProductMgmt "https://github.com/BajraYeJoon/react-exclusive-ecommerce/tree/main/src/admin/components/productsList"
    click Cart "https://github.com/BajraYeJoon/react-exclusive-ecommerce/tree/main/src/user-portal/site/cart"
    click Checkout "https://github.com/BajraYeJoon/react-exclusive-ecommerce/tree/main/src/user-portal/components/checkout"
    click Lang "https://github.com/BajraYeJoon/react-exclusive-ecommerce/tree/main/src/user-portal/locales"
    click Payment "https://github.com/BajraYeJoon/react-exclusive-ecommerce/blob/main/src/user-portal/components/checkout/khalitPayment.ts"
    click CMS "https://github.com/BajraYeJoon/react-exclusive-ecommerce/tree/main/src/admin/components/CMS"
    click Dashboard "https://github.com/BajraYeJoon/react-exclusive-ecommerce/tree/main/src/admin/screen/dashboard"
    click Banner "https://github.com/BajraYeJoon/react-exclusive-ecommerce/tree/main/src/admin/components/banner"
    click Flash "https://github.com/BajraYeJoon/react-exclusive-ecommerce/tree/main/src/admin/components/flashSaleCards"
    click Discount "https://github.com/BajraYeJoon/react-exclusive-ecommerce/tree/main/src/admin/components/discountCRUD"
    click UserMgmt "https://github.com/BajraYeJoon/react-exclusive-ecommerce/tree/main/src/admin/components/user-component"
    click Analytics "https://github.com/BajraYeJoon/react-exclusive-ecommerce/tree/main/src/admin/screen/analytics"
    click Wish "https://github.com/BajraYeJoon/react-exclusive-ecommerce/tree/main/src/user-portal/components/favorites"
    click Common "https://github.com/BajraYeJoon/react-exclusive-ecommerce/tree/main/src/common"
    click State "https://github.com/BajraYeJoon/react-exclusive-ecommerce/tree/main/src/user-portal/atoms"
```
