# kritika8006/tripwise architecture

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

- Interactive diagram: https://gitdiagram.com/kritika8006/tripwise
- Repository: https://github.com/kritika8006/tripwise

## Overview

TripWise is a collaborative trip-planning application: users authenticate, create trips, collect member preferences, and access generated plans, destination discovery, chat, events, and budget tools. The web client routes users to these features and sends API requests; the Express backend dispatches requests to route handlers and domain services, which use PostgreSQL for application data. Planning and destination search include AI/embedding capabilities. Several domain modules are documented by the source index but were not excerpted, so their internal behavior and some client-to-server links are not asserted.

Main entry points: [`backend/src/index.js`](https://github.com/kritika8006/tripwise/blob/main/backend/src/index.js) (Express API), [`frontend/src/App.jsx`](https://github.com/kritika8006/tripwise/blob/main/frontend/src/App.jsx) (App routing), [`frontend/src/services/api.js`](https://github.com/kritika8006/tripwise/blob/main/frontend/src/services/api.js) (HTTP client), [`backend/src/config/database.js`](https://github.com/kritika8006/tripwise/blob/main/backend/src/config/database.js) (PostgreSQL)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_webapp["App routing<br/>[App.jsx]"]
  node_authhook["Auth hook<br/>[useAuth.js]"]
  node_tripviews["Trip views<br/>[TripDetailPage.jsx]"]
  node_preferenceview["Preferences"]
  node_planview["Plan view<br/>[PlanPage.jsx]"]
  node_budgetview["Budget view<br/>[BudgetPage.jsx]"]
  node_chatview["Chat view<br/>[ChatPage.jsx]"]
  node_destinationview["Destination view"]
  node_api_client["HTTP client<br/>[api.js]"]
end

subgraph group_api["API domains"]
  node_server["Express API<br/>[index.js]"]
  node_authroute["Auth routes<br/>[auth.js]"]
  node_triproute["Trip routes<br/>[trips.js]"]
  node_grouproute["Group routes<br/>[groups.js]"]
  node_preference_route["Preference routes<br/>[preferences.js]"]
  node_planroute["Plan routes<br/>[plans.js]"]
  node_chatroute["Chat routes<br/>[chat.js]"]
  node_destinationroute["Destination routes<br/>[destinations.js]"]
  node_eventsroute["Event routes<br/>[events.js]"]
  node_budgetroute["Budget routes<br/>[budget.js]"]
  node_authcontroller["Auth controller<br/>[authController.js]"]
  node_groupcontroller["Group controller<br/>[groupController.js]"]
  node_preferencescontroller["Preference controller"]
  node_authmiddleware["Authentication checks<br/>[auth.js]"]
end

subgraph group_domain["Planning services"]
  node_planning["Plan generation<br/>[planningService.js]"]
  node_pdf["PDF export<br/>[pdfService.js]"]
  node_rag["Destination intelligence<br/>[ragService.js]"]
  node_chat["Trip chat<br/>[chatService.js]"]
  node_events["Event discovery<br/>[eventsService.js]"]
  node_budget["Budget calculation<br/>[budgetService.js]"]
end

subgraph group_storage["State and storage"]
  node_authstate["Auth state<br/>[authSlice.js]"]
  node_tripstate["Trip state<br/>[tripSlice.js]"]
  node_postgres[("PostgreSQL<br/>[database.js]")]
end

node_traveler(("Traveler"))

node_traveler -->|"uses"| node_webapp
node_webapp -->|"checks auth"| node_authhook
node_authhook -->|"loads state"| node_authstate
node_webapp -->|"routes to"| node_tripviews
node_webapp -->|"routes to"| node_preferenceview
node_webapp -->|"routes to"| node_planview
node_webapp -->|"routes to"| node_budgetview
node_webapp -->|"routes to"| node_chatview
node_webapp -->|"routes to"| node_destinationview
node_tripviews -->|"requests data"| node_api_client
node_preferenceview -->|"dispatches updates"| node_tripstate
node_planview -->|"requests plans"| node_api_client
node_budgetview -->|"requests budget"| node_api_client
node_chatview -->|"sends chat"| node_api_client
node_destinationview -->|"searches destinations"| node_api_client
node_tripstate -->|"calls API"| node_api_client
node_authstate -->|"calls API"| node_api_client
node_api_client -.->|"sends requests"| node_server
node_server -->|"mounts routes"| node_authroute
node_server -->|"mounts routes"| node_triproute
node_server -->|"mounts routes"| node_grouproute
node_server -->|"mounts routes"| node_preference_route
node_server -->|"mounts routes"| node_planroute
node_server -->|"mounts routes"| node_chatroute
node_server -->|"mounts routes"| node_destinationroute
node_server -->|"mounts routes"| node_eventsroute
node_server -->|"mounts routes"| node_budgetroute
node_authroute -->|"dispatches to"| node_authcontroller
node_grouproute -->|"dispatches to"| node_groupcontroller
node_preference_route -->|"dispatches to"| node_preferencescontroller
node_planroute -->|"invokes"| node_planning
node_planroute -->|"exports PDF"| node_pdf
node_chatroute -->|"invokes"| node_chat
node_destinationroute -->|"searches with"| node_rag
node_eventsroute -->|"invokes"| node_events
node_budgetroute -->|"invokes"| node_budget
node_authroute -->|"protects endpoints"| node_authmiddleware
node_planroute -->|"protects endpoints"| node_authmiddleware
node_planning -->|"uses context"| node_rag
node_rag -->|"queries destinations"| node_postgres
node_authcontroller -->|"reads and writes"| node_postgres
node_groupcontroller -->|"manages members"| node_postgres
node_preferencescontroller -->|"stores preferences"| node_postgres
node_authmiddleware -->|"checks users"| node_postgres

click node_webapp "https://github.com/kritika8006/tripwise/blob/main/frontend/src/App.jsx"
click node_authhook "https://github.com/kritika8006/tripwise/blob/main/frontend/src/hooks/useAuth.js"
click node_tripviews "https://github.com/kritika8006/tripwise/blob/main/frontend/src/pages/TripDetailPage.jsx"
click node_preferenceview "https://github.com/kritika8006/tripwise/blob/main/frontend/src/pages/PreferencesPage.jsx"
click node_planview "https://github.com/kritika8006/tripwise/blob/main/frontend/src/pages/PlanPage.jsx"
click node_budgetview "https://github.com/kritika8006/tripwise/blob/main/frontend/src/pages/BudgetPage.jsx"
click node_chatview "https://github.com/kritika8006/tripwise/blob/main/frontend/src/pages/ChatPage.jsx"
click node_destinationview "https://github.com/kritika8006/tripwise/blob/main/frontend/src/pages/DestinationsPage.jsx"
click node_api_client "https://github.com/kritika8006/tripwise/blob/main/frontend/src/services/api.js"
click node_authstate "https://github.com/kritika8006/tripwise/blob/main/frontend/src/store/authSlice.js"
click node_tripstate "https://github.com/kritika8006/tripwise/blob/main/frontend/src/store/tripSlice.js"
click node_server "https://github.com/kritika8006/tripwise/blob/main/backend/src/index.js"
click node_authroute "https://github.com/kritika8006/tripwise/blob/main/backend/src/routes/auth.js"
click node_triproute "https://github.com/kritika8006/tripwise/blob/main/backend/src/routes/trips.js"
click node_grouproute "https://github.com/kritika8006/tripwise/blob/main/backend/src/routes/groups.js"
click node_preference_route "https://github.com/kritika8006/tripwise/blob/main/backend/src/routes/preferences.js"
click node_planroute "https://github.com/kritika8006/tripwise/blob/main/backend/src/routes/plans.js"
click node_chatroute "https://github.com/kritika8006/tripwise/blob/main/backend/src/routes/chat.js"
click node_destinationroute "https://github.com/kritika8006/tripwise/blob/main/backend/src/routes/destinations.js"
click node_eventsroute "https://github.com/kritika8006/tripwise/blob/main/backend/src/routes/events.js"
click node_budgetroute "https://github.com/kritika8006/tripwise/blob/main/backend/src/routes/budget.js"
click node_authcontroller "https://github.com/kritika8006/tripwise/blob/main/backend/src/controllers/authController.js"
click node_groupcontroller "https://github.com/kritika8006/tripwise/blob/main/backend/src/controllers/groupController.js"
click node_preferencescontroller "https://github.com/kritika8006/tripwise/blob/main/backend/src/controllers/preferencesController.js"
click node_planning "https://github.com/kritika8006/tripwise/blob/main/backend/src/services/planningService.js"
click node_pdf "https://github.com/kritika8006/tripwise/blob/main/backend/src/services/pdfService.js"
click node_rag "https://github.com/kritika8006/tripwise/blob/main/backend/src/services/ragService.js"
click node_chat "https://github.com/kritika8006/tripwise/blob/main/backend/src/services/chatService.js"
click node_events "https://github.com/kritika8006/tripwise/blob/main/backend/src/services/eventsService.js"
click node_budget "https://github.com/kritika8006/tripwise/blob/main/backend/src/services/budgetService.js"
click node_authmiddleware "https://github.com/kritika8006/tripwise/blob/main/backend/src/middleware/auth.js"
click node_postgres "https://github.com/kritika8006/tripwise/blob/main/backend/src/config/database.js"

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_webapp,node_authhook,node_tripviews,node_preferenceview,node_planview,node_budgetview,node_chatview,node_destinationview,node_api_client toneBlue
class node_server,node_authroute,node_triproute,node_grouproute,node_preference_route,node_planroute,node_chatroute,node_destinationroute,node_eventsroute,node_budgetroute,node_authcontroller,node_groupcontroller,node_preferencescontroller,node_authmiddleware toneAmber
class node_planning,node_pdf,node_rag,node_chat,node_events,node_budget toneMint
class node_authstate,node_tripstate,node_postgres toneRose
class node_traveler toneIndigo
```

## Components

### Web client

- [App routing](https://github.com/kritika8006/tripwise/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Auth hook](https://github.com/kritika8006/tripwise/blob/main/frontend/src/hooks/useAuth.js): `frontend/src/hooks/useAuth.js`
- [Trip views](https://github.com/kritika8006/tripwise/blob/main/frontend/src/pages/TripDetailPage.jsx): `frontend/src/pages/TripDetailPage.jsx`
- [Preferences](https://github.com/kritika8006/tripwise/blob/main/frontend/src/pages/PreferencesPage.jsx): `frontend/src/pages/PreferencesPage.jsx`
- [Plan view](https://github.com/kritika8006/tripwise/blob/main/frontend/src/pages/PlanPage.jsx): `frontend/src/pages/PlanPage.jsx`
- [Budget view](https://github.com/kritika8006/tripwise/blob/main/frontend/src/pages/BudgetPage.jsx): `frontend/src/pages/BudgetPage.jsx`
- [Chat view](https://github.com/kritika8006/tripwise/blob/main/frontend/src/pages/ChatPage.jsx): `frontend/src/pages/ChatPage.jsx`
- [Destination view](https://github.com/kritika8006/tripwise/blob/main/frontend/src/pages/DestinationsPage.jsx): `frontend/src/pages/DestinationsPage.jsx`
- [HTTP client](https://github.com/kritika8006/tripwise/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### API domains

- [Express API](https://github.com/kritika8006/tripwise/blob/main/backend/src/index.js): `backend/src/index.js`
- [Auth routes](https://github.com/kritika8006/tripwise/blob/main/backend/src/routes/auth.js): `backend/src/routes/auth.js`
- [Trip routes](https://github.com/kritika8006/tripwise/blob/main/backend/src/routes/trips.js): `backend/src/routes/trips.js`
- [Group routes](https://github.com/kritika8006/tripwise/blob/main/backend/src/routes/groups.js): `backend/src/routes/groups.js`
- [Preference routes](https://github.com/kritika8006/tripwise/blob/main/backend/src/routes/preferences.js): `backend/src/routes/preferences.js`
- [Plan routes](https://github.com/kritika8006/tripwise/blob/main/backend/src/routes/plans.js): `backend/src/routes/plans.js`
- [Chat routes](https://github.com/kritika8006/tripwise/blob/main/backend/src/routes/chat.js): `backend/src/routes/chat.js`
- [Destination routes](https://github.com/kritika8006/tripwise/blob/main/backend/src/routes/destinations.js): `backend/src/routes/destinations.js`
- [Event routes](https://github.com/kritika8006/tripwise/blob/main/backend/src/routes/events.js): `backend/src/routes/events.js`
- [Budget routes](https://github.com/kritika8006/tripwise/blob/main/backend/src/routes/budget.js): `backend/src/routes/budget.js`
- [Auth controller](https://github.com/kritika8006/tripwise/blob/main/backend/src/controllers/authController.js): `backend/src/controllers/authController.js`
- [Group controller](https://github.com/kritika8006/tripwise/blob/main/backend/src/controllers/groupController.js): `backend/src/controllers/groupController.js`
- [Preference controller](https://github.com/kritika8006/tripwise/blob/main/backend/src/controllers/preferencesController.js): `backend/src/controllers/preferencesController.js`
- [Authentication checks](https://github.com/kritika8006/tripwise/blob/main/backend/src/middleware/auth.js): `backend/src/middleware/auth.js`

### Planning services

- [Plan generation](https://github.com/kritika8006/tripwise/blob/main/backend/src/services/planningService.js): `backend/src/services/planningService.js`
- [PDF export](https://github.com/kritika8006/tripwise/blob/main/backend/src/services/pdfService.js): `backend/src/services/pdfService.js`
- [Destination intelligence](https://github.com/kritika8006/tripwise/blob/main/backend/src/services/ragService.js): `backend/src/services/ragService.js`
- [Trip chat](https://github.com/kritika8006/tripwise/blob/main/backend/src/services/chatService.js): `backend/src/services/chatService.js`
- [Event discovery](https://github.com/kritika8006/tripwise/blob/main/backend/src/services/eventsService.js): `backend/src/services/eventsService.js`
- [Budget calculation](https://github.com/kritika8006/tripwise/blob/main/backend/src/services/budgetService.js): `backend/src/services/budgetService.js`

### State and storage

- [Auth state](https://github.com/kritika8006/tripwise/blob/main/frontend/src/store/authSlice.js): `frontend/src/store/authSlice.js`
- [Trip state](https://github.com/kritika8006/tripwise/blob/main/frontend/src/store/tripSlice.js): `frontend/src/store/tripSlice.js`
- [PostgreSQL](https://github.com/kritika8006/tripwise/blob/main/backend/src/config/database.js): `backend/src/config/database.js`

### Other components

- **Traveler**

## Connections

- Traveler → App routing: uses (evidence: `frontend/src/App.jsx`)
- App routing → Auth hook: checks auth (evidence: `frontend/src/App.jsx`)
- Auth hook → Auth state: loads state (evidence: `frontend/src/hooks/useAuth.js`)
- App routing → Trip views: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Preferences: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Plan view: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Budget view: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Chat view: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Destination view: routes to (evidence: `frontend/src/App.jsx`)
- Trip views → HTTP client: requests data (evidence: `frontend/src/pages/TripDetailPage.jsx`)
- Preferences → Trip state: dispatches updates (evidence: `frontend/src/pages/PreferencesPage.jsx`)
- Plan view → HTTP client: requests plans (evidence: `frontend/src/pages/PlanPage.jsx`)
- Budget view → HTTP client: requests budget (evidence: `frontend/src/pages/BudgetPage.jsx`)
- Chat view → HTTP client: sends chat (evidence: `frontend/src/pages/ChatPage.jsx`)
- Destination view → HTTP client: searches destinations (evidence: `frontend/src/pages/DestinationsPage.jsx`)
- Trip state → HTTP client: calls API (evidence: `frontend/src/store/tripSlice.js`)
- Auth state → HTTP client: calls API (evidence: `frontend/src/store/authSlice.js`)
- HTTP client → Express API: sends requests
- Express API → Auth routes: mounts routes (evidence: `backend/src/index.js`)
- Express API → Trip routes: mounts routes (evidence: `backend/src/index.js`)
- Express API → Group routes: mounts routes (evidence: `backend/src/index.js`)
- Express API → Preference routes: mounts routes (evidence: `backend/src/index.js`)
- Express API → Plan routes: mounts routes (evidence: `backend/src/index.js`)
- Express API → Chat routes: mounts routes (evidence: `backend/src/index.js`)
- Express API → Destination routes: mounts routes (evidence: `backend/src/index.js`)
- Express API → Event routes: mounts routes (evidence: `backend/src/index.js`)
- Express API → Budget routes: mounts routes (evidence: `backend/src/index.js`)
- Auth routes → Auth controller: dispatches to (evidence: `backend/src/routes/auth.js`)
- Group routes → Group controller: dispatches to (evidence: `backend/src/routes/groups.js`)
- Preference routes → Preference controller: dispatches to (evidence: `backend/src/routes/preferences.js`)
- Plan routes → Plan generation: invokes (evidence: `backend/src/routes/plans.js`)
- Plan routes → PDF export: exports PDF (evidence: `backend/src/routes/plans.js`)
- Chat routes → Trip chat: invokes (evidence: `backend/src/routes/chat.js`)
- Destination routes → Destination intelligence: searches with (evidence: `backend/src/routes/destinations.js`)
- Event routes → Event discovery: invokes (evidence: `backend/src/routes/events.js`)
- Budget routes → Budget calculation: invokes (evidence: `backend/src/routes/budget.js`)
- Auth routes → Authentication checks: protects endpoints (evidence: `backend/src/routes/auth.js`)
- Plan routes → Authentication checks: protects endpoints (evidence: `backend/src/routes/plans.js`)
- Plan generation → Destination intelligence: uses context (evidence: `backend/src/services/planningService.js`)
- Destination intelligence → PostgreSQL: queries destinations (evidence: `backend/src/services/ragService.js`)
- Auth controller → PostgreSQL: reads and writes (evidence: `backend/src/controllers/authController.js`)
- Group controller → PostgreSQL: manages members (evidence: `backend/src/controllers/groupController.js`)
- Preference controller → PostgreSQL: stores preferences (evidence: `backend/src/controllers/preferencesController.js`)
- Authentication checks → PostgreSQL: checks users (evidence: `backend/src/middleware/auth.js`)
