How pratyush83078/sviggi works
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: useAPI.ts useAPI · body.tsx Body · App.tsx App · Restaurants.tsx Restaurants
Components 14
Presentation
React UI composition, navigation, and restaurant browsing views.
- App · Top-level composition root for the UI.
App.tsx - Body · Main landing-page container for the restaurant browsing experience.
src/components/body.tsx - Navbar · Persistent header and navigation boundary.
src/components/Header/navbar.tsx - Restaurants · Primary restaurant listing component.
src/components/Cards/Restaurants.tsx - Grid List · Restaurant grid/list presentation layer.
src/components/Cards/RestaurantsGridList.tsx - Cuisins · Cuisine-based discovery block.
src/components/Cards/Cuisins.tsx - Near Me · Nearby restaurant discovery block.
src/components/Cards/NearMe.tsx - Shimmer · Skeleton placeholder shown while restaurant data loads.
src/components/Cards/Shimmer.tsx - About · Static informational page.
src/components/About.tsx - Help · Static support and help page.
src/components/Help.tsx
Data Layer
Shared constants and custom hooks that fetch restaurant and menu data.
Backend API
Express server that supplies data to the frontend.
- Server · Backend entry point for restaurant and menu data.
backend/server.js
Connections 17
- 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.