# vaibhavghugretkar/triptak architecture

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

- Interactive diagram: https://gitdiagram.com/vaibhavghugretkar/triptak
- Repository: https://github.com/vaibhavghugretkar/triptak

## Overview

##### Project type and purpose
- TripTak is a full-stack, single-page web application for personalized trip planning.
- Its core purpose is to collect user inputs (days, traveler type, budget), call external APIs (Gemini for itinerary generation, Google Maps for mapping), and store/retrieve user data (Firebase).

##### File structure
- Top-level files:
– index.html, Vite and Tailwind configs, Netlify and ESLint configs → static hosting and build setup.
– src/: all React code broken into feature folders (create-trip, my-trips, view-trip), shared components (ui, custom), assets, constants, and services.
- src/service/: encapsulates API integrations (GlobalApi.jsx), Firebase setup (firebaseConfig.jsx), and UI modals (AIModal.jsx).
- src/components/: reusable UI pieces (buttons, dialogs, inputs, toasts).
- Feature modules:
– create-trip: user input form, calls trip-generation API.
– my-trips: lists saved trips from Firebase.
– view-trip: displays detailed itinerary with hotel & place cards plus Google Maps integration.

##### README for additional insights
- Tech stack: React (frontend), Gemini & Google Maps (backend services), Firebase (database & auth).
- Deployment: static build (Netlify or Firebase Hosting) serving the React app.
- Environment variables: API keys for Gemini, Google Maps, Firebase.

a. Main components
– Browser (User Interface)
– Static Asset Hosting (Netlify or Firebase Hosting)
– React App (bundled via Vite)
– API Gateway Layer (src/service/GlobalApi.jsx)
– External Services:
· Gemini API (trip generation engine)
· Google Maps API (mapping & place data)
– Firebase (Authentication and Firestore database)

b. Relationships & interactions
1. User opens the React SPA in browser.
2. Browser requests static assets from Hosting service.
3. React routes user to create-trip, my-trips, or view-trip pages.
4. On trip creation: React → GlobalApi → Gemini API → returns itinerary → React renders via AIModal and UI components.
5. Display on view-trip: React → Google Maps API → map tiles & place details → React renders PlaceCardItem & HotelCardItem.
6. Data persistence: React → Firebase Auth (user sign-in/up) → Firestore (save and fetch user’s trips).

c. Architectural patterns & principles
- Component-based UI (React) with atomic/ui and custom layouts
- Service abstraction layer (GlobalApi, firebaseConfig) to decouple APIs from UI
- Feature folders for domain separation (create-trip, my-trips, view-trip)
- Static site generation/build (Vite) for performance and ease of deployment

