# sidyaa10/wanderlust-road-stories-62 architecture

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

- Interactive diagram: https://gitdiagram.com/sidyaa10/wanderlust-road-stories-62
- Repository: https://github.com/sidyaa10/wanderlust-road-stories-62

## Overview

##### Project Type & Purpose
- This is a full-stack, interactive web application (React + TypeScript) that allows users to share, explore, and manage road-trip stories.
- The frontend is a Vite-powered React SPA, styled with Tailwind CSS and Shadcn UI.
- Data persistence and authentication are offloaded to Supabase (an open-source Firebase alternative).
- A minimal custom backend exists under `wanderlust-backend/server.js` for any server-only logic or API endpoints not covered by Supabase.

##### File Structure
- Top-level files (`vite.config.*`, `tsconfig.*`, `tailwind.config.ts`, `vercel.json`) show configuration for build and deployment.
- `src/` contains:
- `pages/`: each route/page (Home, Explore, CreateTrip, etc.)
- `components/`: reusable UI pieces and Shadcn UI wrappers in `ui/`
- `services/api.*`: service layer that abstracts API calls
- `integrations/supabase/` & `lib/supabase.*`: client setup & types for Supabase
- `wanderlust-backend/server.js` is a standalone Node.js service for any custom endpoints.
- `supabase/config.toml` configures database rules, edge functions, or migrations.
- `vercel.json` indicates the hosting target (Vercel) and potentially serverless function routing.

##### README
- Confirms core features: story sharing, exploration, profile management.
- Lists stack: Vite, React, TypeScript, Tailwind CSS, Shadcn UI, Supabase.

##### Main Components & Their Interactions
A. Frontend (React SPA)
- Hosted on Vercel (static assets, client bundle).
- Components invoke the `services/api` layer or directly use `supabase` client.
B. BaaS Layer (Supabase)
- Auth (signup/login).
- PostgreSQL database (stories, comments, profiles).
- Storage (optional, for images/media).
C. Custom Backend (wanderlust-backend)
- Server.js exposes any custom REST endpoints, webhooks, or proxy logic.
- Also deployed as a serverless function on Vercel.
D. External Services
- API (e.g., Mapbox or Google Maps) called by `MapView` component for rendering maps.
E. DevOps / CI-CD
- Vercel pipeline automatically builds & deploys both the React app and the serverless endpoints.

