# sumit6307/fiesta-deploy architecture

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

- Interactive diagram: https://gitdiagram.com/sumit6307/fiesta-deploy
- Repository: https://github.com/sumit6307/fiesta-deploy

## Overview

##### Project Type and Purpose
- This is a full-stack web application (“Venue Management App”) whose primary goal is to let organizers browse and book event venues, and let venue owners list and manage their spaces.
- The front end is a React/Vite single-page app; the back end is a Node.js/Express API with MongoDB as the data store.

##### File Structure
- Top-level files (package.json, vite.config.js, tailwind.config.js) confirm a modern front-end build (Vite, Tailwind CSS).
- `src/` contains:
- `components/` (UI building blocks)
- `pages/` (routing targets)
- `api/axiosInstance.js` (REST client setup)
- `context/AuthContext.jsx` (global auth state via React Context)
- `hooks/useFetch.js` (data-fetching utility)
- `services/authService.js` (encapsulates auth API calls)
- `public/hotels.json` suggests fallback or mock data.
- No server code is present here, but the README references a Node/Express/MongoDB backend.

##### Key Insights from README
- Confirms a three-tier architecture: React front end, Express API, MongoDB database.
- Feature set includes authentication flows (signup, login, password reset, email verification), venue exploration, booking management.
- Potential external integrations: email service (for verify/reset), map service (Leaflet JS & CSS hint).

##### Main Components
a. Client Tier (Browser)
- React SPA
- React Router (pages)
- Components (cards, filters, panels)
- Context & hooks for state & data fetching
b. API Layer (Server)
- Node.js + Express REST endpoints
- Auth endpoints (/signup, /signin, /verify, /forgot, /reset)
- Venue endpoints (/venues, /bookings, /favorites)
c. Persistence Tier
- MongoDB collections (Users, Venues, Bookings, Favorites, etc.)
d. External Services
- Email provider (SMTP or third-party like SendGrid)
- /geolocation service (Leaflet or external mapping API)

##### Relationships & Data Flows
- The React app issues HTTP(S) calls via axiosInstance to the Express API.
- On login/signup, tokens (JWT) are stored in Context and sent in Authorization headers.
- Venue browsing: GET /venues → JSON → React renders HotelList/HotelCard.
- Booking: POST /bookings → confirmation email triggered by the server.
- Admin flows: venue owners manage availability via protected endpoints (token required).
- MongoDB stores all persistent data; connections managed by the Express server.

