# kpal2207/smart-group-trip-coordination-platform architecture

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

- Interactive diagram: https://gitdiagram.com/kpal2207/smart-group-trip-coordination-platform
- Repository: https://github.com/kpal2207/smart-group-trip-coordination-platform

## Overview

Smart Group Trip Coordination is a React/FastAPI application for authenticated trip planning, shared expense tracking, dispute resolution, and settling group balances. Members register or sign in, create or join a trip, add expenses with equal or custom splits, review the ledger, and accept or dispute shares; hosts can review disputes, and members record settlements. The README also documents in-app notifications and automatic trip completion when balances clear. The graph follows shown frontend routing and sampled calls; backend request-to-service links not visible in excerpts are marked unverified or omitted.

Main entry points: [`frontend/src/App.jsx`](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/frontend/src/App.jsx) (React routes), [`backend/app/services/expense.py`](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/services/expense.py) (Expense operations), [`frontend/src/pages/ExpenseDashboard.jsx`](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/frontend/src/pages/ExpenseDashboard.jsx) (Ledger dashboard), [`frontend/src/api/expense.js`](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/frontend/src/api/expense.js) (Expense HTTP client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["React routes<br/>[App.jsx]"]
  node_auth_context["Session context<br/>[AuthContext.jsx]"]
  node_auth_api["Auth HTTP client<br/>[auth.js]"]
  node_trip_pages["Trip screens"]
  node_trip_api["Trip HTTP client<br/>[trip.js]"]
  node_expense_entry["Expense entry<br/>[AddExpense.jsx]"]
  node_expense_dashboard["Ledger dashboard"]
  node_expense_api["Expense HTTP client<br/>[expense.js]"]
  node_dispute_ui["Dispute review UI<br/>[DisputeModal.jsx]"]
  node_settlement_ui["Settlement UI<br/>[SettleUpModal.jsx]"]
  node_notification_ui["Notification center"]
end

subgraph group_api["API application"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_auth_router["Authentication endpoints<br/>[auth.py]"]
  node_trip_router["Trip endpoints<br/>[trip.py]"]
  node_expense_router["Expense endpoints<br/>[expense.py]"]
  node_auth_guard["JWT user lookup<br/>[auth.py]"]
end

subgraph group_domain["Trip and expense domain"]
  node_trip_service["Trip operations<br/>[trip.py]"]
  node_expense_service["Expense operations<br/>[expense.py]"]
  node_schemas["Request and response schemas<br/>[expense.py]"]
end

subgraph group_persistence["Persistence and identity"]
  node_auth_service["Auth utilities<br/>[auth.py]"]
  node_trip_model[("Trip records<br/>[trip.py]")]
  node_expense_model[("Ledger records<br/>[expense.py]")]
  node_user_model[("User records<br/>[user.py]")]
  node_db[("SQLAlchemy database<br/>[database.py]")]
end

node_member(("Trip member"))

node_member -->|"uses"| node_app
node_app -->|"provides session"| node_auth_context
node_app -->|"routes to"| node_trip_pages
node_app -->|"routes to"| node_expense_entry
node_app -->|"routes to"| node_expense_dashboard
node_auth_context -->|"calls"| node_auth_api
node_expense_entry -->|"loads and submits"| node_expense_api
node_expense_dashboard -->|"loads and acts"| node_expense_api
node_expense_dashboard -->|"opens"| node_dispute_ui
node_expense_dashboard -->|"opens"| node_settlement_ui
node_trip_pages -->|"requests trips"| node_trip_api
node_auth_api -->|"HTTP auth"| node_auth_router
node_trip_api -->|"HTTP trips"| node_trip_router
node_expense_api -->|"HTTP expenses"| node_expense_router
node_notification_ui -.->|"notification requests"| node_expense_api
node_api_app -->|"registers"| node_auth_router
node_api_app -->|"registers"| node_trip_router
node_api_app -->|"registers"| node_expense_router
node_auth_guard -->|"decodes token"| node_auth_service
node_auth_guard -->|"gets session"| node_db
node_auth_guard -->|"looks up user"| node_user_model
node_expense_service -->|"uses records"| node_expense_model
node_expense_service -->|"uses trip records"| node_trip_model
node_expense_service -->|"uses users"| node_user_model
node_expense_service -->|"uses schemas"| node_schemas
node_trip_model -->|"inherits base"| node_db
node_expense_model -->|"inherits base"| node_db
node_auth_router -.->|"uses auth"| node_auth_service
node_trip_router -.->|"delegates trip work"| node_trip_service
node_expense_router -.->|"delegates expense work"| node_expense_service

click node_app "https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/frontend/src/App.jsx"
click node_auth_context "https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/frontend/src/context/AuthContext.jsx"
click node_auth_api "https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/frontend/src/api/auth.js"
click node_trip_pages "https://github.com/kpal2207/smart-group-trip-coordination-platform/tree/main/frontend/src/pages"
click node_trip_api "https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/frontend/src/api/trip.js"
click node_expense_entry "https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/frontend/src/pages/AddExpense.jsx"
click node_expense_dashboard "https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/frontend/src/pages/ExpenseDashboard.jsx"
click node_expense_api "https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/frontend/src/api/expense.js"
click node_dispute_ui "https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/frontend/src/components/DisputeModal.jsx"
click node_settlement_ui "https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/frontend/src/components/SettleUpModal.jsx"
click node_notification_ui "https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/frontend/src/components/NotificationCenter.jsx"
click node_api_app "https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/main.py"
click node_auth_router "https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/routers/auth.py"
click node_trip_router "https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/routers/trip.py"
click node_expense_router "https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/routers/expense.py"
click node_auth_service "https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/services/auth.py"
click node_auth_guard "https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/dependencies/auth.py"
click node_trip_service "https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/services/trip.py"
click node_expense_service "https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/services/expense.py"
click node_schemas "https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/schemas/expense.py"
click node_trip_model "https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/models/trip.py"
click node_expense_model "https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/models/expense.py"
click node_user_model "https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/models/user.py"
click node_db "https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/database.py"

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_context,node_auth_api,node_trip_pages,node_trip_api,node_expense_entry,node_expense_dashboard,node_expense_api,node_dispute_ui,node_settlement_ui,node_notification_ui toneBlue
class node_api_app,node_auth_router,node_trip_router,node_expense_router,node_auth_guard toneAmber
class node_trip_service,node_expense_service,node_schemas toneMint
class node_auth_service,node_trip_model,node_expense_model,node_user_model,node_db toneRose
class node_member toneIndigo
```

## Components

### Web client

- [React routes](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Session context](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Auth HTTP client](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/frontend/src/api/auth.js): `frontend/src/api/auth.js`
- [Trip screens](https://github.com/kpal2207/smart-group-trip-coordination-platform/tree/main/frontend/src/pages): `frontend/src/pages`
- [Trip HTTP client](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/frontend/src/api/trip.js): `frontend/src/api/trip.js`
- [Expense entry](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/frontend/src/pages/AddExpense.jsx): `frontend/src/pages/AddExpense.jsx`
- [Ledger dashboard](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/frontend/src/pages/ExpenseDashboard.jsx): `frontend/src/pages/ExpenseDashboard.jsx`
- [Expense HTTP client](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/frontend/src/api/expense.js): `frontend/src/api/expense.js`
- [Dispute review UI](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/frontend/src/components/DisputeModal.jsx): `frontend/src/components/DisputeModal.jsx`
- [Settlement UI](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/frontend/src/components/SettleUpModal.jsx): `frontend/src/components/SettleUpModal.jsx`
- [Notification center](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/frontend/src/components/NotificationCenter.jsx): `frontend/src/components/NotificationCenter.jsx`

### API application

- [FastAPI application](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication endpoints](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/routers/auth.py): `backend/app/routers/auth.py`
- [Trip endpoints](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/routers/trip.py): `backend/app/routers/trip.py`
- [Expense endpoints](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/routers/expense.py): `backend/app/routers/expense.py`
- [JWT user lookup](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/dependencies/auth.py): `backend/app/dependencies/auth.py`

### Trip and expense domain

- [Trip operations](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/services/trip.py): `backend/app/services/trip.py`
- [Expense operations](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/services/expense.py): `backend/app/services/expense.py`
- [Request and response schemas](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/schemas/expense.py): `backend/app/schemas/expense.py`

### Persistence and identity

- [Auth utilities](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/services/auth.py): `backend/app/services/auth.py`
- [Trip records](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/models/trip.py): `backend/app/models/trip.py`
- [Ledger records](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/models/expense.py): `backend/app/models/expense.py`
- [User records](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/models/user.py): `backend/app/models/user.py`
- [SQLAlchemy database](https://github.com/kpal2207/smart-group-trip-coordination-platform/blob/main/backend/app/database.py): `backend/app/database.py`

### Other components

- **Trip member**

## Connections

- Trip member → React routes: uses
- React routes → Session context: provides session (evidence: `frontend/src/App.jsx`)
- React routes → Trip screens: routes to (evidence: `frontend/src/App.jsx`)
- React routes → Expense entry: routes to (evidence: `frontend/src/App.jsx`)
- React routes → Ledger dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Session context → Auth HTTP client: calls (evidence: `frontend/src/context/AuthContext.jsx`)
- Expense entry → Expense HTTP client: loads and submits (evidence: `frontend/src/pages/AddExpense.jsx`)
- Ledger dashboard → Expense HTTP client: loads and acts (evidence: `frontend/src/pages/ExpenseDashboard.jsx`)
- Ledger dashboard → Dispute review UI: opens (evidence: `frontend/src/pages/ExpenseDashboard.jsx`)
- Ledger dashboard → Settlement UI: opens (evidence: `frontend/src/pages/ExpenseDashboard.jsx`)
- Trip screens → Trip HTTP client: requests trips (evidence: `frontend/src/pages/CreateTrip.jsx`)
- Auth HTTP client → Authentication endpoints: HTTP auth
- Trip HTTP client → Trip endpoints: HTTP trips
- Expense HTTP client → Expense endpoints: HTTP expenses
- Notification center → Expense HTTP client: notification requests
- FastAPI application → Authentication endpoints: registers (evidence: `backend/app/main.py`)
- FastAPI application → Trip endpoints: registers (evidence: `backend/app/main.py`)
- FastAPI application → Expense endpoints: registers (evidence: `backend/app/main.py`)
- JWT user lookup → Auth utilities: decodes token (evidence: `backend/app/dependencies/auth.py`)
- JWT user lookup → SQLAlchemy database: gets session (evidence: `backend/app/dependencies/auth.py`)
- JWT user lookup → User records: looks up user (evidence: `backend/app/dependencies/auth.py`)
- Expense operations → Ledger records: uses records (evidence: `backend/app/services/expense.py`)
- Expense operations → Trip records: uses trip records (evidence: `backend/app/services/expense.py`)
- Expense operations → User records: uses users (evidence: `backend/app/services/expense.py`)
- Expense operations → Request and response schemas: uses schemas (evidence: `backend/app/services/expense.py`)
- Trip records → SQLAlchemy database: inherits base (evidence: `backend/app/models/trip.py`)
- Ledger records → SQLAlchemy database: inherits base (evidence: `backend/app/models/expense.py`)
- Authentication endpoints → Auth utilities: uses auth
- Trip endpoints → Trip operations: delegates trip work
- Expense endpoints → Expense operations: delegates expense work
