# pratyush83078/sviggi architecture

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

- Interactive diagram: https://gitdiagram.com/pratyush83078/sviggi
- Repository: https://github.com/pratyush83078/sviggi

## Overview

1. **Overall shape**
   - This is a two-part repository: a **React/Vite TypeScript frontend** at the root and a **Node/Express backend** under `backend/`.
   - The frontend is the main product surface; the backend exists to supply restaurant data and likely acts as a lightweight API layer for the UI.

2. **Frontend composition root**
   - `App.tsx` is the top-level UI composition point. It likely wires together the navbar, the restaurant discovery sections, and the static pages.
   - `src/components/body.tsx` appears to be the main landing-page container where the primary restaurant browsing experience is assembled.

3. **Navigation and page chrome**
   - `src/components/Header/navbar.tsx` plus its module CSS define the persistent header/navigation boundary.
   - This is the top-level user navigation layer and probably links to the main browse view, About, and Help sections.

4. **Restaurant browsing subsystem**
   - `src/components/Cards/Restaurants.tsx`, `RestaurantsGridList.tsx`, `Cuisins.tsx`, and `NearMe.tsx` form the core discovery UI.
   - These components likely handle restaurant listing, grouping by cuisine, and nearby restaurant presentations as separate view blocks.

5. **Loading and empty-state behavior**
   - `src/components/Cards/Shimmer.tsx` is the visual loading placeholder for restaurant data.
   - That indicates the UI is designed around asynchronous fetches, with shimmer states shown while restaurant lists are being loaded.

6. **Data-fetching boundary**
   - `src/utils/useAPI.ts` is the generic data-access hook for fetching backend data.
   - `src/utils/useRestaurantMenu.ts` is a more specific hook for restaurant/menu detail retrieval, suggesting a separate path for list data vs. detail data.

7. **Shared domain data**
   - `src/utils/constants.ts` centralizes app-wide constants, likely including API URLs, static config, or reusable restaurant/cuisine metadata.
   - This file acts as the shared contract between UI components and the data layer.

8. **Static informational pages**
   - `src/components/About.tsx` and `src/components/Help.tsx` represent non-transactional content sections.
   - In architecture terms, these are simple content views separate from the restaurant discovery flow.

9. **Styling system**
   - Styling is mixed: `src/styles/global.css` and `src/styles/tailwind.css` provide global and utility-based styling, while component-specific CSS modules exist for the navbar and card grid.
   - `src/components/Cards/cards.css` suggests the restaurant card family has its own shared presentation layer.

10. **Backend service boundary**
   - `backend/server.js` is the server entry point for the Express API.
   - Its role is to serve the frontend’s restaurant/menu data requests; the frontend’s custom hooks are the primary consumers of this API.

11. **Build/runtime tooling**
   - The frontend is built with **Vite**, **React**, and **TypeScript**; the backend is **Node.js + Express**.
   - `eslint.config.js` and the TS config files show the repo is set up for static typing and linted development across both tiers.

12. **What the diagram should emphasize**
   - The main flow is: **user interaction in React UI → custom hook fetches data → Express backend responds → UI renders restaurant cards/menu views**.
   - The main architectural boundaries are **presentation components**, **data-fetching hooks**, and the **backend API**.
   - Missing features in the README, such as detailed restaurant pages, location-based discovery, filtering, and cart, are not yet major subsystems in the current architecture.

