# adi14pa/farewell architecture

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

- Interactive diagram: https://gitdiagram.com/adi14pa/farewell
- Repository: https://github.com/adi14pa/farewell

## Overview

Farewell is a budget-aware trip planner. Users enter origin, dates, budget, and travel vibe; the frontend submits a plan request, the backend runs a staged agent graph to propose destinations, fetch live flight and hotel prices, rank options, and build an itinerary, then saves the result for later retrieval. The UI presents ranked destinations, cost breakdowns, hotel links, and itinerary details. README documents local-attraction discovery and trip-history endpoints; those capabilities are included, though their implementations were not sampled. Edges follow shown calls and documented stages.

Main entry points: [`frontend/src/App.jsx`](https://github.com/adi14pa/farewell/blob/main/frontend/src/App.jsx) (App workflow), [`backend/src/agents/graph.js`](https://github.com/adi14pa/farewell/blob/main/backend/src/agents/graph.js) (Trip graph), [`backend/src/routes/trips.js`](https://github.com/adi14pa/farewell/blob/main/backend/src/routes/trips.js) (Trip endpoints), [`frontend/src/components/Results.jsx`](https://github.com/adi14pa/farewell/blob/main/frontend/src/components/Results.jsx) (Trip results)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Trip planning UI"]
  node_planner_form["Trip form<br/>[PlannerForm.jsx]"]
  node_app["App workflow<br/>[App.jsx]"]
  node_api_client["API client<br/>[client.js]"]
  node_progress["Agent progress<br/>[AgentProgress.jsx]"]
  node_results["Trip results<br/>[Results.jsx]"]
  node_destination_card["Destination cards"]
  node_detail_panel["Destination detail<br/>[DetailPanel.jsx]"]
  node_itinerary_view["Itinerary view<br/>[Itinerary.jsx]"]
  node_format["Display formatting<br/>[format.js]"]
end

subgraph group_backend["Planning API"]
  node_trip_routes["Trip endpoints<br/>[trips.js]"]
end

subgraph group_agents["Agent workflow"]
  node_trip_graph["Trip graph<br/>[graph.js]"]
  node_planner_node["Destination planner<br/>[planner.js]"]
  node_search_node["Fare search<br/>[search.js]"]
  node_compare_node["Cost ranking<br/>[compare.js]"]
  node_itinerary_node["Itinerary builder<br/>[itinerary.js]"]
end

subgraph group_integrations["External services"]
  node_mcp_client["MCP search client<br/>[mcpClient.js]"]
  node_groq_client["Groq JSON client<br/>[groq.js]"]
end

subgraph group_persistence["Trip history"]
  node_trip_db[("Neon trips store<br/>[pool.js]")]
end

node_traveler(("Traveler"))
node_serpapi{{"SerpApi MCP"}}
node_groq{{"Groq API"}}

node_traveler -->|"enters trip"| node_planner_form
node_planner_form -->|"submits details"| node_app
node_app -->|"shows progress"| node_progress
node_app -->|"requests plan"| node_api_client
node_api_client -->|"POST plan"| node_trip_routes
node_trip_routes -->|"invokes graph"| node_trip_graph
node_trip_graph -->|"dispatches"| node_planner_node
node_trip_graph -->|"dispatches"| node_search_node
node_trip_graph -->|"dispatches"| node_compare_node
node_trip_graph -->|"dispatches"| node_itinerary_node
node_planner_node -->|"requests candidates"| node_groq_client
node_groq_client -->|"calls completions"| node_groq
node_search_node -->|"searches fares"| node_mcp_client
node_mcp_client -->|"calls search"| node_serpapi
node_itinerary_node -->|"finds local places"| node_mcp_client
node_itinerary_node -->|"sequences places"| node_groq_client
node_trip_routes -->|"saves and reads"| node_trip_db
node_trip_routes -->|"returns plan"| node_app
node_app -->|"renders result"| node_results
node_results -->|"renders rankings"| node_destination_card
node_results -->|"shows selection"| node_detail_panel
node_results -->|"renders itinerary"| node_itinerary_view
node_detail_panel -->|"formats costs"| node_format
node_app -.->|"loads trip history"| node_trip_routes

click node_planner_form "https://github.com/adi14pa/farewell/blob/main/frontend/src/components/PlannerForm.jsx"
click node_app "https://github.com/adi14pa/farewell/blob/main/frontend/src/App.jsx"
click node_api_client "https://github.com/adi14pa/farewell/blob/main/frontend/src/api/client.js"
click node_progress "https://github.com/adi14pa/farewell/blob/main/frontend/src/components/AgentProgress.jsx"
click node_results "https://github.com/adi14pa/farewell/blob/main/frontend/src/components/Results.jsx"
click node_destination_card "https://github.com/adi14pa/farewell/blob/main/frontend/src/components/DestinationCard.jsx"
click node_detail_panel "https://github.com/adi14pa/farewell/blob/main/frontend/src/components/DetailPanel.jsx"
click node_itinerary_view "https://github.com/adi14pa/farewell/blob/main/frontend/src/components/Itinerary.jsx"
click node_format "https://github.com/adi14pa/farewell/blob/main/frontend/src/lib/format.js"
click node_trip_routes "https://github.com/adi14pa/farewell/blob/main/backend/src/routes/trips.js"
click node_trip_graph "https://github.com/adi14pa/farewell/blob/main/backend/src/agents/graph.js"
click node_planner_node "https://github.com/adi14pa/farewell/blob/main/backend/src/agents/nodes/planner.js"
click node_search_node "https://github.com/adi14pa/farewell/blob/main/backend/src/agents/nodes/search.js"
click node_compare_node "https://github.com/adi14pa/farewell/blob/main/backend/src/agents/nodes/compare.js"
click node_itinerary_node "https://github.com/adi14pa/farewell/blob/main/backend/src/agents/nodes/itinerary.js"
click node_mcp_client "https://github.com/adi14pa/farewell/blob/main/backend/src/agents/mcpClient.js"
click node_groq_client "https://github.com/adi14pa/farewell/blob/main/backend/src/llm/groq.js"
click node_trip_db "https://github.com/adi14pa/farewell/blob/main/backend/src/db/pool.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_planner_form,node_app,node_api_client,node_progress,node_results,node_destination_card,node_detail_panel,node_itinerary_view,node_format toneBlue
class node_trip_routes toneAmber
class node_trip_graph,node_planner_node,node_search_node,node_compare_node,node_itinerary_node,node_serpapi,node_groq toneMint
class node_mcp_client,node_groq_client toneRose
class node_trip_db,node_traveler toneIndigo
```

## Components

### Trip planning UI

- [Trip form](https://github.com/adi14pa/farewell/blob/main/frontend/src/components/PlannerForm.jsx): `frontend/src/components/PlannerForm.jsx`
- [App workflow](https://github.com/adi14pa/farewell/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [API client](https://github.com/adi14pa/farewell/blob/main/frontend/src/api/client.js): `frontend/src/api/client.js`
- [Agent progress](https://github.com/adi14pa/farewell/blob/main/frontend/src/components/AgentProgress.jsx): `frontend/src/components/AgentProgress.jsx`
- [Trip results](https://github.com/adi14pa/farewell/blob/main/frontend/src/components/Results.jsx): `frontend/src/components/Results.jsx`
- [Destination cards](https://github.com/adi14pa/farewell/blob/main/frontend/src/components/DestinationCard.jsx): `frontend/src/components/DestinationCard.jsx`
- [Destination detail](https://github.com/adi14pa/farewell/blob/main/frontend/src/components/DetailPanel.jsx): `frontend/src/components/DetailPanel.jsx`
- [Itinerary view](https://github.com/adi14pa/farewell/blob/main/frontend/src/components/Itinerary.jsx): `frontend/src/components/Itinerary.jsx`
- [Display formatting](https://github.com/adi14pa/farewell/blob/main/frontend/src/lib/format.js): `frontend/src/lib/format.js`

### Planning API

- [Trip endpoints](https://github.com/adi14pa/farewell/blob/main/backend/src/routes/trips.js): `backend/src/routes/trips.js`

### Agent workflow

- [Trip graph](https://github.com/adi14pa/farewell/blob/main/backend/src/agents/graph.js): `backend/src/agents/graph.js`
- [Destination planner](https://github.com/adi14pa/farewell/blob/main/backend/src/agents/nodes/planner.js): `backend/src/agents/nodes/planner.js`
- [Fare search](https://github.com/adi14pa/farewell/blob/main/backend/src/agents/nodes/search.js): `backend/src/agents/nodes/search.js`
- [Cost ranking](https://github.com/adi14pa/farewell/blob/main/backend/src/agents/nodes/compare.js): `backend/src/agents/nodes/compare.js`
- [Itinerary builder](https://github.com/adi14pa/farewell/blob/main/backend/src/agents/nodes/itinerary.js): `backend/src/agents/nodes/itinerary.js`

### External services

- [MCP search client](https://github.com/adi14pa/farewell/blob/main/backend/src/agents/mcpClient.js): `backend/src/agents/mcpClient.js`
- [Groq JSON client](https://github.com/adi14pa/farewell/blob/main/backend/src/llm/groq.js): `backend/src/llm/groq.js`

### Trip history

- [Neon trips store](https://github.com/adi14pa/farewell/blob/main/backend/src/db/pool.js): `backend/src/db/pool.js`

### Other components

- **Traveler**
- **SerpApi MCP**
- **Groq API**

## Connections

- Traveler → Trip form: enters trip (evidence: `frontend/src/components/PlannerForm.jsx`)
- Trip form → App workflow: submits details (evidence: `frontend/src/App.jsx`)
- App workflow → Agent progress: shows progress (evidence: `frontend/src/App.jsx`)
- App workflow → API client: requests plan (evidence: `frontend/src/App.jsx`)
- API client → Trip endpoints: POST plan (evidence: `frontend/src/api/client.js`)
- Trip endpoints → Trip graph: invokes graph (evidence: `backend/src/routes/trips.js`)
- Trip graph → Destination planner: dispatches (evidence: `backend/src/agents/graph.js`)
- Trip graph → Fare search: dispatches (evidence: `backend/src/agents/graph.js`)
- Trip graph → Cost ranking: dispatches (evidence: `backend/src/agents/graph.js`)
- Trip graph → Itinerary builder: dispatches (evidence: `backend/src/agents/graph.js`)
- Destination planner → Groq JSON client: requests candidates (evidence: `backend/src/agents/nodes/planner.js`)
- Groq JSON client → Groq API: calls completions (evidence: `backend/src/llm/groq.js`)
- Fare search → MCP search client: searches fares (evidence: `backend/src/agents/nodes/search.js`)
- MCP search client → SerpApi MCP: calls search (evidence: `backend/src/agents/mcpClient.js`)
- Itinerary builder → MCP search client: finds local places (evidence: `backend/src/agents/nodes/itinerary.js`)
- Itinerary builder → Groq JSON client: sequences places (evidence: `backend/src/agents/nodes/itinerary.js`)
- Trip endpoints → Neon trips store: saves and reads (evidence: `backend/src/routes/trips.js`)
- Trip endpoints → App workflow: returns plan
- App workflow → Trip results: renders result (evidence: `frontend/src/App.jsx`)
- Trip results → Destination cards: renders rankings (evidence: `frontend/src/components/Results.jsx`)
- Trip results → Destination detail: shows selection (evidence: `frontend/src/components/Results.jsx`)
- Trip results → Itinerary view: renders itinerary (evidence: `frontend/src/components/Results.jsx`)
- Destination detail → Display formatting: formats costs (evidence: `frontend/src/components/DetailPanel.jsx`)
- App workflow → Trip endpoints: loads trip history (evidence: `README.md`)
