# hesersu/menu-please-client architecture

> Architecture diagram of the GitHub repository hesersu/menu-please-client, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hesersu/menu-please-client
- Repository: https://github.com/hesersu/menu-please-client

## Overview

##### Project type and purpose
- Project type: Single‑Page Application (SPA) front end only
- Purpose: Allow users to browse Chinese, Japanese, Korean menus; place orders; use speech‑to‑text; view order history; translate menus.

##### File structure
- Top level:
– public/: static assets and redirect configuration
– src/: application source code
- components/: reusable UI widgets (Shadcn/ui)
- contexts/: React Context providers (auth, menu, speech)
- pages/: route‑specific page components
- lib/: utility functions
- assets/: images/fonts etc.
- App.jsx & main.jsx: app bootstrap with Vite
- Config & tooling: vite.config.js, eslint.config.js, package.json, vercel.json

##### README for additional insights
- Tech stack: React, Vite, Tailwind v4, Shadcn/ui, Context API for state, Axios/Fetch for API calls, ESLint
- Features: browsing, ordering, reservations, speech‑to‑text, translation, responsive design

##### Main components & interactions
– Browser / Client Device (Mobile/Desktop)
– Static Hosting / CDN (Netlify/Vercel) serving index.html and bundle
– React SPA
- App shell (App.jsx)
- Page components (LoginPage, TranslateMenuPage, etc.)
- UI library components (button, card, dialog, etc.)
- Context Providers (AuthContext, MenuContext, SpeechContext)
– External Services
- Authentication API (login/signup)
- Menu Data API (fetch menus, history)
- Order Processing API
- Translation API (menu translation)
- Speech‑to‑Text API (speech recognition)
b. Relationships & Flows
– User clicks → React Router → Page component
– Page accesses Context → performs state changes or API calls
– Context or utility functions (src/lib/utils.js) make HTTP requests via Axios/Fetch
– Data returned flows back through Context into components
– SpeechContext streams audio to Speech‑to‑Text API and returns transcript
c. Architectural patterns
– SPA (client‑side routing via React Router)
– Context API for global state (auth, menu, speech)
– Component‑based UI (Shadcn/ui & Tailwind)
– Separation of concerns: pages vs. shared components vs. contexts vs. utils
d. Key technologies & libraries
– Vite (dev server, bundler)
– React & React Router
– Tailwind CSS & Shadcn/ui for styling
– Context API for state management
– Axios / Fetch for HTTP
– Speech SDK / Web Speech API for speech‑to‑text

## Diagram (Mermaid)

