# anamikasharma1509/travelxp architecture

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

- Interactive diagram: https://gitdiagram.com/anamikasharma1509/travelxp
- Repository: https://github.com/anamikasharma1509/travelxp

## Overview

TravelXP is a full-stack cultural travel platform for discovering Indian destinations, booking through provider links, planning itineraries, exploring cultural knowledge, and preserving multilingual stories. The principal journey runs from the React client through a REST API to domain services and PostgreSQL, with optional AI and booking-provider integrations. The graph combines sampled call/import evidence with documented capabilities; dashed, uncited links mark product flows whose specific implementation wiring was not shown.

Main entry points: [`client/src/App.tsx`](https://github.com/anamikasharma1509/travelxp/blob/main/client/src/App.tsx) (React app), [`client/src/api/client.ts`](https://github.com/anamikasharma1509/travelxp/blob/main/client/src/api/client.ts) (API client), [`server/src/db/prisma.ts`](https://github.com/anamikasharma1509/travelxp/blob/main/server/src/db/prisma.ts) (PostgreSQL), [`server/src/services/story/storyService.ts`](https://github.com/anamikasharma1509/travelxp/blob/main/server/src/services/story/storyService.ts) (Story service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Travel client"]
  node_app["React app<br/>[App.tsx]"]
  node_authui["Auth context<br/>[AuthContext.tsx]"]
  node_apiclient["API client<br/>[client.ts]"]
end

subgraph group_api["API and identity"]
  node_apiapp["REST API<br/>[app.ts]"]
  node_routes["API router<br/>[apiRoutes.ts]"]
  node_authroutes["Auth routes<br/>[authRoutes.ts]"]
  node_authcontroller["Auth controller<br/>[authController.ts]"]
  node_authservice["Auth service<br/>[authService.ts]"]
  node_authmiddleware["Auth middleware<br/>[auth.ts]"]
  node_database[("PostgreSQL<br/>[prisma.ts]")]
end

subgraph group_discovery["Travel discovery"]
  node_discover["Destination discovery<br/>[DiscoverPage.tsx]"]
  node_destinationdetail["Destination details"]
  node_destinationcontroller["Destination API"]
  node_destinationservice["Destination service"]
end

subgraph group_planning["Planning and booking"]
  node_booking["Booking search<br/>[BookTravelPage.tsx]"]
  node_bookingcontroller["Booking API"]
  node_providers{{"Booking providers"}}
  node_itinerary["Itinerary planning"]
  node_tripui["Trip planning UI<br/>[PlanTripPage.tsx]"]
  node_tripresults["Plan results"]
end

subgraph group_heritage["Knowledge and heritage"]
  node_know["Cultural knowledge<br/>[KnowPage.tsx]"]
  node_ai["AI service<br/>[aiService.ts]"]
  node_stories["Story archive<br/>[StoriesPage.tsx]"]
  node_storycontroller["Story API<br/>[storyController.ts]"]
  node_storyservice["Story service<br/>[storyService.ts]"]
  node_admin["Heritage moderation<br/>[adminController.ts]"]
end

node_traveler(("Traveler"))

node_traveler -->|"uses"| node_app
node_app -->|"routes to"| node_discover
node_app -->|"routes to"| node_destinationdetail
node_app -->|"routes to"| node_booking
node_app -->|"routes to"| node_tripui
node_app -->|"routes to"| node_tripresults
node_app -->|"routes to"| node_know
node_app -->|"routes to"| node_stories
node_app -->|"provides"| node_authui
node_authui -->|"calls"| node_apiclient
node_apiclient -->|"sends REST requests"| node_apiapp
node_apiapp -->|"mounts"| node_routes
node_routes -->|"mounts"| node_authroutes
node_authroutes -->|"dispatches"| node_authcontroller
node_authcontroller -->|"calls"| node_authservice
node_authservice -->|"queries"| node_database
node_authmiddleware -->|"checks user"| node_database
node_discover -.->|"requests destinations"| node_apiclient
node_destinationcontroller -->|"delegates"| node_destinationservice
node_destinationservice -->|"queries"| node_database
node_booking -->|"searches providers"| node_apiclient
node_apiclient -->|"requests provider results"| node_providers
node_bookingcontroller -.->|"provides search links"| node_providers
node_tripui -.->|"requests itinerary"| node_itinerary
node_itinerary -.->|"returns schedule"| node_tripresults
node_know -.->|"requests explanations"| node_ai
node_ai -.->|"uses stored context"| node_database
node_stories -.->|"loads stories"| node_apiclient
node_storycontroller -->|"delegates"| node_storyservice
node_storyservice -->|"reads and writes"| node_database
node_storyservice -->|"requests translation"| node_ai
node_admin -->|"moderates records"| node_database

click node_app "https://github.com/anamikasharma1509/travelxp/blob/main/client/src/App.tsx"
click node_authui "https://github.com/anamikasharma1509/travelxp/blob/main/client/src/context/AuthContext.tsx"
click node_apiclient "https://github.com/anamikasharma1509/travelxp/blob/main/client/src/api/client.ts"
click node_apiapp "https://github.com/anamikasharma1509/travelxp/blob/main/server/src/app.ts"
click node_routes "https://github.com/anamikasharma1509/travelxp/blob/main/server/src/routes/apiRoutes.ts"
click node_authroutes "https://github.com/anamikasharma1509/travelxp/blob/main/server/src/routes/authRoutes.ts"
click node_authcontroller "https://github.com/anamikasharma1509/travelxp/blob/main/server/src/controllers/authController.ts"
click node_authservice "https://github.com/anamikasharma1509/travelxp/blob/main/server/src/services/auth/authService.ts"
click node_authmiddleware "https://github.com/anamikasharma1509/travelxp/blob/main/server/src/middleware/auth.ts"
click node_database "https://github.com/anamikasharma1509/travelxp/blob/main/server/src/db/prisma.ts"
click node_discover "https://github.com/anamikasharma1509/travelxp/blob/main/client/src/pages/DiscoverPage.tsx"
click node_destinationdetail "https://github.com/anamikasharma1509/travelxp/blob/main/client/src/pages/DestinationDetailPage.tsx"
click node_destinationcontroller "https://github.com/anamikasharma1509/travelxp/blob/main/server/src/controllers/destinationController.ts"
click node_destinationservice "https://github.com/anamikasharma1509/travelxp/blob/main/server/src/services/destination/destinationService.ts"
click node_booking "https://github.com/anamikasharma1509/travelxp/blob/main/client/src/pages/BookTravelPage.tsx"
click node_bookingcontroller "https://github.com/anamikasharma1509/travelxp/blob/main/server/src/controllers/bookingController.ts"
click node_itinerary "https://github.com/anamikasharma1509/travelxp/blob/main/server/src/services/itinerary/itineraryPlanner.ts"
click node_tripui "https://github.com/anamikasharma1509/travelxp/blob/main/client/src/pages/PlanTripPage.tsx"
click node_tripresults "https://github.com/anamikasharma1509/travelxp/blob/main/client/src/pages/PlanResultsPage.tsx"
click node_know "https://github.com/anamikasharma1509/travelxp/blob/main/client/src/pages/KnowPage.tsx"
click node_ai "https://github.com/anamikasharma1509/travelxp/blob/main/server/src/services/ai/aiService.ts"
click node_stories "https://github.com/anamikasharma1509/travelxp/blob/main/client/src/pages/StoriesPage.tsx"
click node_storycontroller "https://github.com/anamikasharma1509/travelxp/blob/main/server/src/controllers/storyController.ts"
click node_storyservice "https://github.com/anamikasharma1509/travelxp/blob/main/server/src/services/story/storyService.ts"
click node_admin "https://github.com/anamikasharma1509/travelxp/blob/main/server/src/controllers/adminController.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_app,node_authui,node_apiclient toneBlue
class node_apiapp,node_routes,node_authroutes,node_authcontroller,node_authservice,node_authmiddleware,node_database toneAmber
class node_discover,node_destinationdetail,node_destinationcontroller,node_destinationservice toneMint
class node_booking,node_bookingcontroller,node_providers,node_itinerary,node_tripui,node_tripresults toneRose
class node_know,node_ai,node_stories,node_storycontroller,node_storyservice,node_admin,node_traveler toneIndigo
```

## Components

### Travel client

- [React app](https://github.com/anamikasharma1509/travelxp/blob/main/client/src/App.tsx): `client/src/App.tsx`
- [Auth context](https://github.com/anamikasharma1509/travelxp/blob/main/client/src/context/AuthContext.tsx): `client/src/context/AuthContext.tsx`
- [API client](https://github.com/anamikasharma1509/travelxp/blob/main/client/src/api/client.ts): `client/src/api/client.ts`

### API and identity

- [REST API](https://github.com/anamikasharma1509/travelxp/blob/main/server/src/app.ts): `server/src/app.ts`
- [API router](https://github.com/anamikasharma1509/travelxp/blob/main/server/src/routes/apiRoutes.ts): `server/src/routes/apiRoutes.ts`
- [Auth routes](https://github.com/anamikasharma1509/travelxp/blob/main/server/src/routes/authRoutes.ts): `server/src/routes/authRoutes.ts`
- [Auth controller](https://github.com/anamikasharma1509/travelxp/blob/main/server/src/controllers/authController.ts): `server/src/controllers/authController.ts`
- [Auth service](https://github.com/anamikasharma1509/travelxp/blob/main/server/src/services/auth/authService.ts): `server/src/services/auth/authService.ts`
- [Auth middleware](https://github.com/anamikasharma1509/travelxp/blob/main/server/src/middleware/auth.ts): `server/src/middleware/auth.ts`
- [PostgreSQL](https://github.com/anamikasharma1509/travelxp/blob/main/server/src/db/prisma.ts): `server/src/db/prisma.ts`

### Travel discovery

- [Destination discovery](https://github.com/anamikasharma1509/travelxp/blob/main/client/src/pages/DiscoverPage.tsx): `client/src/pages/DiscoverPage.tsx`
- [Destination details](https://github.com/anamikasharma1509/travelxp/blob/main/client/src/pages/DestinationDetailPage.tsx): `client/src/pages/DestinationDetailPage.tsx`
- [Destination API](https://github.com/anamikasharma1509/travelxp/blob/main/server/src/controllers/destinationController.ts): `server/src/controllers/destinationController.ts`
- [Destination service](https://github.com/anamikasharma1509/travelxp/blob/main/server/src/services/destination/destinationService.ts): `server/src/services/destination/destinationService.ts`

### Planning and booking

- [Booking search](https://github.com/anamikasharma1509/travelxp/blob/main/client/src/pages/BookTravelPage.tsx): `client/src/pages/BookTravelPage.tsx`
- [Booking API](https://github.com/anamikasharma1509/travelxp/blob/main/server/src/controllers/bookingController.ts): `server/src/controllers/bookingController.ts`
- **Booking providers**
- [Itinerary planning](https://github.com/anamikasharma1509/travelxp/blob/main/server/src/services/itinerary/itineraryPlanner.ts): `server/src/services/itinerary/itineraryPlanner.ts`
- [Trip planning UI](https://github.com/anamikasharma1509/travelxp/blob/main/client/src/pages/PlanTripPage.tsx): `client/src/pages/PlanTripPage.tsx`
- [Plan results](https://github.com/anamikasharma1509/travelxp/blob/main/client/src/pages/PlanResultsPage.tsx): `client/src/pages/PlanResultsPage.tsx`

### Knowledge and heritage

- [Cultural knowledge](https://github.com/anamikasharma1509/travelxp/blob/main/client/src/pages/KnowPage.tsx): `client/src/pages/KnowPage.tsx`
- [AI service](https://github.com/anamikasharma1509/travelxp/blob/main/server/src/services/ai/aiService.ts): `server/src/services/ai/aiService.ts`
- [Story archive](https://github.com/anamikasharma1509/travelxp/blob/main/client/src/pages/StoriesPage.tsx): `client/src/pages/StoriesPage.tsx`
- [Story API](https://github.com/anamikasharma1509/travelxp/blob/main/server/src/controllers/storyController.ts): `server/src/controllers/storyController.ts`
- [Story service](https://github.com/anamikasharma1509/travelxp/blob/main/server/src/services/story/storyService.ts): `server/src/services/story/storyService.ts`
- [Heritage moderation](https://github.com/anamikasharma1509/travelxp/blob/main/server/src/controllers/adminController.ts): `server/src/controllers/adminController.ts`

### Other components

- **Traveler**

## Connections

- Traveler → React app: uses (evidence: `client/src/App.tsx`)
- React app → Destination discovery: routes to (evidence: `client/src/App.tsx`)
- React app → Destination details: routes to (evidence: `client/src/App.tsx`)
- React app → Booking search: routes to (evidence: `client/src/App.tsx`)
- React app → Trip planning UI: routes to (evidence: `client/src/App.tsx`)
- React app → Plan results: routes to (evidence: `client/src/App.tsx`)
- React app → Cultural knowledge: routes to (evidence: `client/src/App.tsx`)
- React app → Story archive: routes to (evidence: `client/src/App.tsx`)
- React app → Auth context: provides (evidence: `client/src/App.tsx`)
- Auth context → API client: calls (evidence: `client/src/context/AuthContext.tsx`)
- API client → REST API: sends REST requests (evidence: `README.md`)
- REST API → API router: mounts (evidence: `server/src/app.ts`)
- API router → Auth routes: mounts (evidence: `server/src/routes/apiRoutes.ts`)
- Auth routes → Auth controller: dispatches (evidence: `server/src/routes/authRoutes.ts`)
- Auth controller → Auth service: calls (evidence: `server/src/controllers/authController.ts`)
- Auth service → PostgreSQL: queries (evidence: `server/src/services/auth/authService.ts`)
- Auth middleware → PostgreSQL: checks user (evidence: `server/src/middleware/auth.ts`)
- Destination discovery → API client: requests destinations
- Destination API → Destination service: delegates
- Destination service → PostgreSQL: queries (evidence: `server/src/services/destination/destinationService.ts`)
- Booking search → API client: searches providers (evidence: `client/src/pages/BookTravelPage.tsx`)
- API client → Booking providers: requests provider results (evidence: `README.md`)
- Booking API → Booking providers: provides search links
- Trip planning UI → Itinerary planning: requests itinerary
- Itinerary planning → Plan results: returns schedule
- Cultural knowledge → AI service: requests explanations
- AI service → PostgreSQL: uses stored context
- Story archive → API client: loads stories
- Story API → Story service: delegates (evidence: `server/src/controllers/storyController.ts`)
- Story service → PostgreSQL: reads and writes (evidence: `server/src/services/story/storyService.ts`)
- Story service → AI service: requests translation (evidence: `server/src/services/story/storyService.ts`)
- Heritage moderation → PostgreSQL: moderates records (evidence: `server/src/controllers/adminController.ts`)
