# rohitsharma50/food-orderinf-website architecture

> Architecture diagram of the GitHub repository rohitsharma50/food-orderinf-website, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rohitsharma50/food-orderinf-website
- Repository: https://github.com/rohitsharma50/food-orderinf-website

## Overview

##### Project type and purpose
- This is a single-page web application built with React.js and Parcel.js.
- It presents a “foodie” ordering interface, fetching live restaurant and menu data from Swiggy public APIs, allowing users to browse, filter, search, add items to a cart, and place orders (front-end only).

##### File structure
- Top-level config & build files:
- .babelrc, .postcssrc, tailwind.config.js → code transpilation and styling
- package.json / package-lock.json → dependencies & scripts (npm run start invokes Parcel dev server)
- index.html, index.css → HTML entry point and global styles
- src/ directory:
- src/App.js → application root (React Router setup, Context/Provider wrapping)
- src/components/ → UI building blocks (Header, Footer, pages: About, Cart, Contact, Error, Instamart, etc.)
- src/utils/ → helper functions, constants, Redux Toolkit slice (cartSlice.js), store.js, custom hooks (useOnline, useRestaurant)
- src/assets, src/Images → static assets
- Routing, lazy loading, and state management are present.

##### README for additional insights
- Key features: multi-select filters, search, shimmer UI placeholders, CORS workaround, Tailwind CSS, class-based components, React Router DOM, lazy loading, Context API, “lifting state up.”
- The app fetches from Swiggy public APIs, implying an external service boundary.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Actors
    User(["User"]):::actor

    %% Build & Serve Pipeline
    subgraph "Build & Serve Pipeline"
        direction TB
        Babel[".babelrc"]:::pipeline
        PostCSS[".postcssrc"]:::pipeline
        Tailwind["tailwind.config.js"]:::pipeline
        PackageJSON["package.json"]:::pipeline
        PackageLock["package-lock.json"]:::pipeline
        HTML["index.html"]:::pipeline
        CSS["index.css"]:::pipeline
    end

    %% Browser and Application
    Browser(["Browser"]):::browser
    subgraph "React Application"
        direction TB
        App["App.js"]:::root

        subgraph "Routing Layer"
            ReactRouter["React Router DOM"]:::router
        end

        subgraph "UI Components"
            direction TB
            Header["Header"]:::frontend
            Footer["Footer"]:::frontend
            Shimmer["Shimmer"]:::frontend
            RestaurantCard["RestaurantCard"]:::frontend
            FoodItem["FoodItem"]:::frontend
            RestrauntMenu["RestrauntMenu"]:::frontend
            Body["Body"]:::frontend
            About["About"]:::frontend
            CartPage["Cart"]:::frontend
            Contact["Contact"]:::frontend
            ErrorPage["Error"]:::frontend
            Instamart["Instamart"]:::frontend
        end

        subgraph "State Management"
            direction TB
            Store["store.js"]:::state
            CartSlice["cartSlice.js"]:::state
        end

        subgraph "Data & API Layer"
            direction TB
            Helper["helper.js"]:::api
            Constant["Constant.js"]:::api
        end

        subgraph "Custom Hooks"
            direction TB
            useRestaurant["useRestaurant.js"]:::hooks
            useOnline["useOnline.js"]:::hooks
        end
    end

    %% External Service
    SwiggyAPI(["Swiggy Public API"]):::external

    %% Connections
    User -->|"opens app"| Browser
    Browser -->|"serves bundle"| ReactApp{"React Application"}
    Babel --> Parcel["Parcel.js"]:::pipeline
    Parcel --> Browser
    PostCSS --> Parcel
    Tailwind --> Parcel
    PackageJSON --> Parcel
    PackageLock --> Parcel
    HTML --> Parcel
    CSS --> Parcel

    Browser --> App
    App --> ReactRouter
    ReactRouter --> Header
    ReactRouter --> Body
    ReactRouter --> About
    ReactRouter --> CartPage
    ReactRouter --> Contact
    ReactRouter --> ErrorPage
    ReactRouter --> Instamart
    Body --> RestaurantCard
    Body --> Shimmer
    RestrauntMenu --> FoodItem

    Header --> CartPage
    Body --> useRestaurant
    RestrauntMenu --> useRestaurant
    useRestaurant --> Helper
    Helper --> SwiggyAPI
    SwiggyAPI --> Helper
    Helper --> useRestaurant
    useRestaurant -->|data| Body
    useRestaurant -->|data| RestrauntMenu

    CartPage -->|dispatch actions| CartSlice
    CartSlice --> Store
    Store --> CartPage
    App --> Store

    App --> useOnline

    %% Click Events
    click Babel "https://github.com/rohitsharma50/food-orderinf-website/blob/main/.babelrc"
    click PostCSS "https://github.com/rohitsharma50/food-orderinf-website/blob/main/.postcssrc"
    click Tailwind "https://github.com/rohitsharma50/food-orderinf-website/blob/main/tailwind.config.js"
    click PackageJSON "https://github.com/rohitsharma50/food-orderinf-website/blob/main/package.json"
    click PackageLock "https://github.com/rohitsharma50/food-orderinf-website/blob/main/package-lock.json"
    click HTML "https://github.com/rohitsharma50/food-orderinf-website/blob/main/index.html"
    click CSS "https://github.com/rohitsharma50/food-orderinf-website/blob/main/index.css"
    click App "https://github.com/rohitsharma50/food-orderinf-website/blob/main/src/App.js"
    click Header "https://github.com/rohitsharma50/food-orderinf-website/blob/main/src/components/Header.js"
    click Footer "https://github.com/rohitsharma50/food-orderinf-website/blob/main/src/components/Footer.js"
    click Shimmer "https://github.com/rohitsharma50/food-orderinf-website/blob/main/src/components/Shimmer.js"
    click RestaurantCard "https://github.com/rohitsharma50/food-orderinf-website/blob/main/src/components/RestaurantCard.js"
    click FoodItem "https://github.com/rohitsharma50/food-orderinf-website/blob/main/src/components/FoodItem.js"
    click RestrauntMenu "https://github.com/rohitsharma50/food-orderinf-website/blob/main/src/components/RestrauntMenu.js"
    click Body "https://github.com/rohitsharma50/food-orderinf-website/blob/main/src/components/Body.js"
    click About "https://github.com/rohitsharma50/food-orderinf-website/blob/main/src/components/About.js"
    click CartPage "https://github.com/rohitsharma50/food-orderinf-website/blob/main/src/components/Cart.js"
    click Contact "https://github.com/rohitsharma50/food-orderinf-website/blob/main/src/components/Contact.js"
    click ErrorPage "https://github.com/rohitsharma50/food-orderinf-website/blob/main/src/components/Error.js"
    click Instamart "https://github.com/rohitsharma50/food-orderinf-website/blob/main/src/components/Instamart.js"
    click Store "https://github.com/rohitsharma50/food-orderinf-website/blob/main/src/utils/store.js"
    click CartSlice "https://github.com/rohitsharma50/food-orderinf-website/blob/main/src/utils/cartSlice.js"
    click Helper "https://github.com/rohitsharma50/food-orderinf-website/blob/main/src/utils/helper.js"
    click Constant "https://github.com/rohitsharma50/food-orderinf-website/blob/main/src/utils/Constant.js"
    click useRestaurant "https://github.com/rohitsharma50/food-orderinf-website/blob/main/src/utils/useRestaurant.js"
    click useOnline "https://github.com/rohitsharma50/food-orderinf-website/blob/main/src/utils/useOnline.js"

    %% Styles
    classDef actor fill:#f9f,stroke:#333,stroke-width:1px
    classDef pipeline fill:#ddd,stroke:#666,stroke-width:1px
    classDef browser fill:#bbf,stroke:#333,stroke-width:1px
    classDef root fill:#eef,stroke:#333,stroke-width:1px
    classDef router fill:#ccf,stroke:#333,stroke-width:1px
    classDef frontend fill:#def,stroke:#333,stroke-width:1px
    classDef state fill:#afa,stroke:#333,stroke-width:1px
    classDef api fill:#fca,stroke:#333,stroke-width:1px
    classDef hooks fill:#fcf,stroke:#333,stroke-width:1px
    classDef external fill:#f90,stroke:#333,stroke-width:1px
```
