# aakku106/kuramacart architecture

> Architecture diagram of the GitHub repository aakku106/kuramacart, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aakku106/kuramacart
- Repository: https://github.com/aakku106/kuramacart

## Overview

##### Project Type and Purpose
- KuramaCart (“OnlineStore” folder) is a single-page application (SPA) built with Blazor (.NET 9.0).
- Purpose: Provide an interactive, responsive online shopping UI with product browsing, cart management, and notification features.
- No separate backend API or database layer is yet implemented; state is managed in-memory via C# services.

##### File Structure
- Top-level “OnlineStore” directory contains:
- Components/ (UI components and pages)
- Data/ (state containers: CartData.cs, ProductData.cs, UserData.cs)
- Models/ (domain models: Product, Cart, User, Admin)
- Services/ (business logic: ProductServices, UserServices)
- wwwroot/ (static assets: CSS, images, sounds)
- Program.cs & OnlineStore.csproj (application bootstrap & dependency injection)
- appsettings.json & launchSettings.json (configuration & launch profiles)

##### README for Insights
- Tech stack: Blazor (Frontend), C# components, CSS/Bootstrap for styling, no explicit database.
- Features: categorized pages (Beauty, Kitchen, Clothing), real-time cart updates, search, notifications.
- Future enhancements: suggests adding authentication, order processing, payment integration, reviews.

##### Main Components
a. **Client Browser**
- Hosts the Blazor application (WASM or Server).
b. **Blazor App Shell**
- App.razor → Routes.razor → Layouts (MainLayout, EmptyLayout) → NavBar
c. **Pages & UI Components**
- Home, Beauty, Kitchen, Cloths, Cart, LoginPage, Error, PageNotFound
d. **State Containers (Data)**
- CartData, ProductData, UserData injected via DI
e. **Business Services**
- ProductServices, UserServices
f. **Domain Models**
- Product, Cart, User, Admin
g. **Static Resources**
- wwwroot (CSS, images, sounds)
h. **Configuration & Startup**
- Program.cs sets up routing, DI, and configuration (appsettings.json)

##### Relationships & Interactions
- **User Actions** in the Browser → trigger **UI Component Events**
- UI Components call **Injected Services** (e.g., ProductServices.AddToCart)
- Services manipulate **Data** objects (CartData, ProductData)
- Data objects update **bound UI** via Blazor’s reactivity (StateHasChanged)
- UI triggers **Toast notifications** on Data changes
- Static assets served directly from wwwroot

##### Architectural Patterns & Principles
- Component-based UI (Blazor components with .razor files)
- Dependency Injection for Services and Data state
- Separation of Concerns:
- UI Components handle rendering and user interaction
- Services contain business logic
- Data classes manage in-memory state
- Models define the domain entities
- Single Responsibility: each folder/subsystem has a clear role

