# vegetarian-restaurant/vegetarian_restaurant_front-end architecture

> Architecture diagram of the GitHub repository vegetarian-restaurant/vegetarian_restaurant_front-end, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vegetarian-restaurant/vegetarian_restaurant_front-end
- Repository: https://github.com/vegetarian-restaurant/vegetarian_restaurant_front-end

## Overview

##### Project type and purpose
- This is a single-page application (SPA) built with Create React App.
- It provides a public-facing Home page (with hero, featured products, categories, footer, etc.), an authentication flow (login page with Google OAuth), and a user Dashboard.
- State is managed client-side with Redux, and assets/data (meal_data.json) are bundled at build time.

##### File structure
- public/ – static HTML entrypoint (index.html), PWA manifest, robots.txt.
- src/index.js – React entrypoint that renders <App/> into the DOM.
- src/App.* – top-level application component and styles.
- src/pages/ – routes grouped by feature:
– /home – Home_screen.jsx plus sub-components (Header, Hero, FeaturedProducts, Categories, About, Footer).
– /auth – login.jsx for authentication.
– /dashboard – dashboard.jsx and related CSS.
- src/components/ – shared UI components (e.g., menu.jsx).
- src/features/ – feature-scoped code (menu behavior).
- src/hooks/ – custom hooks (database.jsx).
- src/lib/ – library wrappers (google_login.jsx).
- src/redux/ – Redux store configuration and API slice (api.jsx).
- src/data/ – static JSON data (meal_data.json).
- src/assets/ – images, SVGs.

##### Extract insights from README
- Built with Create React App – uses Webpack, Babel, ESLint under the hood.
- Standard npm scripts for start, test, build, eject.
- No backend code here – likely calls external REST endpoints (configured in src/redux/api.jsx).

