# paramsingh77/findnearme architecture

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

- Interactive diagram: https://gitdiagram.com/paramsingh77/findnearme
- Repository: https://github.com/paramsingh77/findnearme

## Overview

##### Project Type and Purpose
- This is a full-stack “Find Near Me” web application.
- Frontend is a React SPA (bootstrapped with Create React App) using Leaflet for maps.
- Backend is a Flask service exposing REST endpoints to fetch nearby restaurants, hospitals, gas stations, etc., based on CSV data and external APIs (e.g., Google Places).

##### File Structure
- Top-level:
- backend/ – Flask app.py, CSV and text data files.
- public/, src/ – React static assets, components, entry point (src/index.js).
- setupProxy.js – dev proxy forwarding `/api` calls to Flask.
- karrik_fonts-main/ & fonts/ – font assets (styling support).
- React source under src/components and src/subComponents follows a UI-component hierarchy (LandingPage, Map, Header, modals, lists).
- Backend data store is flat files (CSV) with no DB; Flask routes load/process them and return JSON.

##### README Insights
- Multiple screenshots showing pages: landing, listings, modals, map overlays.
- README confirms frontend/backend separation and working demos.

##### Main Components & Relationships
a. Frontend (React)
– Browser runs React SPA, renders UI, handles user input (location selection, category filters).
– Map component uses Leaflet, retrieves map tiles from an external tile service (OpenStreetMap).
– HTTP layer (fetch/axios) calls backend endpoints under `/api`.
b. Backend (Flask)
– Exposes REST routes (e.g., `/api/restaurant`, `/api/hospital`, `/api/gas`).
– Reads CSV/text data files for place IDs or coordinates.
– Optionally calls Google Places API for detailed info.
– Returns JSON payloads.
c. Data Sources
– CSV files under backend/ (e.g., Food1.csv, Hospital.csv).
– Generated data.json or data.txt from preprocessing scripts (n.py).
d. External Services
– Map tile server (e.g., https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png).
– Google Places API (for detailed place info).

