# mjcaelum-oss/twojiteam architecture

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

- Interactive diagram: https://gitdiagram.com/mjcaelum-oss/twojiteam
- Repository: https://github.com/mjcaelum-oss/twojiteam

## Overview

TRAVEL PICK is a React prototype for building domestic travel itineraries from a traveler’s destination, preferences, dates, and party size. Its main workflow moves from search inputs to Google Places candidate collection and OpenAI-assisted recommendations, then into an editable itinerary with route estimates and schedule warnings, and finally saves a course for later viewing. Separate branches cover MVP login, favorites/saved courses, and map presentation. The README documents several capabilities whose implementation was not sampled; those links are shown only where documented, and unsampled details are not inferred.

Main entry points: [`src/pages/ReviewPage/ReviewPage.tsx`](https://github.com/mjcaelum-oss/twojiteam/blob/main/src/pages/ReviewPage/ReviewPage.tsx) (Plan review), [`src/pages/SearchPage/SearchPage.tsx`](https://github.com/mjcaelum-oss/twojiteam/blob/main/src/pages/SearchPage/SearchPage.tsx) (Search inputs), [`src/pages/RecommendationPage/RecommendationPage.tsx`](https://github.com/mjcaelum-oss/twojiteam/blob/main/src/pages/RecommendationPage/RecommendationPage.tsx) (Recommendations), [`src/features/routes/route.service.ts`](https://github.com/mjcaelum-oss/twojiteam/blob/main/src/features/routes/route.service.ts) (Route estimates)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_planning["Planning workflow"]
  node_search["Search inputs<br/>[SearchPage.tsx]"]
  node_destination["Destination search"]
  node_preferences["Travel preferences"]
  node_recommendation_page["Recommendations"]
  node_recommendation_service["Candidate collection"]
  node_review["Plan review<br/>[ReviewPage.tsx]"]
  node_schedule["Schedule validation"]
  node_route["Route estimates<br/>[route.service.ts]"]
  node_route_cost["Route cost<br/>[routeCost.utils.ts]"]
  node_map["Map display<br/>[TravelMap.tsx]"]
end

subgraph group_services["External services"]
  node_places["Google Places"]
  node_openai_client["OpenAI client"]
  node_recommendation_api["Recommendation API<br/>[recommendations.js]"]
  node_openai{{"OpenAI"}}
  node_google_maps{{"Google Maps"}}
  node_supabase[("Supabase<br/>[supabase.client.ts]")]
end

subgraph group_state["Plan and account state"]
  node_travel_plan["Active travel plan"]
  node_repository["Plan repository<br/>[plan.repository.ts]"]
  node_local_repository["Local plan storage"]
  node_supabase_repository["Supabase plan storage"]
  node_local_storage[("Browser storage")]
  node_auth["MVP authentication<br/>[auth.service.ts]"]
end

subgraph group_saved["Saved travel"]
  node_saved_courses["Saved courses"]
  node_course_detail["Course detail"]
  node_my_page["My page<br/>[MyPage.tsx]"]
end

node_traveler(("Traveler"))

node_traveler -->|"enters conditions"| node_search
node_search -->|"uses"| node_destination
node_search -->|"uses"| node_preferences
node_traveler -->|"requests picks"| node_recommendation_page
node_recommendation_page -->|"requests candidates"| node_recommendation_service
node_recommendation_service -->|"queries places"| node_places
node_recommendation_page -->|"requests recommendations"| node_openai_client
node_openai_client -->|"posts request"| node_recommendation_api
node_recommendation_api -->|"requests generation"| node_openai
node_traveler -->|"edits itinerary"| node_review
node_review -->|"updates plan"| node_travel_plan
node_review -->|"validates schedule"| node_schedule
node_review -->|"requests routes"| node_route
node_route -->|"estimates cost"| node_route_cost
node_route -->|"requests directions"| node_google_maps
node_review -->|"renders itinerary"| node_map
node_review -->|"saves plan"| node_travel_plan
node_travel_plan -->|"delegates save"| node_repository
node_repository -.->|"implements"| node_local_repository
node_repository -.->|"implements"| node_supabase_repository
node_local_repository -.->|"persists locally"| node_local_storage
node_supabase_repository -->|"reads and writes"| node_supabase
node_traveler -.->|"signs in"| node_auth
node_auth -->|"calls RPC"| node_supabase
node_auth -->|"stores session"| node_local_storage
node_traveler -->|"saves course"| node_saved_courses
node_saved_courses -->|"provides course"| node_course_detail
node_saved_courses -->|"provides courses"| node_my_page

click node_search "https://github.com/mjcaelum-oss/twojiteam/blob/main/src/pages/SearchPage/SearchPage.tsx"
click node_destination "https://github.com/mjcaelum-oss/twojiteam/blob/main/src/features/travel-search/components/DestinationSearch.tsx"
click node_preferences "https://github.com/mjcaelum-oss/twojiteam/blob/main/src/features/travel-preferences/components/TravelPreferenceForm.tsx"
click node_recommendation_page "https://github.com/mjcaelum-oss/twojiteam/blob/main/src/pages/RecommendationPage/RecommendationPage.tsx"
click node_recommendation_service "https://github.com/mjcaelum-oss/twojiteam/blob/main/src/features/recommendations/recommendation.service.ts"
click node_places "https://github.com/mjcaelum-oss/twojiteam/blob/main/src/services/google/googlePlaces.service.ts"
click node_openai_client "https://github.com/mjcaelum-oss/twojiteam/blob/main/src/services/openai/openaiRecommendation.service.ts"
click node_recommendation_api "https://github.com/mjcaelum-oss/twojiteam/blob/main/api/recommendations.js"
click node_review "https://github.com/mjcaelum-oss/twojiteam/blob/main/src/pages/ReviewPage/ReviewPage.tsx"
click node_travel_plan "https://github.com/mjcaelum-oss/twojiteam/blob/main/src/app/providers/TravelPlanProvider.tsx"
click node_schedule "https://github.com/mjcaelum-oss/twojiteam/blob/main/src/features/schedule-validation/scheduleValidation.service.ts"
click node_route "https://github.com/mjcaelum-oss/twojiteam/blob/main/src/features/routes/route.service.ts"
click node_route_cost "https://github.com/mjcaelum-oss/twojiteam/blob/main/src/features/routes/routeCost.utils.ts"
click node_map "https://github.com/mjcaelum-oss/twojiteam/blob/main/src/features/map/components/TravelMap.tsx"
click node_repository "https://github.com/mjcaelum-oss/twojiteam/blob/main/src/features/plan-storage/plan.repository.ts"
click node_local_repository "https://github.com/mjcaelum-oss/twojiteam/blob/main/src/features/plan-storage/localPlan.repository.ts"
click node_supabase_repository "https://github.com/mjcaelum-oss/twojiteam/blob/main/src/features/plan-storage/supabasePlan.repository.ts"
click node_local_storage "https://github.com/mjcaelum-oss/twojiteam/blob/main/src/services/storage/localStorage.service.ts"
click node_auth "https://github.com/mjcaelum-oss/twojiteam/blob/main/src/services/supabase/auth.service.ts"
click node_supabase "https://github.com/mjcaelum-oss/twojiteam/blob/main/src/services/supabase/supabase.client.ts"
click node_saved_courses "https://github.com/mjcaelum-oss/twojiteam/blob/main/src/features/saved-courses/savedCourses.store.ts"
click node_course_detail "https://github.com/mjcaelum-oss/twojiteam/blob/main/src/pages/CourseDetailPage/CourseDetailPage.tsx"
click node_my_page "https://github.com/mjcaelum-oss/twojiteam/blob/main/src/pages/MyPage/MyPage.tsx"

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_search,node_destination,node_preferences,node_recommendation_page,node_recommendation_service,node_review,node_schedule,node_route,node_route_cost,node_map toneBlue
class node_places,node_openai_client,node_recommendation_api,node_openai,node_google_maps,node_supabase toneAmber
class node_travel_plan,node_repository,node_local_repository,node_supabase_repository,node_local_storage,node_auth toneMint
class node_saved_courses,node_course_detail,node_my_page toneRose
class node_traveler toneIndigo
```

## Components

### Planning workflow

- [Search inputs](https://github.com/mjcaelum-oss/twojiteam/blob/main/src/pages/SearchPage/SearchPage.tsx): `src/pages/SearchPage/SearchPage.tsx`
- [Destination search](https://github.com/mjcaelum-oss/twojiteam/blob/main/src/features/travel-search/components/DestinationSearch.tsx): `src/features/travel-search/components/DestinationSearch.tsx`
- [Travel preferences](https://github.com/mjcaelum-oss/twojiteam/blob/main/src/features/travel-preferences/components/TravelPreferenceForm.tsx): `src/features/travel-preferences/components/TravelPreferenceForm.tsx`
- [Recommendations](https://github.com/mjcaelum-oss/twojiteam/blob/main/src/pages/RecommendationPage/RecommendationPage.tsx): `src/pages/RecommendationPage/RecommendationPage.tsx`
- [Candidate collection](https://github.com/mjcaelum-oss/twojiteam/blob/main/src/features/recommendations/recommendation.service.ts): `src/features/recommendations/recommendation.service.ts`
- [Plan review](https://github.com/mjcaelum-oss/twojiteam/blob/main/src/pages/ReviewPage/ReviewPage.tsx): `src/pages/ReviewPage/ReviewPage.tsx`
- [Schedule validation](https://github.com/mjcaelum-oss/twojiteam/blob/main/src/features/schedule-validation/scheduleValidation.service.ts): `src/features/schedule-validation/scheduleValidation.service.ts`
- [Route estimates](https://github.com/mjcaelum-oss/twojiteam/blob/main/src/features/routes/route.service.ts): `src/features/routes/route.service.ts`
- [Route cost](https://github.com/mjcaelum-oss/twojiteam/blob/main/src/features/routes/routeCost.utils.ts): `src/features/routes/routeCost.utils.ts`
- [Map display](https://github.com/mjcaelum-oss/twojiteam/blob/main/src/features/map/components/TravelMap.tsx): `src/features/map/components/TravelMap.tsx`

### External services

- [Google Places](https://github.com/mjcaelum-oss/twojiteam/blob/main/src/services/google/googlePlaces.service.ts): `src/services/google/googlePlaces.service.ts`
- [OpenAI client](https://github.com/mjcaelum-oss/twojiteam/blob/main/src/services/openai/openaiRecommendation.service.ts): `src/services/openai/openaiRecommendation.service.ts`
- [Recommendation API](https://github.com/mjcaelum-oss/twojiteam/blob/main/api/recommendations.js): `api/recommendations.js`
- **OpenAI**
- **Google Maps**
- [Supabase](https://github.com/mjcaelum-oss/twojiteam/blob/main/src/services/supabase/supabase.client.ts): `src/services/supabase/supabase.client.ts`

### Plan and account state

- [Active travel plan](https://github.com/mjcaelum-oss/twojiteam/blob/main/src/app/providers/TravelPlanProvider.tsx): `src/app/providers/TravelPlanProvider.tsx`
- [Plan repository](https://github.com/mjcaelum-oss/twojiteam/blob/main/src/features/plan-storage/plan.repository.ts): `src/features/plan-storage/plan.repository.ts`
- [Local plan storage](https://github.com/mjcaelum-oss/twojiteam/blob/main/src/features/plan-storage/localPlan.repository.ts): `src/features/plan-storage/localPlan.repository.ts`
- [Supabase plan storage](https://github.com/mjcaelum-oss/twojiteam/blob/main/src/features/plan-storage/supabasePlan.repository.ts): `src/features/plan-storage/supabasePlan.repository.ts`
- [Browser storage](https://github.com/mjcaelum-oss/twojiteam/blob/main/src/services/storage/localStorage.service.ts): `src/services/storage/localStorage.service.ts`
- [MVP authentication](https://github.com/mjcaelum-oss/twojiteam/blob/main/src/services/supabase/auth.service.ts): `src/services/supabase/auth.service.ts`

### Saved travel

- [Saved courses](https://github.com/mjcaelum-oss/twojiteam/blob/main/src/features/saved-courses/savedCourses.store.ts): `src/features/saved-courses/savedCourses.store.ts`
- [Course detail](https://github.com/mjcaelum-oss/twojiteam/blob/main/src/pages/CourseDetailPage/CourseDetailPage.tsx): `src/pages/CourseDetailPage/CourseDetailPage.tsx`
- [My page](https://github.com/mjcaelum-oss/twojiteam/blob/main/src/pages/MyPage/MyPage.tsx): `src/pages/MyPage/MyPage.tsx`

### Other components

- **Traveler**

## Connections

- Traveler → Search inputs: enters conditions (evidence: `src/pages/SearchPage/SearchPage.tsx`)
- Search inputs → Destination search: uses (evidence: `src/pages/SearchPage/SearchPage.tsx`)
- Search inputs → Travel preferences: uses (evidence: `src/pages/SearchPage/SearchPage.tsx`)
- Traveler → Recommendations: requests picks (evidence: `src/pages/RecommendationPage/RecommendationPage.tsx`)
- Recommendations → Candidate collection: requests candidates (evidence: `src/pages/RecommendationPage/RecommendationPage.tsx`)
- Candidate collection → Google Places: queries places (evidence: `src/features/recommendations/recommendation.service.ts`)
- Recommendations → OpenAI client: requests recommendations (evidence: `src/pages/RecommendationPage/RecommendationPage.tsx`)
- OpenAI client → Recommendation API: posts request (evidence: `src/services/openai/openaiRecommendation.service.ts`)
- Recommendation API → OpenAI: requests generation (evidence: `api/recommendations.js`)
- Traveler → Plan review: edits itinerary (evidence: `src/pages/ReviewPage/ReviewPage.tsx`)
- Plan review → Active travel plan: updates plan (evidence: `src/pages/ReviewPage/ReviewPage.tsx`)
- Plan review → Schedule validation: validates schedule (evidence: `src/pages/ReviewPage/ReviewPage.tsx`)
- Plan review → Route estimates: requests routes (evidence: `src/pages/ReviewPage/ReviewPage.tsx`)
- Route estimates → Route cost: estimates cost (evidence: `src/features/routes/route.service.ts`)
- Route estimates → Google Maps: requests directions (evidence: `src/features/routes/route.service.ts`)
- Plan review → Map display: renders itinerary (evidence: `src/pages/ReviewPage/ReviewPage.tsx`)
- Plan review → Active travel plan: saves plan (evidence: `src/pages/ReviewPage/ReviewPage.tsx`)
- Active travel plan → Plan repository: delegates save (evidence: `src/app/providers/TravelPlanProvider.tsx`)
- Plan repository → Local plan storage: implements
- Plan repository → Supabase plan storage: implements (evidence: `src/features/plan-storage/supabasePlan.repository.ts`)
- Local plan storage → Browser storage: persists locally (evidence: `README.md`)
- Supabase plan storage → Supabase: reads and writes (evidence: `src/features/plan-storage/supabasePlan.repository.ts`)
- Traveler → MVP authentication: signs in (evidence: `README.md`)
- MVP authentication → Supabase: calls RPC (evidence: `src/services/supabase/auth.service.ts`)
- MVP authentication → Browser storage: stores session (evidence: `src/services/supabase/auth.service.ts`)
- Traveler → Saved courses: saves course
- Saved courses → Course detail: provides course (evidence: `src/pages/CourseDetailPage/CourseDetailPage.tsx`)
- Saved courses → My page: provides courses (evidence: `src/pages/MyPage/MyPage.tsx`)
