How rohith3183/trip-buddy works
Purpose and Entry Points
This is a Vite React travel-planning application, likely generated for Google AI Studio, that combines curated destination data with Gemini-backed itinerary/chat experiences. The browser starts at src/main.tsx, renders the application shell in src/App.tsx, and calls backend/API functionality through src/services/api.ts. A server entry point exists at server.ts, with an API handler at api/index.ts; deployment is configured for Vercel via vercel.json.
Application Shell and Feature Routing
src/App.tsx is the central UI orchestrator: it owns the active planning experience, composes navigation, and connects major feature views. src/components/Navbar.tsx provides top-level navigation, while src/components/StartLandingHero.tsx serves as the initial entry experience. Feature state and shared domain shapes are represented in src/types.ts.
AI Planning Boundary
The AI interaction surface is src/components/AIChatArchitect.tsx. Client requests are isolated behind src/services/api.ts, creating a boundary between browser UI and Gemini-enabled server execution. Backend handling is represented by api/index.ts and/or server.ts; the required external dependency is Gemini, configured through GEMINI_API_KEY in .env.local. This boundary should protect API credentials and normalize model request/response formats before they reach UI components.
Grounded Destination and Itinerary Engine
The application contains a substantial local travel knowledge layer rather than relying exclusively on model output. Destination catalogs are partitioned geographically in src/data/destinationsWest.ts, src/data/destinationsNortheast.ts, and src/data/destinationsCentralEast.ts, with broader/master datasets in src/data/destinations30.ts and src/data/destinations30Master.ts. Matching and geographic lookup are handled by src/data/destinationMatcher.ts and src/data/geoDatabase.ts.
Itinerary construction is separated into deterministic/grounded logic: src/data/groundedItineraryEngine.ts, src/data/itineraryBuilder30.ts, and src/data/groundingData.ts. The likely flow is user preferences or chat input → destination matching/lookup → grounded itinerary generation → UI presentation, with Gemini augmenting rather than replacing local planning data.
Planning and Exploration Experiences
src/components/ItineraryViewer.tsx is the primary itinerary rendering boundary. Supplemental planner functions are independently surfaced: src/components/OffbeatExplorer.tsx for discovery, src/components/FTQuotaCalculator.tsx for quota/calculation-oriented planning, and src/components/WeatherTrafficWidget.tsx for contextual travel conditions. These components consume app/domain state rather than directly owning core destination data.
Persistence, Sharing, and Output
User-facing trip management is encapsulated in src/components/SavedLocations.tsx and src/components/ShareTripModal.tsx. Export is isolated in src/utils/pdfExport.ts, separating document generation from itinerary rendering. This creates a flow from assembled itinerary data to saved/shared/exported artifacts without coupling those delivery mechanisms to the itinerary engine.
Runtime and Delivery
The frontend runs as a TypeScript React SPA through Vite (vite.config.ts) and is bootstrapped from index.html. Node.js is required locally; lockfiles indicate npm and Bun compatibility (package-lock.json, bun.lock). Serverless hosting is intended through Vercel (vercel.json), with api/index.ts acting as the deployable API boundary for Gemini-backed operations.
Main entry points: App.tsx App shell · groundedItineraryEngine.ts Grounded itinerary engine · ItineraryViewer.tsx Itinerary viewer · AIChatArchitect.tsx AI chat architect
Components 20
React SPA
Browser planning and exploration experience.
- HTML bootstrap
index.html - React bootstrap
src/main.tsx - App shell · Owns active planning experience and feature composition.
src/App.tsx - Navigation
src/components/Navbar.tsx - Start landing
src/components/StartLandingHero.tsx - AI chat architect
src/components/AIChatArchitect.tsx - Itinerary viewer
src/components/ItineraryViewer.tsx - Planner tools · Offbeat discovery, quota calculation, and weather/traffic context.
- Domain types
src/types.ts - API client · Normalizes browser requests to backend operations.
src/services/api.ts
Grounded planning
Local destination matching and itinerary construction.
- Destination matching
src/data/destinationMatcher.ts - Geographic lookup
src/data/geoDatabase.ts - Destination catalogs · Regional and master destination datasets.
src/data/destinations30Master.ts - Grounding data
src/data/groundingData.ts - Grounded itinerary engine · Builds itineraries from matched local travel data.
src/data/groundedItineraryEngine.ts
AI API
Credential-protected Gemini execution boundary.
- Serverless API handler · Deployable Gemini-backed API boundary.
api/index.ts - Gemini · Uses GEMINI_API_KEY only on the server.
- Vercel deployment
vercel.json
Trip output
Persistence, sharing, and document delivery.
- Saved and shared trips · SavedLocations and ShareTripModal manage user-facing trip artifacts.
- PDF export
src/utils/pdfExport.ts
Connections 21
- HTML bootstrap → React bootstrap: loads
- React bootstrap → App shell: renders
- App shell → Navigation: composes
- App shell → Start landing: starts with
- App shell → AI chat architect: hosts
- App shell → Itinerary viewer: renders plans
- App shell → Planner tools: surfaces
- App shell → Domain types: uses
- AI chat architect → API client: requests AI
- API client → Serverless API handler: calls
- Serverless API handler → Gemini: invokes
- Destination matching → Destination catalogs: searches
- Destination matching → Geographic lookup: resolves geography
- Grounded itinerary engine → Destination matching: matches destinations
- Grounded itinerary engine → Grounding data: uses
- Grounded itinerary engine → Destination catalogs: grounds with
- AI chat architect → Grounded itinerary engine: grounds planning input
- Grounded itinerary engine → Itinerary viewer: produces itinerary
- Itinerary viewer → Saved and shared trips: saves or shares
- Itinerary viewer → PDF export: exports
- Vercel deployment → Serverless API handler: deploys