# achrafelmakaoui/triply_travel_planner architecture

> Architecture diagram of the GitHub repository achrafelmakaoui/triply_travel_planner, 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/achrafelmakaoui/triply_travel_planner
- Repository: https://github.com/achrafelmakaoui/triply_travel_planner

## Overview

Triply is a travel-planning web app: users authenticate, submit a natural-language trip request, follow AI planning progress, approve or cancel the booking summary, and save the result. The React client uses an Express API for authentication, trip history, profiles, and sharing, with MongoDB-backed users and trips. The README documents a separate FastAPI/LangGraph multi-agent service and its research, budget, itinerary, and booking capabilities, but that service is absent from the supplied tree and excerpts; its internal modules and connections are therefore not mapped.

Main entry points: [`frontend/src/App.js`](https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/App.js) (App routing), [`frontend/src/api/axios.js`](https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/api/axios.js) (API client), [`frontend/src/context/AuthContext.js`](https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/context/AuthContext.js) (Auth context), [`backend/src/middleware/protect.js`](https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/backend/src/middleware/protect.js) (JWT protection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React client"]
  node_app["App routing<br/>[App.js]"]
  node_auth_ui["Auth context<br/>[AuthContext.js]"]
  node_api["API client<br/>[axios.js]"]
  node_signup["Sign up<br/>[SignUp.jsx]"]
  node_signin["Sign in<br/>[SignIn.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_profile_ui["Profile page<br/>[Profile.jsx]"]
  node_planner_ui["Trip planner<br/>[TripPlanner.jsx]"]
  node_trips_ui["My trips<br/>[MyTrips.jsx]"]
  node_detail_ui["Trip detail<br/>[TripDetail.jsx]"]
  node_public_ui["Public trip<br/>[PublicTrip.jsx]"]
  node_landing["Landing page<br/>[LandingPage.jsx]"]
end

subgraph group_identity["Identity and profiles"]
  node_auth_routes["Auth routes<br/>[auth.js]"]
  node_protect["JWT protection<br/>[protect.js]"]
  node_profile_routes["Profile routes<br/>[profile.js]"]
  node_user_model["User model<br/>[User.js]"]
end

subgraph group_trips["Trip management"]
  node_trip_routes["Trip routes<br/>[trips.js]"]
  node_trip_model["Trip model<br/>[Trip.js]"]
  node_public_lookup["Public trip lookup<br/>[app.js]"]
  node_database[("MongoDB")]
end

subgraph group_planning["AI planning"]
  node_plan_routes["Planning routes<br/>[plan.js]"]
  node_ai_service["Multi-agent AI"]
  node_research["Destination research"]
  node_budget["Budget planning"]
  node_itinerary["Itinerary creation"]
  node_booking["Booking approval"]
end

node_traveler(("Traveler"))

node_traveler -->|"uses"| node_app
node_app -->|"routes to"| node_landing
node_app -->|"routes to"| node_signup
node_app -->|"routes to"| node_signin
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_planner_ui
node_app -->|"routes to"| node_trips_ui
node_app -->|"routes to"| node_profile_ui
node_app -->|"routes to"| node_detail_ui
node_app -->|"routes to"| node_public_ui
node_signup -->|"registers via"| node_auth_ui
node_signin -->|"signs in via"| node_auth_ui
node_auth_ui -->|"sends requests"| node_api
node_api -->|"HTTP requests"| node_auth_routes
node_auth_routes -->|"reads and creates"| node_user_model
node_auth_routes -->|"authenticates"| node_protect
node_protect -->|"loads user"| node_user_model
node_profile_ui -->|"requests profile"| node_api
node_api -->|"HTTP requests"| node_profile_routes
node_profile_routes -->|"authenticates"| node_protect
node_profile_routes -->|"reads and updates"| node_user_model
node_planner_ui -->|"resumes and saves"| node_api
node_planner_ui -->|"streams planning"| node_plan_routes
node_api -->|"trip requests"| node_trip_routes
node_trip_routes -->|"authenticates"| node_protect
node_trip_routes -->|"reads and writes"| node_trip_model
node_trip_model -.->|"persists trips"| node_database
node_plan_routes -->|"proxies requests"| node_ai_service
node_ai_service -.->|"coordinates agents"| node_research
node_ai_service -.->|"coordinates agents"| node_budget
node_ai_service -.->|"coordinates agents"| node_itinerary
node_ai_service -.->|"coordinates agents"| node_booking
node_trips_ui -->|"lists and manages"| node_api
node_detail_ui -->|"loads trip"| node_api
node_public_ui -.->|"loads shared trip"| node_api
node_api -->|"HTTP request"| node_public_lookup
node_public_lookup -->|"looks up share"| node_trip_model
node_public_lookup -.->|"queries trips"| node_database
node_app -->|"checks session"| node_auth_ui

click node_app "https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/App.js"
click node_auth_ui "https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/context/AuthContext.js"
click node_api "https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/api/axios.js"
click node_signup "https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/pages/SignUp/SignUp.jsx"
click node_signin "https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/pages/SignIn/SignIn.jsx"
click node_dashboard "https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/pages/Dashboard/Dashboard.jsx"
click node_profile_ui "https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/pages/Profile/Profile.jsx"
click node_planner_ui "https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/pages/TripPlanner/TripPlanner.jsx"
click node_trips_ui "https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/pages/MyTrips/MyTrips.jsx"
click node_detail_ui "https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/pages/TripDetail/TripDetail.jsx"
click node_public_ui "https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/pages/PublicTrip/PublicTrip.jsx"
click node_landing "https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/pages/LandingPage/LandingPage.jsx"
click node_auth_routes "https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/backend/src/routes/auth.js"
click node_protect "https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/backend/src/middleware/protect.js"
click node_profile_routes "https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/backend/src/routes/profile.js"
click node_user_model "https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/backend/src/models/User.js"
click node_trip_routes "https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/backend/src/routes/trips.js"
click node_trip_model "https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/backend/src/models/Trip.js"
click node_public_lookup "https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/backend/src/app.js"
click node_plan_routes "https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/backend/src/routes/plan.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_app,node_auth_ui,node_api,node_signup,node_signin,node_dashboard,node_profile_ui,node_planner_ui,node_trips_ui,node_detail_ui,node_public_ui,node_landing toneBlue
class node_auth_routes,node_protect,node_profile_routes,node_user_model toneAmber
class node_trip_routes,node_trip_model,node_public_lookup,node_database toneMint
class node_plan_routes,node_ai_service,node_research,node_budget,node_itinerary,node_booking toneRose
class node_traveler toneIndigo
```

## Components

### React client

- [App routing](https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/App.js): `frontend/src/App.js`
- [Auth context](https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/context/AuthContext.js): `frontend/src/context/AuthContext.js`
- [API client](https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/api/axios.js): `frontend/src/api/axios.js`
- [Sign up](https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/pages/SignUp/SignUp.jsx): `frontend/src/pages/SignUp/SignUp.jsx`
- [Sign in](https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/pages/SignIn/SignIn.jsx): `frontend/src/pages/SignIn/SignIn.jsx`
- [Dashboard](https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/pages/Dashboard/Dashboard.jsx): `frontend/src/pages/Dashboard/Dashboard.jsx`
- [Profile page](https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/pages/Profile/Profile.jsx): `frontend/src/pages/Profile/Profile.jsx`
- [Trip planner](https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/pages/TripPlanner/TripPlanner.jsx): `frontend/src/pages/TripPlanner/TripPlanner.jsx`
- [My trips](https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/pages/MyTrips/MyTrips.jsx): `frontend/src/pages/MyTrips/MyTrips.jsx`
- [Trip detail](https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/pages/TripDetail/TripDetail.jsx): `frontend/src/pages/TripDetail/TripDetail.jsx`
- [Public trip](https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/pages/PublicTrip/PublicTrip.jsx): `frontend/src/pages/PublicTrip/PublicTrip.jsx`
- [Landing page](https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/frontend/src/pages/LandingPage/LandingPage.jsx): `frontend/src/pages/LandingPage/LandingPage.jsx`

### Identity and profiles

- [Auth routes](https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/backend/src/routes/auth.js): `backend/src/routes/auth.js`
- [JWT protection](https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/backend/src/middleware/protect.js): `backend/src/middleware/protect.js`
- [Profile routes](https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/backend/src/routes/profile.js): `backend/src/routes/profile.js`
- [User model](https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/backend/src/models/User.js): `backend/src/models/User.js`

### Trip management

- [Trip routes](https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/backend/src/routes/trips.js): `backend/src/routes/trips.js`
- [Trip model](https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/backend/src/models/Trip.js): `backend/src/models/Trip.js`
- [Public trip lookup](https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/backend/src/app.js): `backend/src/app.js`
- **MongoDB**

### AI planning

- [Planning routes](https://github.com/achrafelmakaoui/triply_travel_planner/blob/main/backend/src/routes/plan.js): `backend/src/routes/plan.js`
- **Multi-agent AI**
- **Destination research**
- **Budget planning**
- **Itinerary creation**
- **Booking approval**

### Other components

- **Traveler**

## Connections

- Traveler → App routing: uses (evidence: `README.md`)
- App routing → Landing page: routes to (evidence: `frontend/src/App.js`)
- App routing → Sign up: routes to (evidence: `frontend/src/App.js`)
- App routing → Sign in: routes to (evidence: `frontend/src/App.js`)
- App routing → Dashboard: routes to (evidence: `frontend/src/App.js`)
- App routing → Trip planner: routes to (evidence: `frontend/src/App.js`)
- App routing → My trips: routes to (evidence: `frontend/src/App.js`)
- App routing → Profile page: routes to (evidence: `frontend/src/App.js`)
- App routing → Trip detail: routes to (evidence: `frontend/src/App.js`)
- App routing → Public trip: routes to (evidence: `frontend/src/App.js`)
- Sign up → Auth context: registers via (evidence: `frontend/src/pages/SignUp/SignUp.jsx`)
- Sign in → Auth context: signs in via (evidence: `frontend/src/pages/SignIn/SignIn.jsx`)
- Auth context → API client: sends requests (evidence: `frontend/src/context/AuthContext.js`)
- API client → Auth routes: HTTP requests (evidence: `README.md`)
- Auth routes → User model: reads and creates (evidence: `backend/src/routes/auth.js`)
- Auth routes → JWT protection: authenticates (evidence: `backend/src/routes/auth.js`)
- JWT protection → User model: loads user (evidence: `backend/src/middleware/protect.js`)
- Profile page → API client: requests profile (evidence: `frontend/src/pages/Profile/Profile.jsx`)
- API client → Profile routes: HTTP requests (evidence: `README.md`)
- Profile routes → JWT protection: authenticates (evidence: `backend/src/routes/profile.js`)
- Profile routes → User model: reads and updates (evidence: `backend/src/routes/profile.js`)
- Trip planner → API client: resumes and saves (evidence: `frontend/src/pages/TripPlanner/TripPlanner.jsx`)
- Trip planner → Planning routes: streams planning (evidence: `README.md`)
- API client → Trip routes: trip requests (evidence: `README.md`)
- Trip routes → JWT protection: authenticates (evidence: `backend/src/routes/trips.js`)
- Trip routes → Trip model: reads and writes (evidence: `backend/src/routes/trips.js`)
- Trip model → MongoDB: persists trips
- Planning routes → Multi-agent AI: proxies requests (evidence: `README.md`)
- Multi-agent AI → Destination research: coordinates agents
- Multi-agent AI → Budget planning: coordinates agents
- Multi-agent AI → Itinerary creation: coordinates agents
- Multi-agent AI → Booking approval: coordinates agents
- My trips → API client: lists and manages (evidence: `frontend/src/pages/MyTrips/MyTrips.jsx`)
- Trip detail → API client: loads trip (evidence: `frontend/src/pages/TripDetail/TripDetail.jsx`)
- Public trip → API client: loads shared trip
- API client → Public trip lookup: HTTP request (evidence: `README.md`)
- Public trip lookup → Trip model: looks up share (evidence: `backend/src/app.js`)
- Public trip lookup → MongoDB: queries trips
- App routing → Auth context: checks session (evidence: `frontend/src/App.js`)
