# sanjna005/coastwise-ai architecture

> Architecture diagram of the GitHub repository sanjna005/coastwise-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sanjna005/coastwise-ai
- Repository: https://github.com/sanjna005/coastwise-ai

## Overview

CoastWise AI helps travelers explore Coastal Karnataka, find places and transport, and build personalized day-by-day trips. The main journey runs from trip preferences through itinerary generation to ordered stops, maps, directions and local travel links. Separate discovery branches cover destination listings, stays, food and distance-ranked nearby places. Authentication uses Supabase, while place search can use OpenStreetMap or optional Google services. README capabilities guide inclusion of unsampled planner and transport modules; their internal wiring is not asserted where excerpts do not establish it.

Main entry points: [`src/lib/places.functions.ts`](https://github.com/sanjna005/coastwise-ai/blob/main/src/lib/places.functions.ts) (Place search), [`src/routes/plan.tsx`](https://github.com/sanjna005/coastwise-ai/blob/main/src/routes/plan.tsx) (Trip planner), [`src/routes/destinations.index.tsx`](https://github.com/sanjna005/coastwise-ai/blob/main/src/routes/destinations.index.tsx) (Destinations), [`src/lib/transit.ts`](https://github.com/sanjna005/coastwise-ai/blob/main/src/lib/transit.ts) (Transit links)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Travel experience"]
  node_home["Coast overview<br/>[index.tsx]"]
  node_destinations["Destinations"]
  node_destination_detail["Destination detail"]
  node_travel_links["Train and bus links<br/>[travel.tsx]"]
  node_transit["Transit links<br/>[transit.ts]"]
  node_ride_links["Ride links<br/>[rides.tsx]"]
  node_ride_component["Cab links<br/>[ride-links.tsx]"]
  node_auth_page["Sign in<br/>[auth.tsx]"]
end

subgraph group_planning["Trip planning"]
  node_planner["Trip planner<br/>[plan.tsx]"]
  node_itinerary["Itinerary service"]
  node_maps["Maps and directions<br/>[map-embed.tsx]"]
end

subgraph group_discovery["Place discovery"]
  node_stays["Stays directory<br/>[stays.tsx]"]
  node_food["Food directory<br/>[food.tsx]"]
  node_nearby["Nearby places<br/>[near-me.tsx]"]
  node_place_search["Place search"]
  node_place_cards["Place listings"]
end

subgraph group_services["External services"]
  node_supabase_client["Supabase client<br/>[client.ts]"]
  node_google_maps{{"Google Maps"}}
  node_osm{{"OpenStreetMap"}}
  node_google_places{{"Google Places"}}
  node_gemini{{"Gemini AI"}}
  node_transit_services{{"Booking services"}}
  node_supabase[("Supabase")]
end

node_traveler(("Traveler"))

node_traveler -->|"explores"| node_home
node_traveler -->|"enters trip needs"| node_planner
node_traveler -->|"browses"| node_destinations
node_traveler -->|"shares location"| node_nearby
node_traveler -->|"signs in"| node_auth_page
node_home -->|"links to"| node_destinations
node_destinations -->|"opens destination"| node_destination_detail
node_planner -->|"requests itinerary"| node_itinerary
node_itinerary -.->|"generates with"| node_gemini
node_planner -->|"shows trip maps"| node_maps
node_planner -->|"offers travel links"| node_transit
node_destination_detail -->|"shows places"| node_place_cards
node_stays -->|"searches stays"| node_place_search
node_food -->|"searches food"| node_place_search
node_nearby -->|"searches nearby"| node_place_search
node_place_search -.->|"queries fallback"| node_osm
node_place_search -.->|"queries optionally"| node_google_places
node_place_search -->|"returns listings"| node_place_cards
node_maps -->|"embeds maps"| node_google_maps
node_travel_links -->|"builds links"| node_transit
node_transit -->|"opens booking"| node_transit_services
node_ride_links -->|"uses links"| node_ride_component
node_ride_component -->|"opens cab booking"| node_transit_services
node_auth_page -->|"authenticates"| node_supabase_client
node_supabase_client -->|"uses auth"| node_supabase

click node_home "https://github.com/sanjna005/coastwise-ai/blob/main/src/routes/index.tsx"
click node_destinations "https://github.com/sanjna005/coastwise-ai/blob/main/src/routes/destinations.index.tsx"
click node_destination_detail "https://github.com/sanjna005/coastwise-ai/blob/main/src/routes/destinations.%24slug.tsx"
click node_planner "https://github.com/sanjna005/coastwise-ai/blob/main/src/routes/plan.tsx"
click node_itinerary "https://github.com/sanjna005/coastwise-ai/blob/main/src/lib/itinerary.functions.ts"
click node_maps "https://github.com/sanjna005/coastwise-ai/blob/main/src/components/map-embed.tsx"
click node_stays "https://github.com/sanjna005/coastwise-ai/blob/main/src/routes/stays.tsx"
click node_food "https://github.com/sanjna005/coastwise-ai/blob/main/src/routes/food.tsx"
click node_nearby "https://github.com/sanjna005/coastwise-ai/blob/main/src/components/near-me.tsx"
click node_place_search "https://github.com/sanjna005/coastwise-ai/blob/main/src/lib/places.functions.ts"
click node_place_cards "https://github.com/sanjna005/coastwise-ai/blob/main/src/components/places-explorer.tsx"
click node_travel_links "https://github.com/sanjna005/coastwise-ai/blob/main/src/routes/travel.tsx"
click node_transit "https://github.com/sanjna005/coastwise-ai/blob/main/src/lib/transit.ts"
click node_ride_links "https://github.com/sanjna005/coastwise-ai/blob/main/src/routes/rides.tsx"
click node_ride_component "https://github.com/sanjna005/coastwise-ai/blob/main/src/components/ride-links.tsx"
click node_auth_page "https://github.com/sanjna005/coastwise-ai/blob/main/src/routes/auth.tsx"
click node_supabase_client "https://github.com/sanjna005/coastwise-ai/blob/main/src/integrations/supabase/client.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_home,node_destinations,node_destination_detail,node_travel_links,node_transit,node_ride_links,node_ride_component,node_auth_page toneBlue
class node_planner,node_itinerary,node_maps toneAmber
class node_stays,node_food,node_nearby,node_place_search,node_place_cards toneMint
class node_supabase_client,node_google_maps,node_osm,node_google_places,node_gemini,node_transit_services,node_supabase toneRose
class node_traveler toneIndigo
```

## Components

### Travel experience

- [Coast overview](https://github.com/sanjna005/coastwise-ai/blob/main/src/routes/index.tsx): `src/routes/index.tsx`
- [Destinations](https://github.com/sanjna005/coastwise-ai/blob/main/src/routes/destinations.index.tsx): `src/routes/destinations.index.tsx`
- [Destination detail](https://github.com/sanjna005/coastwise-ai/blob/main/src/routes/destinations.%24slug.tsx): `src/routes/destinations.$slug.tsx`
- [Train and bus links](https://github.com/sanjna005/coastwise-ai/blob/main/src/routes/travel.tsx): `src/routes/travel.tsx`
- [Transit links](https://github.com/sanjna005/coastwise-ai/blob/main/src/lib/transit.ts): `src/lib/transit.ts`
- [Ride links](https://github.com/sanjna005/coastwise-ai/blob/main/src/routes/rides.tsx): `src/routes/rides.tsx`
- [Cab links](https://github.com/sanjna005/coastwise-ai/blob/main/src/components/ride-links.tsx): `src/components/ride-links.tsx`
- [Sign in](https://github.com/sanjna005/coastwise-ai/blob/main/src/routes/auth.tsx): `src/routes/auth.tsx`

### Trip planning

- [Trip planner](https://github.com/sanjna005/coastwise-ai/blob/main/src/routes/plan.tsx): `src/routes/plan.tsx`
- [Itinerary service](https://github.com/sanjna005/coastwise-ai/blob/main/src/lib/itinerary.functions.ts): `src/lib/itinerary.functions.ts`
- [Maps and directions](https://github.com/sanjna005/coastwise-ai/blob/main/src/components/map-embed.tsx): `src/components/map-embed.tsx`

### Place discovery

- [Stays directory](https://github.com/sanjna005/coastwise-ai/blob/main/src/routes/stays.tsx): `src/routes/stays.tsx`
- [Food directory](https://github.com/sanjna005/coastwise-ai/blob/main/src/routes/food.tsx): `src/routes/food.tsx`
- [Nearby places](https://github.com/sanjna005/coastwise-ai/blob/main/src/components/near-me.tsx): `src/components/near-me.tsx`
- [Place search](https://github.com/sanjna005/coastwise-ai/blob/main/src/lib/places.functions.ts): `src/lib/places.functions.ts`
- [Place listings](https://github.com/sanjna005/coastwise-ai/blob/main/src/components/places-explorer.tsx): `src/components/places-explorer.tsx`

### External services

- [Supabase client](https://github.com/sanjna005/coastwise-ai/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`
- **Google Maps**
- **OpenStreetMap**
- **Google Places**
- **Gemini AI**
- **Booking services**
- **Supabase**

### Other components

- **Traveler**

## Connections

- Traveler → Coast overview: explores
- Traveler → Trip planner: enters trip needs
- Traveler → Destinations: browses
- Traveler → Nearby places: shares location
- Traveler → Sign in: signs in
- Coast overview → Destinations: links to
- Destinations → Destination detail: opens destination
- Trip planner → Itinerary service: requests itinerary
- Itinerary service → Gemini AI: generates with
- Trip planner → Maps and directions: shows trip maps
- Trip planner → Transit links: offers travel links
- Destination detail → Place listings: shows places
- Stays directory → Place search: searches stays
- Food directory → Place search: searches food
- Nearby places → Place search: searches nearby
- Place search → OpenStreetMap: queries fallback
- Place search → Google Places: queries optionally
- Place search → Place listings: returns listings
- Maps and directions → Google Maps: embeds maps
- Train and bus links → Transit links: builds links
- Transit links → Booking services: opens booking
- Ride links → Cab links: uses links
- Cab links → Booking services: opens cab booking
- Sign in → Supabase client: authenticates
- Supabase client → Supabase: uses auth