##### Final reminders
- Be granular: break the React app into routing, UI, state, data layers.
- External dependencies (OAuth, REST API).
- Both build-time (static assets) and run-time (API calls) flows.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Hosting & Static Assets"
        HTML["index.html"]:::static
        Manifest["manifest.json"]:::static
        Robots["robots.txt"]:::static
    end

    Browser["Client Browser"]:::internal

    HTML -->|loads| Browser
    Manifest -->|loads| Browser
    Robots -->|loads| Browser

    subgraph "React Application"
        Entrypoint["src/index.js"]:::internal
        TopApp["App.js"]:::internal
        AppCSS["App.css"]:::internal

        Entrypoint -->|renders App| TopApp
        TopApp -->|imports styles| AppCSS
        TopApp -->|sets up Routing| Router

        Router["Routing Layer (React Router)"]:::internal
    end

    Browser -->|serves bundle| Entrypoint

    subgraph "Pages"
        HomePage["Home Screen"]:::internal
        HomeCSS["home.css"]:::internal
        AuthPage["Auth (Login)"]:::internal
        DashboardPage["Dashboard"]:::internal
        DashboardCSS["dashboard.css"]:::internal

        Router --> HomePage
        Router --> AuthPage
        Router --> DashboardPage

        HomePage --> HomeCSS
        DashboardPage --> DashboardCSS
    end

    subgraph "Home Components"
        Header["Header"]:::internal
        Hero["Hero"]:::internal
        Featured["FeaturedProducts"]:::internal
        Categories["Categories"]:::internal
        About["About"]:::internal
        Footer["Footer"]:::internal
    end

    HomePage --> Header
    HomePage --> Hero
    HomePage --> Featured
    HomePage --> Categories
    HomePage --> About
    HomePage --> Footer

    subgraph "Shared & Features"
        MenuComp["Menu Component"]:::internal
        MenuLogic["Menu Feature Logic"]:::internal
    end

    MenuComp --> MenuLogic

    subgraph "Hooks & Libraries"
        DBHook["Database Hook"]:::internal
        GoogleLib["Google OAuth Wrapper"]:::internal
    end

    AuthPage --> GoogleLib
    DBHook -.-> Redux
    DataBundle["Static Data (meal_data.json)"]:::internal
    DataBundle --> Redux

    subgraph "State Management"
        Redux["Redux Store"]:::state
        APISlice["API Slice"]:::state
    end

    HomePage -->|dispatch actions| Redux
    AuthPage -->|dispatch auth| Redux
    DashboardPage -->|dispatch actions| Redux

    Redux --> APISlice
    APISlice -->|HTTP/HTTPS JSON| Backend["Backend REST API"]:::external
    GoogleLib -->|OAuth HTTP| Google["Google OAuth Service"]:::external

    classDef internal fill:#D0E6FF,stroke:#0366d6,color:#000;
    classDef state fill:#DFF7DF,stroke:#28a745,color:#000;
    classDef external fill:#FFE6C7,stroke:#d18b00,color:#000;
    classDef static fill:#E8E8E8,stroke:#999,color:#000;

    click HTML "https://github.com/vegetarian-restaurant/vegetarian_restaurant_front-end/blob/main/public/index.html"
    click Manifest "https://github.com/vegetarian-restaurant/vegetarian_restaurant_front-end/blob/main/public/manifest.json"
    click Robots "https://github.com/vegetarian-restaurant/vegetarian_restaurant_front-end/blob/main/public/robots.txt"
    click Entrypoint "https://github.com/vegetarian-restaurant/vegetarian_restaurant_front-end/blob/main/src/index.js"
    click TopApp "https://github.com/vegetarian-restaurant/vegetarian_restaurant_front-end/blob/main/src/App.js"
    click AppCSS "https://github.com/vegetarian-restaurant/vegetarian_restaurant_front-end/blob/main/src/App.css"
    click HomePage "https://github.com/vegetarian-restaurant/vegetarian_restaurant_front-end/blob/main/src/pages/home/Home_screen.jsx"
    click HomeCSS "https://github.com/vegetarian-restaurant/vegetarian_restaurant_front-end/blob/main/src/pages/home/home.css"
    click Header "https://github.com/vegetarian-restaurant/vegetarian_restaurant_front-end/blob/main/src/pages/home/components/Header.jsx"
    click Hero "https://github.com/vegetarian-restaurant/vegetarian_restaurant_front-end/blob/main/src/pages/home/components/Hero.jsx"
    click Featured "https://github.com/vegetarian-restaurant/vegetarian_restaurant_front-end/blob/main/src/pages/home/components/FeaturedProducts.jsx"
    click Categories "https://github.com/vegetarian-restaurant/vegetarian_restaurant_front-end/blob/main/src/pages/home/components/Categories.jsx"
    click About "https://github.com/vegetarian-restaurant/vegetarian_restaurant_front-end/blob/main/src/pages/home/components/About.jsx"
    click Footer "https://github.com/vegetarian-restaurant/vegetarian_restaurant_front-end/blob/main/src/pages/home/components/Footer.jsx"
    click AuthPage "https://github.com/vegetarian-restaurant/vegetarian_restaurant_front-end/blob/main/src/pages/auth/login.jsx"
    click GoogleLib "https://github.com/vegetarian-restaurant/vegetarian_restaurant_front-end/blob/main/src/lib/google_login.jsx"
    click DashboardPage "https://github.com/vegetarian-restaurant/vegetarian_restaurant_front-end/blob/main/src/pages/dashboard/dashboard.jsx"
    click DashboardCSS "https://github.com/vegetarian-restaurant/vegetarian_restaurant_front-end/blob/main/src/pages/dashboard/dashboard.css"
    click MenuComp "https://github.com/vegetarian-restaurant/vegetarian_restaurant_front-end/blob/main/src/components/menu.jsx"
    click MenuLogic "https://github.com/vegetarian-restaurant/vegetarian_restaurant_front-end/blob/main/src/features/menu.jsx"
    click DBHook "https://github.com/vegetarian-restaurant/vegetarian_restaurant_front-end/blob/main/src/hooks/database.jsx"
    click APISlice "https://github.com/vegetarian-restaurant/vegetarian_restaurant_front-end/blob/main/src/redux/api.jsx"
    click DataBundle "https://github.com/vegetarian-restaurant/vegetarian_restaurant_front-end/blob/main/src/data/meal_data.json"
```