d. Key technologies & frameworks
– React.js for frontend components and routing
– Vite for build & local dev server
– Tailwind CSS & PostCSS for styling
– Firebase SDK for Authentication & Firestore
– Gemini API & Google Maps API for business logic
– Netlify (netlify.toml) or Firebase Hosting for static deployment

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client and Hosting
    Browser["User Browser"]:::client
    Hosting["Static Hosting\n(Netlify / Firebase Hosting)"]:::infra
    Browser -->|Request SPA| Hosting
    Hosting -->|Serve index.html & static assets| ReactApp["React SPA"]:::client

    %% React Application Structure
    subgraph "React Application" 
        direction TB
        Main["src/main.jsx"]:::code
        App["src/App.jsx"]:::code

        subgraph "Feature Modules"
            direction TB
            CT["Create-Trip\nsrc/create-trip/index.jsx"]:::feature
            MT["My-Trips\nsrc/my-trips/index.jsx"]:::feature
            UTC["UserTripCardItem\nsrc/my-trips/Components/UserTripCardItem.jsx"]:::feature
            VT["View-Trip\nsrc/view-trip/[tripId]/index.jsx"]:::feature
            PCI["PlaceCardItem\nsrc/view-trip/components/PlaceCardItem.jsx"]:::feature
            HCI["HotelCardItem\nsrc/view-trip/components/HotelCardItem.jsx"]:::feature
            PTV["PlacesToVisit\nsrc/view-trip/components/PlacesToVisit.jsx"]:::feature
            HOT["Hotels\nsrc/view-trip/components/Hotels.jsx"]:::feature
            Info["InfoSection\nsrc/view-trip/components/InfoSection.jsx"]:::feature
            Foot["Footer\nsrc/view-trip/components/Footer.jsx"]:::feature
        end

        subgraph "UI Component Library"
            direction TB
            Button["button.jsx"]:::ui
            Dialog["dialog.jsx"]:::ui
            Input["input.jsx"]:::ui
            Popover["popover.jsx"]:::ui
            Sonner["sonner.jsx"]:::ui
        end

        subgraph "Custom Shared Components"
            direction TB
            Header["Header.jsx"]:::custom
            Hero["Hero.jsx"]:::custom
        end

        subgraph "Constants & Utils"
            direction TB
            ConstApp["App.jsx"]:::const
            Options["options.jsx"]:::const
            Utils["utils.js"]:::util
        end

        subgraph "Assets & Public"
            direction TB
            AssetsDir["src/assets"]:::asset
            PublicDir["public/"]:::asset
        end

        ReactApp --> Main
        ReactApp --> App
        ReactApp --> CT
        ReactApp --> MT
        ReactApp --> VT
        ReactApp --> Button
        ReactApp --> Dialog
        ReactApp --> Input
        ReactApp --> Popover
        ReactApp --> Sonner
        ReactApp --> Header
        ReactApp --> Hero
        ReactApp --> ConstApp
        ReactApp --> Options
        ReactApp --> Utils
        ReactApp --> AssetsDir
        ReactApp --> PublicDir
    end

    %% Service Layer
    subgraph "Service Layer"
        direction TB
        GlobalApi["GlobalApi Service\nsrc/service/GlobalApi.jsx"]:::service
        AIModal["AI Modal\nsrc/service/AIModal.jsx"]:::service
        FirebaseCfg["Firebase Config\nsrc/service/firebaseConfig.jsx"]:::service
    end

    ReactApp --> GlobalApi
    ReactApp --> AIModal
    ReactApp --> FirebaseCfg

    %% External Services
    Gemini["Gemini API\n(REACT_APP_GEMINI_API_KEY)"]:::external
    GoogleMaps["Google Maps API\n(REACT_APP_GOOGLE_MAPS_KEY)"]:::external

    GlobalApi -->|"Generate Itinerary"| Gemini
    GlobalApi -->|"Return Itinerary"| ReactApp
    VT -->|"Load Map Tiles & Places"| GoogleMaps

    %% Firebase Services
    Auth["Firebase Auth"]:::database
    Firestore["Firestore Database"]:::database

    FirebaseCfg --> Auth
    FirebaseCfg --> Firestore
    ReactApp -->|Sign-In/Up| Auth
    ReactApp -->|Read/Write Trips| Firestore

    %% Deployment Build Pipeline
    subgraph "Build & Deploy"
        direction TB
        Vite["Vite Build\ntailwind.config.js\npostcss.config.js\nvite.config.js"]:::infra
        DeployCfg["netlify.toml"]:::infra
    end

    ReactApp --> Vite
    Vite --> Hosting
    DeployCfg --> Hosting

    %% Click Events
    click Main "https://github.com/vaibhavghugretkar/triptak/blob/main/src/main.jsx"
    click App "https://github.com/vaibhavghugretkar/triptak/blob/main/src/App.jsx"
    click CT "https://github.com/vaibhavghugretkar/triptak/blob/main/src/create-trip/index.jsx"
    click MT "https://github.com/vaibhavghugretkar/triptak/blob/main/src/my-trips/index.jsx"
    click UTC "https://github.com/vaibhavghugretkar/triptak/blob/main/src/my-trips/Components/UserTripCardItem.jsx"
    click VT "https://github.com/vaibhavghugretkar/triptak/blob/main/src/view-trip/[tripId]/index.jsx"
    click PCI "https://github.com/vaibhavghugretkar/triptak/blob/main/src/view-trip/components/PlaceCardItem.jsx"
    click HCI "https://github.com/vaibhavghugretkar/triptak/blob/main/src/view-trip/components/HotelCardItem.jsx"
    click PTV "https://github.com/vaibhavghugretkar/triptak/blob/main/src/view-trip/components/PlacesToVisit.jsx"
    click HOT "https://github.com/vaibhavghugretkar/triptak/blob/main/src/view-trip/components/Hotels.jsx"
    click Info "https://github.com/vaibhavghugretkar/triptak/blob/main/src/view-trip/components/InfoSection.jsx"
    click Foot "https://github.com/vaibhavghugretkar/triptak/blob/main/src/view-trip/components/Footer.jsx"
    click Button "https://github.com/vaibhavghugretkar/triptak/blob/main/src/components/ui/button.jsx"
    click Dialog "https://github.com/vaibhavghugretkar/triptak/blob/main/src/components/ui/dialog.jsx"
    click Input "https://github.com/vaibhavghugretkar/triptak/blob/main/src/components/ui/input.jsx"
    click Popover "https://github.com/vaibhavghugretkar/triptak/blob/main/src/components/ui/popover.jsx"
    click Sonner "https://github.com/vaibhavghugretkar/triptak/blob/main/src/components/ui/sonner.jsx"
    click Header "https://github.com/vaibhavghugretkar/triptak/blob/main/src/components/custom/Header.jsx"
    click Hero "https://github.com/vaibhavghugretkar/triptak/blob/main/src/components/custom/Hero.jsx"
    click GlobalApi "https://github.com/vaibhavghugretkar/triptak/blob/main/src/service/GlobalApi.jsx"
    click AIModal "https://github.com/vaibhavghugretkar/triptak/blob/main/src/service/AIModal.jsx"
    click FirebaseCfg "https://github.com/vaibhavghugretkar/triptak/blob/main/src/service/firebaseConfig.jsx"
    click ConstApp "https://github.com/vaibhavghugretkar/triptak/blob/main/src/constants/App.jsx"
    click Options "https://github.com/vaibhavghugretkar/triptak/blob/main/src/constants/options.jsx"
    click Utils "https://github.com/vaibhavghugretkar/triptak/blob/main/src/lib/utils.js"
    click AssetsDir "https://github.com/vaibhavghugretkar/triptak/tree/main/src/assets"
    click PublicDir "https://github.com/vaibhavghugretkar/triptak/tree/main/public/"
    click Vite "https://github.com/vaibhavghugretkar/triptak/blob/main/tailwind.config.js"
    click Vite "https://github.com/vaibhavghugretkar/triptak/blob/main/postcss.config.js"
    click Vite "https://github.com/vaibhavghugretkar/triptak/blob/main/vite.config.js"
    click DeployCfg "https://github.com/vaibhavghugretkar/triptak/blob/main/netlify.toml"

    %% Styles
    classDef client fill:#D0E8FF,stroke:#0366D6,stroke-width:1px
    classDef infra fill:#F0F0F0,stroke:#888888,stroke-width:1px
    classDef code fill:#E8F6EF,stroke:#2E8B57,stroke-width:1px
    classDef feature fill:#FFF4E5,stroke:#D9822B,stroke-width:1px
    classDef ui fill:#F5E8FF,stroke:#8A2BE2,stroke-width:1px
    classDef custom fill:#E8FFE8,stroke:#34A853,stroke-width:1px
    classDef const fill:#FFF8E8,stroke:#DBA506,stroke-width:1px
    classDef util fill:#E8F0FE,stroke:#1967D2,stroke-width:1px
    classDef asset fill:#FFE8E8,stroke:#D93025,stroke-width:1px
    classDef service fill:#E8FFE8,stroke:#0F9D58,stroke-width:1px
    classDef external fill:#FFF4F0,stroke:#EA4335,stroke-width:1px
    classDef database fill:#F4EBFF,stroke:#800080,stroke-width:1px
```