Main entry points: [`src/utils/useAPI.ts`](https://github.com/pratyush83078/sviggi/blob/main/src/utils/useAPI.ts) (useAPI), [`src/components/body.tsx`](https://github.com/pratyush83078/sviggi/blob/main/src/components/body.tsx) (Body), [`App.tsx`](https://github.com/pratyush83078/sviggi/blob/main/App.tsx) (App), [`src/components/Cards/Restaurants.tsx`](https://github.com/pratyush83078/sviggi/blob/main/src/components/Cards/Restaurants.tsx) (Restaurants)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Presentation"]
  node_app["App<br/>react entry<br/>[App.tsx]"]
  node_body["Body<br/>landing view<br/>[body.tsx]"]
  node_navbar["Navbar<br/>nav chrome<br/>[navbar.tsx]"]
  node_restaurants["Restaurants<br/>list view<br/>[Restaurants.tsx]"]
  node_gridlist["Grid List<br/>layout view"]
  node_cuisins["Cuisins<br/>cuisine view<br/>[Cuisins.tsx]"]
  node_nearme["Near Me<br/>location view<br/>[NearMe.tsx]"]
  node_shimmer["Shimmer<br/>loading state<br/>[Shimmer.tsx]"]
  node_about["About<br/>content page<br/>[About.tsx]"]
  node_help["Help<br/>content page<br/>[Help.tsx]"]
end

subgraph group_data["Data Layer"]
  node_useapi["useAPI<br/>fetch hook<br/>[useAPI.ts]"]
  node_menuhook["Menu Hook<br/>detail hook"]
  node_constants["Constants<br/>shared config<br/>[constants.ts]"]
end

subgraph group_backend["Backend API"]
  node_server["Server<br/>express api<br/>[server.js]"]
end

node_app -->|"mounts"| node_navbar
node_app -->|"renders"| node_body
node_app -->|"routes"| node_about
node_app -->|"routes"| node_help
node_body -->|"contains"| node_restaurants
node_body -->|"contains"| node_gridlist
node_body -->|"contains"| node_cuisins
node_body -->|"contains"| node_nearme
node_restaurants -->|"loads"| node_shimmer
node_restaurants -->|"fetches"| node_useapi
node_gridlist -->|"fetches"| node_useapi
node_cuisins -->|"fetches"| node_useapi
node_nearme -->|"fetches"| node_useapi
node_useapi -->|"requests"| node_server
node_menuhook -->|"requests"| node_server
node_constants -->|"configures"| node_useapi
node_constants -->|"configures"| node_menuhook

click node_app "https://github.com/pratyush83078/sviggi/blob/main/App.tsx"
click node_body "https://github.com/pratyush83078/sviggi/blob/main/src/components/body.tsx"
click node_navbar "https://github.com/pratyush83078/sviggi/blob/main/src/components/Header/navbar.tsx"
click node_restaurants "https://github.com/pratyush83078/sviggi/blob/main/src/components/Cards/Restaurants.tsx"
click node_gridlist "https://github.com/pratyush83078/sviggi/blob/main/src/components/Cards/RestaurantsGridList.tsx"
click node_cuisins "https://github.com/pratyush83078/sviggi/blob/main/src/components/Cards/Cuisins.tsx"
click node_nearme "https://github.com/pratyush83078/sviggi/blob/main/src/components/Cards/NearMe.tsx"
click node_shimmer "https://github.com/pratyush83078/sviggi/blob/main/src/components/Cards/Shimmer.tsx"
click node_about "https://github.com/pratyush83078/sviggi/blob/main/src/components/About.tsx"
click node_help "https://github.com/pratyush83078/sviggi/blob/main/src/components/Help.tsx"
click node_useapi "https://github.com/pratyush83078/sviggi/blob/main/src/utils/useAPI.ts"
click node_menuhook "https://github.com/pratyush83078/sviggi/blob/main/src/utils/useRestaurantMenu.ts"
click node_constants "https://github.com/pratyush83078/sviggi/blob/main/src/utils/constants.ts"
click node_server "https://github.com/pratyush83078/sviggi/blob/main/backend/server.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_body,node_navbar,node_restaurants,node_gridlist,node_cuisins,node_nearme,node_shimmer,node_about,node_help toneBlue
class node_useapi,node_menuhook,node_constants toneAmber
class node_server toneMint
```

## Components

### Presentation

React UI composition, navigation, and restaurant browsing views.

- [App](https://github.com/pratyush83078/sviggi/blob/main/App.tsx): react entry · Top-level composition root for the UI. · `App.tsx`
- [Body](https://github.com/pratyush83078/sviggi/blob/main/src/components/body.tsx): landing view · Main landing-page container for the restaurant browsing experience. · `src/components/body.tsx`
- [Navbar](https://github.com/pratyush83078/sviggi/blob/main/src/components/Header/navbar.tsx): nav chrome · Persistent header and navigation boundary. · `src/components/Header/navbar.tsx`
- [Restaurants](https://github.com/pratyush83078/sviggi/blob/main/src/components/Cards/Restaurants.tsx): list view · Primary restaurant listing component. · `src/components/Cards/Restaurants.tsx`
- [Grid List](https://github.com/pratyush83078/sviggi/blob/main/src/components/Cards/RestaurantsGridList.tsx): layout view · Restaurant grid/list presentation layer. · `src/components/Cards/RestaurantsGridList.tsx`
- [Cuisins](https://github.com/pratyush83078/sviggi/blob/main/src/components/Cards/Cuisins.tsx): cuisine view · Cuisine-based discovery block. · `src/components/Cards/Cuisins.tsx`
- [Near Me](https://github.com/pratyush83078/sviggi/blob/main/src/components/Cards/NearMe.tsx): location view · Nearby restaurant discovery block. · `src/components/Cards/NearMe.tsx`
- [Shimmer](https://github.com/pratyush83078/sviggi/blob/main/src/components/Cards/Shimmer.tsx): loading state · Skeleton placeholder shown while restaurant data loads. · `src/components/Cards/Shimmer.tsx`
- [About](https://github.com/pratyush83078/sviggi/blob/main/src/components/About.tsx): content page · Static informational page. · `src/components/About.tsx`
- [Help](https://github.com/pratyush83078/sviggi/blob/main/src/components/Help.tsx): content page · Static support and help page. · `src/components/Help.tsx`

### Data Layer

Shared constants and custom hooks that fetch restaurant and menu data.

- [useAPI](https://github.com/pratyush83078/sviggi/blob/main/src/utils/useAPI.ts): fetch hook · Generic hook for backend data access. · `src/utils/useAPI.ts`
- [Menu Hook](https://github.com/pratyush83078/sviggi/blob/main/src/utils/useRestaurantMenu.ts): detail hook · Hook for restaurant and menu detail retrieval. · `src/utils/useRestaurantMenu.ts`
- [Constants](https://github.com/pratyush83078/sviggi/blob/main/src/utils/constants.ts): shared config · Shared app constants and data contract values. · `src/utils/constants.ts`

### Backend API

Express server that supplies data to the frontend.

- [Server](https://github.com/pratyush83078/sviggi/blob/main/backend/server.js): express api · Backend entry point for restaurant and menu data. · `backend/server.js`

## Connections

- App → Navbar: mounts · App composes the persistent navigation.
- App → Body: renders · App mounts the main landing experience.
- App → About: routes · App exposes the About page.
- App → Help: routes · App exposes the Help page.
- Body → Restaurants: contains · Main landing view assembles the restaurant browsing flow.
- Body → Grid List: contains · Landing experience includes list/grid presentation.
- Body → Cuisins: contains · Landing experience includes cuisine-based browsing.
- Body → Near Me: contains · Landing experience includes nearby discovery.
- Restaurants → Shimmer: loads · Restaurant listing uses a loading placeholder during fetches.
- Restaurants → useAPI: fetches · Restaurant listing consumes the generic data hook.
- Grid List → useAPI: fetches · Grid/list presentation pulls restaurant data.
- Cuisins → useAPI: fetches · Cuisine view depends on backend data.
- Near Me → useAPI: fetches · Nearby view depends on backend data.
- useAPI → Server: requests · Generic hook calls the Express API.
- Menu Hook → Server: requests · Menu/detail hook calls the backend API.
- Constants → useAPI: configures · Shared constants shape generic fetch behavior.
- Constants → Menu Hook: configures · Shared constants support menu/detail retrieval.