2. Under it, place a large container labeled “Blazor App Shell” containing:
- App.razor → Routes.razor → Layouts (MainLayout, NavBar)
- Services (ProductServices, UserServices)
- Data (CartData, ProductData, UserData)
6. At the bottom, show **Infrastructure**:
- Static Assets (wwwroot: CSS, images, sounds)
- Configuration (appsettings.json, launchSettings.json)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client
    subgraph "Client"
        Browser["Client Browser"]:::external
    end

    %% Presentation Layer
    subgraph "Presentation Layer (Blazor .NET 9)" 
        AppShell["Blazor App Shell\nApp.razor"]:::frontend
        Routes["Routes.razor"]:::frontend
        MainLayout["MainLayout.razor"]:::frontend
        EmptyLayout["EmptyLayout.razor"]:::frontend
        NavBar["NavBar.razor"]:::frontend
        PageNotFound["PageNotFound.razor"]:::frontend
        subgraph "Pages"
            Home["Home.razor"]:::frontend
            Beauty["Beauty.razor"]:::frontend
            Kitchen["Kitchen.razor"]:::frontend
            Cloths["Cloths.razor"]:::frontend
            CartPage["Cart.razor"]:::frontend
            Login["LoginPage.razor"]:::frontend
            ErrorPage["Error.razor"]:::frontend
        end
    end

    %% Application Layer
    subgraph "Application Layer"
        ProductServices["ProductServices.cs"]:::service
        UserServices["UserServices.cs"]:::service
        CartData["CartData.cs"]:::service
        ProductData["ProductData.cs"]:::service
        UserData["UserData.cs"]:::service
    end

    %% Domain Layer
    subgraph "Domain Layer"
        ProductModel["Product.cs"]:::model
        CartModel["Cart.cs"]:::model
        UserModel["User.cs"]:::model
        AdminModel["Admin.cs"]:::model
    end

    %% Infrastructure
    subgraph "Infrastructure"
        Program["Program.cs"]:::infra
        AppSettings["appsettings.json"]:::infra
        Launch["launchSettings.json"]:::infra
        CSS["CSS & Bootstrap"]:::infra
        Images["Images"]:::infra
        Sounds["Sounds"]:::infra
    end

    %% Relationships
    Browser --> AppShell
    AppShell --> Routes
    AppShell --> MainLayout
    AppShell --> EmptyLayout
    AppShell --> NavBar
    AppShell --> PageNotFound
    AppShell --> Home
    AppShell --> Beauty
    AppShell --> Kitchen
    AppShell --> Cloths
    AppShell --> CartPage
    AppShell --> Login
    AppShell --> ErrorPage

    Home --> ProductServices
    Beauty --> ProductServices
    Kitchen --> ProductServices
    Cloths --> ProductServices
    CartPage --> ProductServices
    CartPage --> CartData
    Login --> UserServices

    ProductServices --> CartData
    ProductServices --> ProductData
    UserServices --> UserData

    CartData --> Home
    ProductData --> Home

    ProductServices --> ProductModel
    ProductServices --> CartModel
    UserServices --> UserModel
    UserServices --> AdminModel

    CartData --> CartModel
    ProductData --> ProductModel
    UserData --> UserModel

    Program --> AppShell
    Program --> ProductServices
    Program --> UserServices
    Program --> CartData
    Program --> ProductData
    Program --> UserData

    AppSettings --> Program
    Launch --> Program

    CSS --> Browser
    Images --> Browser
    Sounds --> Browser

    %% Click Events
    click AppShell "https://github.com/aakku106/kuramacart/blob/main/OnlineStore/Components/App.razor"
    click Routes "https://github.com/aakku106/kuramacart/blob/main/OnlineStore/Components/Routes.razor"
    click MainLayout "https://github.com/aakku106/kuramacart/blob/main/OnlineStore/Components/Layout/MainLayout.razor"
    click EmptyLayout "https://github.com/aakku106/kuramacart/blob/main/OnlineStore/Components/Layout/EmptyLayout.razor"
    click NavBar "https://github.com/aakku106/kuramacart/blob/main/OnlineStore/Components/Layout/NavBar.razor"
    click PageNotFound "https://github.com/aakku106/kuramacart/blob/main/OnlineStore/Components/Layout/PageNotFound.razor"
    click Home "https://github.com/aakku106/kuramacart/blob/main/OnlineStore/Components/Pages/Home.razor"
    click Beauty "https://github.com/aakku106/kuramacart/blob/main/OnlineStore/Components/Pages/Beauty.razor"
    click Kitchen "https://github.com/aakku106/kuramacart/blob/main/OnlineStore/Components/Pages/Kitchen.razor"
    click Cloths "https://github.com/aakku106/kuramacart/blob/main/OnlineStore/Components/Pages/Cloths.razor"
    click CartPage "https://github.com/aakku106/kuramacart/blob/main/OnlineStore/Components/Pages/Cart.razor"
    click Login "https://github.com/aakku106/kuramacart/blob/main/OnlineStore/Components/Pages/LoginPage.razor"
    click ErrorPage "https://github.com/aakku106/kuramacart/blob/main/OnlineStore/Components/Pages/Error.razor"
    click CartData "https://github.com/aakku106/kuramacart/blob/main/OnlineStore/Data/CartData.cs"
    click ProductData "https://github.com/aakku106/kuramacart/blob/main/OnlineStore/Data/ProductData.cs"
    click UserData "https://github.com/aakku106/kuramacart/blob/main/OnlineStore/Data/UserData.cs"
    click ProductServices "https://github.com/aakku106/kuramacart/blob/main/OnlineStore/Services/ProductServices.cs"
    click UserServices "https://github.com/aakku106/kuramacart/blob/main/OnlineStore/Services/UserServices.cs"
    click ProductModel "https://github.com/aakku106/kuramacart/blob/main/OnlineStore/Models/Product.cs"
    click CartModel "https://github.com/aakku106/kuramacart/blob/main/OnlineStore/Models/Cart.cs"
    click UserModel "https://github.com/aakku106/kuramacart/blob/main/OnlineStore/Models/User.cs"
    click AdminModel "https://github.com/aakku106/kuramacart/blob/main/OnlineStore/Models/Admin.cs"
    click Program "https://github.com/aakku106/kuramacart/blob/main/OnlineStore/Program.cs"
    click AppSettings "https://github.com/aakku106/kuramacart/blob/main/OnlineStore/appsettings.json"
    click Launch "https://github.com/aakku106/kuramacart/blob/main/OnlineStore/Properties/launchSettings.json"
    click CSS "https://github.com/aakku106/kuramacart/blob/main/OnlineStore/wwwroot/app.css"
    click Images "https://github.com/aakku106/kuramacart/tree/main/OnlineStore/wwwroot/images/"
    click Sounds "https://github.com/aakku106/kuramacart/tree/main/OnlineStore/wwwroot/sounds/"

    %% Styles
    classDef frontend fill:lightgreen,stroke:#333,stroke-width:1px
    classDef service fill:lightblue,stroke:#333,stroke-width:1px
    classDef model fill:orange,stroke:#333,stroke-width:1px
    classDef infra fill:lightgray,stroke:#333,stroke-width:1px
    classDef external fill:#fff,stroke:#333,stroke-width:1px
```