```mermaid
flowchart TD
    classDef react fill:#cce5ff,stroke:#1f6feb,color:#000;
    classDef hosting fill:#d1e7dd,stroke:#198754,color:#000;
    classDef api fill:#fff3cd,stroke:#ffc107,color:#000;
    classDef arrow stroke:#6c757d,stroke-width:2px;

    %% User and Hosting
    User["User"]:::hosting
    Browser["Browser"]:::hosting
    StaticHosting["Static Hosting/CDN\n(Netlify/Vercel)"]:::hosting

    User -->|"interacts via UI"| Browser:::arrow
    Browser -->|"requests index.html & bundle"| StaticHosting:::arrow

    StaticHosting -->|"serves SPA"| ReactApp["React SPA"]:::react

    %% React Application
    subgraph "React SPA" 
        direction TB

        AppBootstrap["main.jsx"]:::react
        AppShell["App.jsx"]:::react
        AppBootstrap -->|"bootstraps"| AppShell:::arrow

        subgraph "Context Providers" 
            direction TB
            AuthContext["AuthContext"]:::react
            MenuContext["MenuContext"]:::react
            SpeechContext["SpeechContext"]:::react
        end
        AppShell -->|"wrapped by"| AuthContext:::arrow
        AuthContext -->|"wraps"| MenuContext
        MenuContext -->|"wraps"| SpeechContext

        SpeechContext -->|"provides to"| AppShell

        subgraph "Router & Pages"
            direction TB
            LoginPage["LoginPage"]:::react
            SignUpPage["SignUpPage"]:::react
            OrderMenuPage["OrderMenuPage"]:::react
            TranslateMenuPage["TranslateMenuPage"]:::react
            MenuHistoryPage["MenuHistoryPage"]:::react
            ProfilePage["ProfilePage"]:::react
            ResultPage["ResultPage"]:::react
            AboutUsPage["AboutUsPage"]:::react
            NotFoundPage["NotFoundPage"]:::react
        end
        AppShell -->|"routes to"| LoginPage
        AppShell -->|"routes to"| SignUpPage
        AppShell -->|"routes to"| OrderMenuPage
        AppShell -->|"routes to"| TranslateMenuPage
        AppShell -->|"routes to"| MenuHistoryPage
        AppShell -->|"routes to"| ProfilePage
        AppShell -->|"routes to"| ResultPage
        AppShell -->|"routes to"| AboutUsPage
        AppShell -->|"routes to"| NotFoundPage

        subgraph "Shared UI Components"
            direction TB
            ProtectedRoute["ProtectedRoute"]:::react
            Navbar["Navbar"]:::react
            Footer["Footer"]:::react
            LoadingSpinner["LoadingSpinner"]:::react
            AnimatedHeader["AnimatedHeader"]:::react
            DarkModeToggle["DarkModeToggle"]:::react
            LoginForm["LoginForm"]:::react
            SignUpForm["SignUpForm"]:::react
            ThemeProvider["ThemeProvider"]:::react
        end

        subgraph "Shadcn/ui Components"
            direction TB
            Accordion["Accordion"]:::react
            AspectRatio["AspectRatio"]:::react
            Avatar["Avatar"]:::react
            Button["Button"]:::react
            Card["Card"]:::react
            Dialog["Dialog"]:::react
            DropdownMenu["DropdownMenu"]:::react
            Form["Form"]:::react
            Input["Input"]:::react
            Label["Label"]:::react
            NavigationMenu["NavigationMenu"]:::react
            ScrollArea["ScrollArea"]:::react
            Select["Select"]:::react
            Separator["Separator"]:::react
            Sheet["Sheet"]:::react
            Switch["Switch"]:::react
            Table["Table"]:::react
        end

        Utils["utils.js"]:::react

        %% Data flows
        LoginPage -->|"uses"| AuthContext:::arrow
        SignUpPage -->|"uses"| AuthContext
        OrderMenuPage -->|"uses"| MenuContext
        MenuHistoryPage -->|"uses"| MenuContext
        TranslateMenuPage -->|"uses"| MenuContext
        TranslateMenuPage -->|"uses"| SpeechContext
        ResultPage -->|"displays"| MenuContext
        ProfilePage -->|"uses"| AuthContext

        AuthContext -->|"calls"| AuthAPI
        MenuContext -->|"calls"| MenuAPI
        MenuContext -->|"calls"| OrderAPI
        TranslateMenuPage -->|"calls"| TranslationAPI
        SpeechContext -->|"calls"| SpeechAPI

        Utils -->|"helper for HTTP"| AuthContext
        Utils -->|"helper for HTTP"| MenuContext
        Utils -->|"helper for HTTP"| TranslateMenuPage
    end

    %% External Services
    subgraph "External / Third-Party APIs"
        direction TB
        AuthAPI["Authentication API"]:::api
        MenuAPI["Menu Data API"]:::api
        OrderAPI["Order Processing API"]:::api
        TranslationAPI["Translation API"]:::api
        SpeechAPI["Speech-to-Text API"]:::api
    end

    %% Click Events
    click AppShell "https://github.com/hesersu/menu-please-client/blob/main/src/App.jsx"
    click AppBootstrap "https://github.com/hesersu/menu-please-client/blob/main/src/main.jsx"
    click AuthContext "https://github.com/hesersu/menu-please-client/blob/main/src/contexts/authContext.jsx"
    click MenuContext "https://github.com/hesersu/menu-please-client/blob/main/src/contexts/menuContext.jsx"
    click SpeechContext "https://github.com/hesersu/menu-please-client/blob/main/src/contexts/speechContext.jsx"
    click LoginPage "https://github.com/hesersu/menu-please-client/blob/main/src/pages/LoginPage.jsx"
    click SignUpPage "https://github.com/hesersu/menu-please-client/blob/main/src/pages/SignUpPage.jsx"
    click OrderMenuPage "https://github.com/hesersu/menu-please-client/blob/main/src/pages/OrderMenuPage.jsx"
    click TranslateMenuPage "https://github.com/hesersu/menu-please-client/blob/main/src/pages/TranslateMenuPage.jsx"
    click MenuHistoryPage "https://github.com/hesersu/menu-please-client/blob/main/src/pages/MenuHistoryPage.jsx"
    click ProfilePage "https://github.com/hesersu/menu-please-client/blob/main/src/pages/ProfilePage.jsx"
    click ResultPage "https://github.com/hesersu/menu-please-client/blob/main/src/pages/ResultPage.jsx"
    click AboutUsPage "https://github.com/hesersu/menu-please-client/blob/main/src/pages/AboutUsPage.jsx"
    click NotFoundPage "https://github.com/hesersu/menu-please-client/blob/main/src/pages/NotFoundPage.jsx"
    click ProtectedRoute "https://github.com/hesersu/menu-please-client/blob/main/src/components/ProtectedRoute.jsx"
    click Accordion "https://github.com/hesersu/menu-please-client/blob/main/src/components/ui/accordion.jsx"
    click AspectRatio "https://github.com/hesersu/menu-please-client/blob/main/src/components/ui/aspect-ratio.jsx"
    click Avatar "https://github.com/hesersu/menu-please-client/blob/main/src/components/ui/avatar.jsx"
    click Button "https://github.com/hesersu/menu-please-client/blob/main/src/components/ui/button.jsx"
    click Card "https://github.com/hesersu/menu-please-client/blob/main/src/components/ui/card.jsx"
    click Dialog "https://github.com/hesersu/menu-please-client/blob/main/src/components/ui/dialog.jsx"
    click DropdownMenu "https://github.com/hesersu/menu-please-client/blob/main/src/components/ui/dropdown-menu.jsx"
    click Form "https://github.com/hesersu/menu-please-client/blob/main/src/components/ui/form.jsx"
    click Input "https://github.com/hesersu/menu-please-client/blob/main/src/components/ui/input.jsx"
    click Label "https://github.com/hesersu/menu-please-client/blob/main/src/components/ui/label.jsx"
    click NavigationMenu "https://github.com/hesersu/menu-please-client/blob/main/src/components/ui/navigation-menu.jsx"
    click ScrollArea "https://github.com/hesersu/menu-please-client/blob/main/src/components/ui/scroll-area.jsx"
    click Select "https://github.com/hesersu/menu-please-client/blob/main/src/components/ui/select.jsx"
    click Separator "https://github.com/hesersu/menu-please-client/blob/main/src/components/ui/separator.jsx"
    click Sheet "https://github.com/hesersu/menu-please-client/blob/main/src/components/ui/sheet.jsx"
    click Switch "https://github.com/hesersu/menu-please-client/blob/main/src/components/ui/switch.jsx"
    click Table "https://github.com/hesersu/menu-please-client/blob/main/src/components/ui/table.jsx"
    click Navbar "https://github.com/hesersu/menu-please-client/blob/main/src/components/navbar.jsx"
    click Footer "https://github.com/hesersu/menu-please-client/blob/main/src/components/footer.jsx"
    click LoadingSpinner "https://github.com/hesersu/menu-please-client/blob/main/src/components/loading-spinner.jsx"
    click AnimatedHeader "https://github.com/hesersu/menu-please-client/blob/main/src/components/animatedHeader.jsx"
    click DarkModeToggle "https://github.com/hesersu/menu-please-client/blob/main/src/components/darkmode-toggle.jsx"
    click LoginForm "https://github.com/hesersu/menu-please-client/blob/main/src/components/login-form.jsx"
    click SignUpForm "https://github.com/hesersu/menu-please-client/blob/main/src/components/sign-up-form.jsx"
    click ThemeProvider "https://github.com/hesersu/menu-please-client/blob/main/src/components/theme-provider.jsx"
    click Utils "https://github.com/hesersu/menu-please-client/blob/main/src/lib/utils.js"
```