##### Architectural Patterns & Design Principles
- Three-tier architecture (Presentation, API, Data)
- React Context for cross-cutting concerns (authentication state)
- Service layer (`services/authService.js`) to abstract HTTP calls
- Separation of UI components vs. pages vs. utility hooks
- RESTful API design on the server side
- Fallback/mock data in `public/hotels.json` for development/testing

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Client (Browser)"
        subgraph "React SPA (Config & Entry)"
            Index["index.html"]:::frontend
            ViteConfig["vite.config.js"]:::frontend
            TailwindConfig["tailwind.config.js"]:::frontend
            PackageJSON["package.json"]:::frontend
            MainJS["src/main.jsx"]:::frontend
            AppJS["src/App.jsx"]:::frontend
        end
        subgraph "Pages"
            PagesDir["src/pages/"]:::frontend
        end
        subgraph "Components"
            ComponentsDir["src/components/"]:::frontend
        end
        subgraph "Context & Hooks"
            AuthContext["AuthContext.jsx"]:::frontend
            UseFetch["useFetch.js"]:::frontend
        end
        AxiosClient["axiosInstance.js"]:::frontend
        AuthService["authService.js"]:::frontend
        MockData["hotels.json"]:::frontend
        subgraph "Styles"
            MapCSS["leaflet.css"]:::frontend
            GlobalCSS["global.css"]:::frontend
            HotelCardCSS["HotelCard.css"]:::frontend
            HotelListCSS["HotelList.css"]:::frontend
        end
    end

    subgraph "API Server"
        ExpressServer["Express API Server"]:::backend
        subgraph "Controllers & Middleware"
            AuthCtrl["AuthController"]:::backend
            VenueCtrl["VenueController"]:::backend
            BookingCtrl["BookingController"]:::backend
            JWTMW["JWT Middleware"]:::backend
        end
    end

    MongoDB["MongoDB"]:::database

    subgraph "External Services"
        EmailService["SMTP / SendGrid"]:::external
        MapService["Leaflet / Map Service"]:::external
    end

    %% Relationships
    Index -->|loads SPA| ExpressServer
    ViteConfig --> ExpressServer
    TailwindConfig --> ExpressServer
    PackageJSON --> ExpressServer
    MainJS --> ExpressServer
    AppJS --> ExpressServer
    PagesDir -->|uses routes| AppJS
    ComponentsDir -->|renders UI| AppJS
    AuthContext -->|provides state| ComponentsDir
    UseFetch -->|fetches data via| AxiosClient
    AxiosClient -->|calls REST| ExpressServer
    AuthService -->|wraps auth calls| AxiosClient
    MockData -->|fallback data| PagesDir
    MapCSS -->|styling map| ComponentsDir
    GlobalCSS --> AppJS
    HotelCardCSS --> ComponentsDir
    HotelListCSS --> ComponentsDir

    ExpressServer -->|queries| MongoDB
    ExpressServer -->|sends email via| EmailService
    ExpressServer -->|issues tokens| AuthCtrl
    ExpressServer -->|validates token| JWTMW
    MapService -->|tiles| ComponentsDir

    %% Click events
    click Index "https://github.com/sumit6307/fiesta-deploy/blob/main/index.html"
    click ViteConfig "https://github.com/sumit6307/fiesta-deploy/blob/main/vite.config.js"
    click TailwindConfig "https://github.com/sumit6307/fiesta-deploy/blob/main/tailwind.config.js"
    click PackageJSON "https://github.com/sumit6307/fiesta-deploy/blob/main/package.json"
    click MainJS "https://github.com/sumit6307/fiesta-deploy/blob/main/src/main.jsx"
    click AppJS "https://github.com/sumit6307/fiesta-deploy/blob/main/src/App.jsx"
    click PagesDir "https://github.com/sumit6307/fiesta-deploy/tree/main/src/pages/"
    click ComponentsDir "https://github.com/sumit6307/fiesta-deploy/tree/main/src/components/"
    click AuthContext "https://github.com/sumit6307/fiesta-deploy/blob/main/src/context/AuthContext.jsx"
    click UseFetch "https://github.com/sumit6307/fiesta-deploy/blob/main/src/hooks/useFetch.js"
    click AxiosClient "https://github.com/sumit6307/fiesta-deploy/blob/main/src/api/axiosInstance.js"
    click AuthService "https://github.com/sumit6307/fiesta-deploy/blob/main/src/services/authService.js"
    click MockData "https://github.com/sumit6307/fiesta-deploy/blob/main/public/hotels.json"
    click MapCSS "https://github.com/sumit6307/fiesta-deploy/blob/main/src/styles/leaflet.css"
    click GlobalCSS "https://github.com/sumit6307/fiesta-deploy/blob/main/src/styles/global.css"
    click HotelCardCSS "https://github.com/sumit6307/fiesta-deploy/blob/main/src/styles/HotelCard.css"
    click HotelListCSS "https://github.com/sumit6307/fiesta-deploy/blob/main/src/styles/HotelList.css"

    classDef frontend fill:#cce5ff,stroke:#0366d6,color:#000
    classDef backend fill:#d4edda,stroke:#28a745,color:#000
    classDef database fill:#ffe5b4,stroke:#e08e0b,color:#000
    classDef external fill:#e2e3e5,stroke:#6c757d,color:#000
```
