# rbsuhail/zomatoapp architecture

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

- Interactive diagram: https://gitdiagram.com/rbsuhail/zomatoapp
- Repository: https://github.com/rbsuhail/zomatoapp

## Overview

##### Project type and purpose
- ZomatoClone is a modern, full-stack restaurant discovery platform.
- Frontend built in React + TypeScript + Tailwind. Backend in Node.js + Express + MongoDB.
- Key features: text/location/image search, filters, ratings, responsive UI.

##### File structure
- Top-level:
- ZomatoApp/src → React app (components, pages, context, utils, types)
- ZomatoApp/server → Express API (models, routes, server.js)
- ZomatoApp/scripts → data-import script
- Config files (ESLint, PostCSS, Tailwind, Vite, tsconfig)
- Patterns:
- Frontend: component-driven, context for global state, service wrapper for Axios
- Backend: MVC-style (Models in /models, Controllers implicitly in /routes), single Node monolith
- Deployment:
- Vite dev server (port 5173) + Express dev server (port 5000)
- .env for MongoDB URI, port

##### Extract additional insights from README
- REST API endpoints under /api/restaurants and /api/search
- Image upload (Multer) for food-image search
- Scripts to import seed data into MongoDB
- Tech stack confirms React ↔ Axios ↔ Express ↔ MongoDB flow

##### Elements
- Clear labels: “Browser / React Frontend”, “Express API Server”, “MongoDB”
- From React to each REST endpoint
- From Express to MongoDB
- From Browser geolocation API to React
- File upload flow from React → Express (Multer)
- Blue rectangles for frontend components
- Orange rectangle for backend services

## Diagram (Mermaid)

```mermaid
graph TB
    %% User Device
    subgraph "User's Device"
        Browser["Browser"]:::external
        GeoAPI["Geolocation API"]:::external
    end

    %% Frontend
    subgraph "Client App (React Frontend)"
        direction TB
        Entry["main.tsx"]:::frontend
        HTML["index.html"]:::frontend
        Context["RestaurantContext.tsx"]:::frontend
        API["api.ts"]:::frontend
        subgraph "Pages"
            direction TB
            Home["Home.tsx"]:::frontend
            Search["Search.tsx"]:::frontend
            Details["RestaurantDetails.tsx"]:::frontend
        end
        subgraph "Components"
            direction TB
            Header["Header.tsx"]:::frontend
            Footer["Footer.tsx"]:::frontend
            Hero["Hero.tsx"]:::frontend
            ImageSearch["ImageSearch.tsx"]:::frontend
            RestaurantCard["RestaurantCard.tsx"]:::frontend
            RestaurantsList["RestaurantsList.tsx"]:::frontend
            SearchFilters["SearchFilters.tsx"]:::frontend
        end
    end

    %% Backend
    subgraph "Express API Server"
        direction TB
        Server["server.js"]:::backend
        subgraph "Routes"
            direction TB
            RRoutes["restaurantRoutes.js"]:::backend
            SRoutes["searchRoutes.js"]:::backend
        end
        Model["Restaurant.js"]:::backend
        Multer["Multer Middleware"]:::backend
    end

    %% Database
    subgraph "Database"
        Mongo["MongoDB"]:::database
    end

    %% Scripts
    Import["import-data.js"]:::script

    %% External Services
    subgraph "External/Image Search Service"
        direction TB
        ImgService["Image Recognition Service"]:::external
    end

    %% Relationships
    Browser -->|loads| Entry
    Browser -->|loads| HTML
    Browser -->|uses| GeoAPI
    GeoAPI -->|provides location| Context
    Entry --> Context
    Context --> API
    Home --> API
    Search --> API
    Details --> API
    ImageSearch --> API

    API -->|GET /api/restaurants| RRoutes
    API -->|GET/POST /api/search| SRoutes
    ImageSearch -->|upload image| Multer
    Multer --> SRoutes
    RRoutes --> Model
    SRoutes --> Model
    Server --> RRoutes
    Server --> SRoutes
    Server --> Multer
    Server -->|connects to| Mongo

    Import -->|seed data| Mongo

    ImgService -.->|image search API| SRoutes

    %% Click Events
    click Entry "https://github.com/rbsuhail/zomatoapp/blob/main/ZomatoApp/src/main.tsx"
    click HTML "https://github.com/rbsuhail/zomatoapp/blob/main/ZomatoApp/index.html"
    click Context "https://github.com/rbsuhail/zomatoapp/blob/main/ZomatoApp/src/context/RestaurantContext.tsx"
    click API "https://github.com/rbsuhail/zomatoapp/blob/main/ZomatoApp/src/utils/api.ts"
    click Home "https://github.com/rbsuhail/zomatoapp/blob/main/ZomatoApp/src/pages/Home.tsx"
    click Search "https://github.com/rbsuhail/zomatoapp/blob/main/ZomatoApp/src/pages/Search.tsx"
    click Details "https://github.com/rbsuhail/zomatoapp/blob/main/ZomatoApp/src/pages/RestaurantDetails.tsx"
    click Header "https://github.com/rbsuhail/zomatoapp/blob/main/ZomatoApp/src/components/Header.tsx"
    click Footer "https://github.com/rbsuhail/zomatoapp/blob/main/ZomatoApp/src/components/Footer.tsx"
    click Hero "https://github.com/rbsuhail/zomatoapp/blob/main/ZomatoApp/src/components/Hero.tsx"
    click ImageSearch "https://github.com/rbsuhail/zomatoapp/blob/main/ZomatoApp/src/components/ImageSearch.tsx"
    click RestaurantCard "https://github.com/rbsuhail/zomatoapp/blob/main/ZomatoApp/src/components/RestaurantCard.tsx"
    click RestaurantsList "https://github.com/rbsuhail/zomatoapp/blob/main/ZomatoApp/src/components/RestaurantsList.tsx"
    click SearchFilters "https://github.com/rbsuhail/zomatoapp/blob/main/ZomatoApp/src/components/SearchFilters.tsx"
    click Server "https://github.com/rbsuhail/zomatoapp/blob/main/ZomatoApp/server/server.js"
    click Model "https://github.com/rbsuhail/zomatoapp/blob/main/ZomatoApp/server/models/Restaurant.js"
    click RRoutes "https://github.com/rbsuhail/zomatoapp/blob/main/ZomatoApp/server/routes/restaurantRoutes.js"
    click SRoutes "https://github.com/rbsuhail/zomatoapp/blob/main/ZomatoApp/server/routes/searchRoutes.js"
    click Import "https://github.com/rbsuhail/zomatoapp/blob/main/ZomatoApp/scripts/import-data.js"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#004085,color:#004085
    classDef backend fill:#ffe5b4,stroke:#b36b00,color:#b36b00
    classDef database fill:#d4edda,stroke:#155724,color:#155724,shape:cylinder
    classDef external fill:#f2f2f2,stroke:#6c757d,color:#6c757d,stroke-dasharray: 5 5
    classDef script fill:#e2e3e5,stroke:#6c757d,color:#383d41,stroke-dasharray: 2 2
```