##### Architectural Patterns & Design Principles
- Client-Server: clear separation of concerns.
- RESTful API: backend acts as stateless microservice.
- Proxy Pattern in dev: setupProxy.js to avoid CORS.
- Flat-file data service: no heavy DB layer, lightweight JSON responses.
- Component-based UI: React components & subcomponents enforce modularity.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User and Browser
    A[User]:::external
    A --> B[React SPA]:::frontend

    %% Configuration Files
    subgraph "Configuration"
        Pkg["package.json"]:::frontend
        Pub["public/index.html"]:::frontend
    end

    %% React Entry Point
    subgraph "React Entry" 
        IDX["src/index.js"]:::frontend
        APP["src/App.js"]:::frontend
    end

    %% UI Layer
    subgraph "UI Layer"
        LP["LandingPage"]:::frontend
        HD["Header"]:::frontend
        LO["LocationOptions"]:::frontend
        MAP["Map"]:::frontend
        GS["GasStations"]:::frontend
        HP["Hospitals"]:::frontend
        MT["Motels"]:::frontend
        RT["Restaraunt"]:::frontend
        SN["ShopNeighbour"]:::frontend
        EM["Empty"]:::frontend
        TI["Title"]:::frontend

        subgraph "Subcomponents"
            M1["Modal"]:::frontend
            M2["SecondaryModal"]:::frontend
            R1["Rest"]:::frontend
            H1["Hos"]:::frontend
            G1["gas"]:::frontend
            G2["GassStations"]:::frontend
            Lc["Leftcomponent"]:::frontend
        end
    end

    %% HTTP Client
    subgraph "HTTP Client"
        HTTP["Fetch/Axios"]:::frontend
    end

    %% Backend API Service
    subgraph "Backend API Service"
        APPPY["backend/app.py"]:::backend
        APPI["backend/app1.py"]:::backend
    end

    %% Data Store
    subgraph "Data Store"
        DF1["Food1.csv"]:::datastore
        DF2["Hospital.csv"]:::datastore
        DF3["Hospitals 2.csv"]:::datastore
        DF4["NEW.csv"]:::datastore
        DF5["gasStation.csv"]:::datastore
        DF6["data2.csv"]:::datastore
        DJSON["data.json"]:::datastore
        DTXT["data.txt"]:::datastore
        PID1["place_id.txt"]:::datastore
        PID2["place_id1.txt"]:::datastore
        NP["n.py"]:::datastore
    end

    %% Font Assets
    subgraph "Font Assets"
        F1["fonts/"]:::external
        F2["karrik_fonts-main/"]:::external
    end

    %% External Services
    ET["OpenStreetMap Tile Service"]:::external
    GP["Google Places API"]:::external

    %% Connections
    B --> IDX
    B --> APP

    IDX --> APP
    APP -->|renders| LP
    APP -->|renders| HD
    APP -->|renders| LO
    APP -->|renders| MAP
    APP -->|renders| GS
    APP -->|renders| HP
    APP -->|renders| MT
    APP -->|renders| RT
    APP -->|renders| SN
    APP -->|renders| EM
    APP -->|renders| TI

    LP --> M1
    LP --> M2
    LP --> R1
    LP --> H1
    LP --> G1
    LP --> G2
    LP --> Lc

    MAP --> ET

    B --> HTTP
    HTTP -->|"/api/<category>"| APPPY
    APPPY --> DF1
    APPPY --> DF2
    APPPY --> DF3
    APPPY --> DF4
    APPPY --> DF5
    APPPY --> DF6
    APPPY --> DJSON
    APPPY --> DTXT
    APPPY --> PID1
    APPPY --> PID2
    APPPY -->|calls| GP
    APPPY --> HTTP
    HTTP -->|JSON response| B
    B -->|updates| MAP

    %% Click Events
    click Pkg "https://github.com/paramsingh77/findnearme/blob/main/package.json"
    click Pub "https://github.com/paramsingh77/findnearme/blob/main/public/index.html"
    click IDX "https://github.com/paramsingh77/findnearme/blob/main/src/index.js"
    click APP "https://github.com/paramsingh77/findnearme/blob/main/src/App.js"
    click LP "https://github.com/paramsingh77/findnearme/blob/main/src/components/LandingPage.js"
    click HD "https://github.com/paramsingh77/findnearme/blob/main/src/components/Header.js"
    click LO "https://github.com/paramsingh77/findnearme/blob/main/src/components/LocationOptions.js"
    click MAP "https://github.com/paramsingh77/findnearme/blob/main/src/components/Map.js"
    click GS "https://github.com/paramsingh77/findnearme/blob/main/src/components/GasStations.js"
    click HP "https://github.com/paramsingh77/findnearme/blob/main/src/components/Hospitals.js"
    click MT "https://github.com/paramsingh77/findnearme/blob/main/src/components/Motels.js"
    click RT "https://github.com/paramsingh77/findnearme/blob/main/src/components/Restaraunt.js"
    click SN "https://github.com/paramsingh77/findnearme/blob/main/src/components/ShopNeighbour.js"
    click EM "https://github.com/paramsingh77/findnearme/blob/main/src/components/Empty.js"
    click TI "https://github.com/paramsingh77/findnearme/blob/main/src/components/Title.js"
    click M1 "https://github.com/paramsingh77/findnearme/blob/main/src/subComponents/Modal.js"
    click M2 "https://github.com/paramsingh77/findnearme/blob/main/src/subComponents/SecondaryModal.js"
    click R1 "https://github.com/paramsingh77/findnearme/blob/main/src/subComponents/Rest.js"
    click H1 "https://github.com/paramsingh77/findnearme/blob/main/src/subComponents/Hos.js"
    click G1 "https://github.com/paramsingh77/findnearme/blob/main/src/subComponents/gas.js"
    click G2 "https://github.com/paramsingh77/findnearme/blob/main/src/subComponents/GassStations.js"
    click Lc "https://github.com/paramsingh77/findnearme/blob/main/src/subComponents/Leftcomponent.js"
    click HTTP "https://github.com/paramsingh77/findnearme/blob/main/setupProxy.js"
    click APPPY "https://github.com/paramsingh77/findnearme/blob/main/backend/app.py"
    click APPI "https://github.com/paramsingh77/findnearme/blob/main/backend/app1.py"
    click DF1 "https://github.com/paramsingh77/findnearme/blob/main/backend/Food1.csv"
    click DF2 "https://github.com/paramsingh77/findnearme/blob/main/backend/Hospital.csv"
    click DF3 "https://github.com/paramsingh77/findnearme/blob/main/backend/Hospitals 2.csv"
    click DF4 "https://github.com/paramsingh77/findnearme/blob/main/backend/NEW.csv"
    click DF5 "https://github.com/paramsingh77/findnearme/blob/main/backend/gasStation.csv"
    click DF6 "https://github.com/paramsingh77/findnearme/blob/main/backend/data2.csv"
    click DJSON "https://github.com/paramsingh77/findnearme/blob/main/backend/data.json"
    click DTXT "https://github.com/paramsingh77/findnearme/blob/main/backend/data.txt"
    click PID1 "https://github.com/paramsingh77/findnearme/blob/main/backend/place_id.txt"
    click PID2 "https://github.com/paramsingh77/findnearme/blob/main/backend/place_id1.txt"
    click NP "https://github.com/paramsingh77/findnearme/blob/main/backend/n.py"
    click F1 "https://github.com/paramsingh77/findnearme/tree/main/fonts/"
    click F2 "https://github.com/paramsingh77/findnearme/tree/main/karrik_fonts-main/"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#004085,color:#004085
    classDef backend fill:#d4edda,stroke:#155724,color:#155724
    classDef datastore fill:#fff3cd,stroke:#856404,color:#856404
    classDef external fill:#f8d7da,stroke:#721c24,color:#721c24
```
