# xchange-taiwan/x-talent-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/xchange-taiwan/x-talent-frontend
- Repository: https://github.com/xchange-taiwan/x-talent-frontend

## Overview

X-Talent is a mentor–mentee platform. A typical journey is to authenticate, complete a profile, discover mentors, then arrange a reservation and exchange feedback after a meeting; favorites provide a separate way to save mentors. The graph preserves these documented product stages and the shared API/auth layers. Several feature implementations were not excerpted, so their connections are limited to relationships named in the SOURCE INDEX; the external backend is shown where sampled service code makes API requests.

Main entry points: [`src/app/auth/(sign)/onboarding/page.tsx`](https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/app/auth/(sign)/onboarding/page.tsx) (Auth flows), [`src/lib/auth/sessionLifecycle.ts`](https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/lib/auth/sessionLifecycle.ts) (Auth lifecycle), [`src/services/reservations/reservationService.ts`](https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/services/reservations/reservationService.ts) (Reservations), [`src/services/search-mentor/mentors.ts`](https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/services/search-mentor/mentors.ts) (Mentor search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and identity"]
  node_landing["Landing site<br/>[page.tsx]"]
  node_authui["Auth flows<br/>[page.tsx]"]
  node_authlifecycle["Auth lifecycle"]
  node_authserver["Session bridge"]
  node_authservice["Auth service<br/>[authClient.ts]"]
end

subgraph group_profiles["Profiles and discovery"]
  node_profile["Profile pages<br/>[container.tsx]"]
  node_profileedit["Profile editor"]
  node_mentorsearch["Mentor search<br/>[mentors.ts]"]
  node_mentorquery["Search query<br/>[mentorPoolQuery.ts]"]
  node_mentorpool["Mentor pool<br/>[container.tsx]"]
end

subgraph group_engagement["Mentor engagement"]
  node_favorites["Saved mentors<br/>[favoriteMentors.ts]"]
  node_booking["Booking experience"]
  node_schedule["Mentor schedule<br/>[schedule.ts]"]
  node_reservations["Reservations"]
  node_reservationui["Reservation dashboard"]
  node_messages["Conversation view"]
  node_feedback["Meeting feedback"]
end

subgraph group_platform["Shared platform"]
  node_apiclient["API client<br/>[apiClient.ts]"]
  node_analytics["Analytics<br/>[analytics.ts]"]
end

node_visitor(("User"))
node_backend{{"Backend API"}}

node_visitor -->|"visits"| node_landing
node_visitor -->|"authenticates"| node_authui
node_landing -.->|"finds mentors"| node_mentorpool
node_authui -.->|"runs auth flow"| node_authlifecycle
node_authlifecycle -->|"exchanges OAuth"| node_authserver
node_authui -.->|"uses auth APIs"| node_authservice
node_authservice -->|"sends requests"| node_apiclient
node_authserver -->|"calls auth endpoints"| node_backend
node_profile -.->|"opens editor"| node_profileedit
node_profileedit -.->|"saves profile"| node_visitor
node_visitor -.->|"searches mentors"| node_mentorsearch
node_mentorsearch -.->|"builds query"| node_mentorquery
node_mentorpool -.->|"loads results"| node_mentorsearch
node_visitor -.->|"saves mentors"| node_favorites
node_visitor -.->|"requests booking"| node_booking
node_booking -.->|"uses availability"| node_schedule
node_reservations -->|"sends requests"| node_apiclient
node_reservationui -.->|"shows reservations"| node_reservations
node_reservationui -->|"opens conversation"| node_messages
node_reservations -->|"provides messages"| node_messages
node_visitor -.->|"submits feedback"| node_feedback
node_apiclient -->|"makes API calls"| node_backend
node_authlifecycle -->|"tracks identity"| node_analytics

click node_landing "https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/app/(landing)/page.tsx"
click node_authui "https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/app/auth/(sign)/onboarding/page.tsx"
click node_authlifecycle "https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/lib/auth/sessionLifecycle.ts"
click node_authserver "https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/lib/auth/bffSession.server.ts"
click node_authservice "https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/services/auth/authClient.ts"
click node_profile "https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/app/profile/%5BpageUserId%5D/container.tsx"
click node_profileedit "https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/hooks/user/profile/useProfileEditorSession.ts"
click node_mentorsearch "https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/services/search-mentor/mentors.ts"
click node_mentorquery "https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/lib/mentor/mentorPoolQuery.ts"
click node_mentorpool "https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/app/mentor-pool/container.tsx"
click node_favorites "https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/services/favorites/favoriteMentors.ts"
click node_booking "https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/components/profile/reservation/MenteeBookingForm.tsx"
click node_schedule "https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/services/mentor-schedule/schedule.ts"
click node_reservations "https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/services/reservations/reservationService.ts"
click node_reservationui "https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/components/reservation/ReservationDashboard.tsx"
click node_messages "https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/components/reservation/ReservationConversationDialog.tsx"
click node_feedback "https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/hooks/user/reservation/useMeetingFeedbackForm.ts"
click node_apiclient "https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/lib/apiClient.ts"
click node_analytics "https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/lib/analytics.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_landing,node_authui,node_authlifecycle,node_authserver,node_authservice,node_visitor toneBlue
class node_profile,node_profileedit,node_mentorsearch,node_mentorquery,node_mentorpool toneAmber
class node_favorites,node_booking,node_schedule,node_reservations,node_reservationui,node_messages,node_feedback,node_backend toneMint
class node_apiclient,node_analytics toneRose
```

## Components

### Entry and identity

- [Landing site](https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/app/(landing)/page.tsx): `src/app/(landing)/page.tsx`
- [Auth flows](https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/app/auth/(sign)/onboarding/page.tsx): `src/app/auth/(sign)/onboarding/page.tsx`
- [Auth lifecycle](https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/lib/auth/sessionLifecycle.ts): `src/lib/auth/sessionLifecycle.ts`
- [Session bridge](https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/lib/auth/bffSession.server.ts): `src/lib/auth/bffSession.server.ts`
- [Auth service](https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/services/auth/authClient.ts): `src/services/auth/authClient.ts`

### Profiles and discovery

- [Profile pages](https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/app/profile/%5BpageUserId%5D/container.tsx): `src/app/profile/[pageUserId]/container.tsx`
- [Profile editor](https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/hooks/user/profile/useProfileEditorSession.ts): `src/hooks/user/profile/useProfileEditorSession.ts`
- [Mentor search](https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/services/search-mentor/mentors.ts): `src/services/search-mentor/mentors.ts`
- [Search query](https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/lib/mentor/mentorPoolQuery.ts): `src/lib/mentor/mentorPoolQuery.ts`
- [Mentor pool](https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/app/mentor-pool/container.tsx): `src/app/mentor-pool/container.tsx`

### Mentor engagement

- [Saved mentors](https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/services/favorites/favoriteMentors.ts): `src/services/favorites/favoriteMentors.ts`
- [Booking experience](https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/components/profile/reservation/MenteeBookingForm.tsx): `src/components/profile/reservation/MenteeBookingForm.tsx`
- [Mentor schedule](https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/services/mentor-schedule/schedule.ts): `src/services/mentor-schedule/schedule.ts`
- [Reservations](https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/services/reservations/reservationService.ts): `src/services/reservations/reservationService.ts`
- [Reservation dashboard](https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/components/reservation/ReservationDashboard.tsx): `src/components/reservation/ReservationDashboard.tsx`
- [Conversation view](https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/components/reservation/ReservationConversationDialog.tsx): `src/components/reservation/ReservationConversationDialog.tsx`
- [Meeting feedback](https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/hooks/user/reservation/useMeetingFeedbackForm.ts): `src/hooks/user/reservation/useMeetingFeedbackForm.ts`

### Shared platform

- [API client](https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/lib/apiClient.ts): `src/lib/apiClient.ts`
- [Analytics](https://github.com/xchange-taiwan/x-talent-frontend/blob/develop/src/lib/analytics.ts): `src/lib/analytics.ts`

### Other components

- **User**
- **Backend API**

## Connections

- User → Landing site: visits (evidence: `README.md`)
- User → Auth flows: authenticates (evidence: `README.md`)
- Landing site → Mentor pool: finds mentors (evidence: `README.md`)
- Auth flows → Auth lifecycle: runs auth flow
- Auth lifecycle → Session bridge: exchanges OAuth
- Auth flows → Auth service: uses auth APIs
- Auth service → API client: sends requests (evidence: `src/services/auth/authClient.ts`)
- Session bridge → Backend API: calls auth endpoints (evidence: `src/lib/auth/bffSession.server.ts`)
- Profile pages → Profile editor: opens editor (evidence: `src/hooks/user/profile/useProfileEditorSession.ts`)
- Profile editor → User: saves profile (evidence: `src/hooks/user/profile/useProfileEditorSession.ts`)
- User → Mentor search: searches mentors (evidence: `README.md`)
- Mentor search → Search query: builds query (evidence: `src/lib/mentor/mentorPoolQuery.ts`)
- Mentor pool → Mentor search: loads results
- User → Saved mentors: saves mentors (evidence: `README.md`)
- User → Booking experience: requests booking (evidence: `README.md`)
- Booking experience → Mentor schedule: uses availability
- Reservations → API client: sends requests (evidence: `src/services/reservations/reservationService.ts`)
- Reservation dashboard → Reservations: shows reservations
- Reservation dashboard → Conversation view: opens conversation
- Reservations → Conversation view: provides messages (evidence: `src/services/reservations/reservationService.ts`)
- User → Meeting feedback: submits feedback (evidence: `README.md`)
- API client → Backend API: makes API calls (evidence: `src/lib/apiClient.ts`)
- Auth lifecycle → Analytics: tracks identity (evidence: `src/lib/auth/sessionLifecycle.ts`)
