# sauravkunwar321/swadilo_food architecture

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

- Interactive diagram: https://gitdiagram.com/sauravkunwar321/swadilo_food
- Repository: https://github.com/sauravkunwar321/swadilo_food

## Overview

##### Project type and purpose
- This is a single-page front-end application built with React and Vite.
- By inspecting the folder names and README, we see it’s a client-side “food ordering” or “catalog” demo, using in-memory data (FoodData.js) and Redux slices (cart, category, search) to model state.

##### File structure
- Top level
- package.json, vite.config.js, eslint.config.js → build and lint configuration
- index.html → SPA shell
- components/ → reusable UI widgets (Cart, Navbar, FoodItem, etc.)
- public/ → static assets served by Vite
- src/
- main.jsx → React entry point
- App.jsx → root component hosting React Router or conditional page rendering
- Data/FoodData.js → static dataset
- assets/ → images, fonts, etc.
- pages/ → top-level routes (Home, Success, Error)
- redux/ → Store.js + slices (CartSlice, CategorySlice, SearchSlice) for centralized state

##### README for additional insights
- It’s the default Vite React template, leveraging either Babel or SWC for HMR.
- No backend or API integrations are shown—this is purely a front-end demo.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Dev/Build Pipeline
    subgraph "Dev/Build Pipeline"
        direction TB
        dev["Developer"]:::dev
        pkg["package.json"]:::dev
        lock["package-lock.json"]:::dev
        viteConfig["vite.config.js"]:::dev
        eslintConfig["eslint.config.js"]:::dev
        publicDir["public/"]:::dev
        dev -->|writes code| pkg
        dev --> eslintConfig
        dev --> viteConfig
        pkg --> lock
        pkg -->|configures| ViteServer
        viteConfig --> ViteServer
        eslintConfig --> ViteServer
        publicDir --> ViteServer
        ViteServer["Vite Dev Server / Production Build"]:::dev
    end

    %% Client Runtime
    subgraph "Client Runtime (Browser)" 
        direction TB
        browser["Browser"]:::client
        browser --> html
        html["index.html"]:::client
        html --> main
        main["main.jsx"]:::client
        main --> app
        app["App.jsx"]:::client
        app --> pages
        app --> components
        app --> store
        app --> styles
        assets["src/assets/"]:::client --> app

        subgraph "Pages" 
            direction TB
            home["Home.jsx"]:::pages
            success["Success.jsx"]:::pages
            error["Error.jsx"]:::pages
        end
        pages --> home
        pages --> success
        pages --> error

        subgraph "UI Components"
            direction TB
            navbar["Navbar.jsx"]:::components
            category["CategoryMenu.jsx"]:::components
            foodCard["Foodcard.jsx"]:::components
            foodItem["FoodItem.jsx"]:::components
            itemCard["ItemCard.jsx"]:::components
            cartDisplay["Cart.jsx"]:::components
            protected["ProtectedRoute.jsx"]:::components
        end
        components --> navbar
        components --> category
        components --> foodCard
        components --> foodItem
        components --> itemCard
        components --> cartDisplay
        components --> protected

        subgraph "State Management (Redux)" 
            direction TB
            store["Store.js"]:::state
            slices["Slices"]:::state
            store --> sliceCart
            store --> sliceCategory
            store --> sliceSearch

            sliceCart["CartSlice.jsx"]:::state
            sliceCategory["CategorySlice.jsx"]:::state
            sliceSearch["SearchSlice.jsx"]:::state
        end
        store --> slices

        subgraph "Static Data Source"
            direction TB
            data["FoodData.js"]:::data
        end

        %% Data flow
        navbar -->|reads| data
        category -->|reads| data
        foodCard -->|reads| data
        foodItem -->|reads| data
        itemCard -->|reads| data
        cartDisplay -->|dispatches actions| sliceCart
        category -->|dispatches actions| sliceCategory
        protected -->|dispatches actions| sliceSearch

    end

    %% Interactions
    ViteServer -->|serves app| browser

    %% Click events
    click viteConfig "https://github.com/sauravkunwar321/swadilo_food/blob/main/vite.config.js"
    click eslintConfig "https://github.com/sauravkunwar321/swadilo_food/blob/main/eslint.config.js"
    click html "https://github.com/sauravkunwar321/swadilo_food/blob/main/index.html"
    click publicDir "https://github.com/sauravkunwar321/swadilo_food/tree/main/public/"
    click pkg "https://github.com/sauravkunwar321/swadilo_food/blob/main/package.json"
    click lock "https://github.com/sauravkunwar321/swadilo_food/blob/main/package-lock.json"
    click main "https://github.com/sauravkunwar321/swadilo_food/blob/main/src/main.jsx"
    click app "https://github.com/sauravkunwar321/swadilo_food/blob/main/src/App.jsx"
    click styles "https://github.com/sauravkunwar321/swadilo_food/blob/main/src/index.css"
    click assets "https://github.com/sauravkunwar321/swadilo_food/tree/main/src/assets/"
    click home "https://github.com/sauravkunwar321/swadilo_food/blob/main/src/pages/Home.jsx"
    click success "https://github.com/sauravkunwar321/swadilo_food/blob/main/src/pages/Success.jsx"
    click error "https://github.com/sauravkunwar321/swadilo_food/blob/main/src/pages/Error.jsx"
    click navbar "https://github.com/sauravkunwar321/swadilo_food/blob/main/components/Navbar.jsx"
    click category "https://github.com/sauravkunwar321/swadilo_food/blob/main/components/CategoryMenu.jsx"
    click foodCard "https://github.com/sauravkunwar321/swadilo_food/blob/main/components/Foodcard.jsx"
    click foodItem "https://github.com/sauravkunwar321/swadilo_food/blob/main/components/FoodItem.jsx"
    click itemCard "https://github.com/sauravkunwar321/swadilo_food/blob/main/components/ItemCard.jsx"
    click cartDisplay "https://github.com/sauravkunwar321/swadilo_food/blob/main/components/Cart.jsx"
    click protected "https://github.com/sauravkunwar321/swadilo_food/blob/main/components/ProtectedRoute.jsx"
    click store "https://github.com/sauravkunwar321/swadilo_food/blob/main/src/redux/Store.js"
    click sliceCart "https://github.com/sauravkunwar321/swadilo_food/blob/main/src/redux/slices/CartSlice.jsx"
    click sliceCategory "https://github.com/sauravkunwar321/swadilo_food/blob/main/src/redux/slices/CategorySlice.jsx"
    click sliceSearch "https://github.com/sauravkunwar321/swadilo_food/blob/main/src/redux/slices/SearchSlice.jsx"
    click data "https://github.com/sauravkunwar321/swadilo_food/blob/main/src/Data/FoodData.js"

    %% Styles
    classDef dev fill:#e0f7e9,stroke:#2e7d32,stroke-width:1px
    classDef client fill:#e3f2fd,stroke:#1565c0,stroke-width:1px
    classDef pages fill:#bbdefb,stroke:#0d47a1,stroke-width:1px
    classDef components fill:#90caf9,stroke:#1565c0,stroke-width:1px
    classDef state fill:#ffe0b2,stroke:#ef6c00,stroke-width:1px
    classDef data fill:#eeeeee,stroke:#616161,stroke-width:1px
```