##### Architectural Patterns & Design Principles
- Component-Based UI (React + Shadcn).
- Bounded Context for data: direct Supabase SDK usage vs. custom Node endpoints.
- Service Layer (`services/api`) abstracts fetch logic, ensuring loose coupling.
- Configuration-as-code: environment, supabase config, Vercel JSON.
- Monorepo-style: frontend and backend code co-located under same root, but clearly separated.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Users
    User["User / Browser"]:::ext

    %% Frontend Layer
    subgraph "Frontend (React SPA)" 
        direction TB
        ReactEntry["src/main.tsx\nApp.tsx\nindex.html"]:::frontend
        subgraph "Vite Config"
            ViteConfig["vite.config.ts"]:::config
        end
        subgraph "Pages (src/pages)" 
            direction TB
            HomePage["HomePage"]:::frontend
            ExplorePage["ExplorePage"]:::frontend
            CreateTripPage["CreateTripPage"]:::frontend
            TripDetailPage["TripDetailPage"]:::frontend
            TripListPage["TripListPage"]:::frontend
            ProfilePage["ProfilePage"]:::frontend
            AboutUsPage["AboutUsPage"]:::frontend
            IndexPage["Index"]:::frontend
            NotFoundPage["NotFound"]:::frontend
        end
        subgraph "Components (src/components)" 
            direction TB
            Layout["Layout"]:::frontend
            RoadTripCard["RoadTripCard"]:::frontend
            StoryModal["StoryModal"]:::frontend
            TripComments["TripComments"]:::frontend
            TopRoadStories["TopRoadStories"]:::frontend
            StarRating["StarRating"]:::frontend
            MapView["MapView"]:::frontend
            subgraph "UI Primitives (src/components/ui)" 
                UIPrimitives["Shadcn UI Primitives"]:::frontend
            end
        end
        subgraph "Service Layer (src/services)" 
            direction TB
            APITS["api.ts\ntypes.ts"]:::frontend
        end
        subgraph "Supabase Integration (src/integrations/supabase)" 
            direction TB
            SupabaseClient["client.ts\ntypes.ts"]:::frontend
        end
        subgraph "Lib (src/lib)" 
            direction TB
            LibSupabase["supabase.ts"]:::frontend
            LibUtils["utils.ts"]:::frontend
        end
    end

    %% Custom Backend
    CustomBackend["wanderlust-backend/server.js"]:::backend

    %% Supabase Services
    subgraph "Supabase (BaaS)" 
        direction TB
        SupabaseAuth["Auth"]:::db
        SupabaseDB["PostgreSQL DB"]:::db
        SupabaseStorage["Storage"]:::db
        SupaConfig["config.toml"]:::config
    end

    %% External Services
    MapService["Map Service\n(Mapbox/Google)"]:::ext

    %% Hosting & CI/CD
    GitHub["Git Push"]:::ext
    VercelCI["Vercel CI/CD"]:::ext
    VercelDeploy["Vercel Hosting\n(Static + Serverless)"]:::ext
    VercelConfig["vercel.json\ntailwind.config.ts\ntsconfig.json\nvite.config.ts"]:::config

    %% Connections
    User -->|"Interacts with"| ReactEntry
    ReactEntry -->|Uses| Pages
    ReactEntry -->|Uses| Components
    ReactEntry -->|Import| APITS
    ReactEntry -->|Import| SupabaseClient
    ReactEntry -->|Import| LibSupabase
    ReactEntry -->|Import| LibUtils

    APITS -->|"Supabase JS SDK (REST)"| SupabaseAuth
    APITS -->|"Supabase JS SDK (REST)"| SupabaseDB
    APITS -->|"Supabase JS SDK"| SupabaseStorage

    SupabaseClient -->|"SDK Calls"| SupabaseAuth
    SupabaseClient -->|"SDK Calls"| SupabaseDB
    SupabaseClient -->|"SDK Calls"| SupabaseStorage

    ReactEntry -->|"Fetch / Axios"| CustomBackend
    CustomBackend -->|"Custom Endpoints"| SupabaseDB

    ReactEntry -->|"HTTPS (Mapbox API)"| MapService
    MapService -->|"Data"| ReactEntry

    GitHub -->|Triggers| VercelCI
    VercelCI -->|Builds| ReactEntry
    VercelCI -->|Deploys| VercelDeploy
    VercelDeploy -->|Hosts| ReactEntry
    VercelDeploy -->|Hosts| CustomBackend

    supaConfig["supabase/config.toml"] -.-> SupaConfig

    VercelConfig -.-> VercelDeploy

    %% Click events
    click ReactEntry "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/src/main.tsx"
    click ReactEntry "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/src/App.tsx"
    click ReactEntry "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/index.html"
    click ViteConfig "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/vite.config.ts"
    click HomePage "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/src/pages/HomePage.tsx"
    click ExplorePage "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/src/pages/ExplorePage.tsx"
    click CreateTripPage "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/src/pages/CreateTripPage.tsx"
    click TripDetailPage "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/src/pages/TripDetailPage.tsx"
    click TripListPage "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/src/pages/TripListPage.tsx"
    click ProfilePage "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/src/pages/ProfilePage.tsx"
    click AboutUsPage "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/src/pages/AboutUsPage.tsx"
    click IndexPage "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/src/pages/Index.tsx"
    click NotFoundPage "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/src/pages/NotFound.tsx"
    click Layout "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/src/components/Layout.tsx"
    click RoadTripCard "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/src/components/RoadTripCard.tsx"
    click StoryModal "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/src/components/StoryModal.tsx"
    click TripComments "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/src/components/TripComments.tsx"
    click TopRoadStories "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/src/components/TopRoadStories.tsx"
    click StarRating "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/src/components/StarRating.tsx"
    click MapView "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/src/components/MapView.tsx"
    click UIPrimitives "https://github.com/sidyaa10/wanderlust-road-stories-62/tree/main/src/components/ui/"
    click APITS "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/src/services/api.ts"
    click APITS "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/src/services/types.ts"
    click SupabaseClient "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/src/integrations/supabase/client.ts"
    click SupabaseClient "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/src/integrations/supabase/types.ts"
    click LibSupabase "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/src/lib/supabase.ts"
    click LibUtils "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/src/lib/utils.ts"
    click CustomBackend "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/wanderlust-backend/server.js"
    click SupaConfig "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/supabase/config.toml"
    click VercelConfig "https://github.com/sidyaa10/wanderlust-road-stories-62/blob/main/vercel.json"

    %% Styles
    classDef frontend fill:#BBDEF0,stroke:#036,stroke-width:1px
    classDef backend fill:#C8E6C9,stroke:#256,stroke-width:1px
    classDef db fill:#FFECB3,stroke:#966,stroke-width:1px
    classDef ext fill:#E0E0E0,stroke:#555,stroke-width:1px
    classDef config fill:#F0F4C3,stroke:#998,stroke-width:1px
    classDef config fill:#FFE0B2,stroke:#995,stroke-width:1px
```
