# bisensagar/expnslptr architecture

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

- Interactive diagram: https://gitdiagram.com/bisensagar/expnslptr
- Repository: https://github.com/bisensagar/expnslptr

## Overview

expnspltr is a shared-trip expense-splitting app with admin and regular-user views. Users sign in, then role-based routing takes admins to trip and account management or regular users to their assigned trips. Admins create trips, add members and expenses, and can settle a trip; both views show expense shares and settlement breakdowns. The sampled detail pages call the settlement algorithm and query Supabase directly. Edges reflect shown calls or README-documented behavior; unsampled page internals are not inferred.

Main entry points: [`src/App.jsx`](https://github.com/bisensagar/expnslptr/blob/main/src/App.jsx) (Routes and guards), [`src/context/AuthContext.jsx`](https://github.com/bisensagar/expnslptr/blob/main/src/context/AuthContext.jsx) (Session and profile), [`src/pages/UserTripDetail.jsx`](https://github.com/bisensagar/expnslptr/blob/main/src/pages/UserTripDetail.jsx) (Trip overview), [`src/lib/supabase.js`](https://github.com/bisensagar/expnslptr/blob/main/src/lib/supabase.js) (Supabase client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_routing["App and access"]
  node_app["Routes and guards<br/>[App.jsx]"]
  node_login["Sign in<br/>[LoginPage.jsx]"]
  node_auth["Session and profile<br/>[AuthContext.jsx]"]
end

subgraph group_admin["Admin management"]
  node_adminlayout["Admin shell<br/>[AdminLayout.jsx]"]
  node_dashboard["Trips and users<br/>[Dashboard.jsx]"]
  node_tripadmin["Trip management<br/>[TripDetail.jsx]"]
end

subgraph group_user["Member experience"]
  node_usertrips["Assigned trips<br/>[UserTrips.jsx]"]
  node_userdetail["Trip overview<br/>[UserTripDetail.jsx]"]
end

subgraph group_backend["Services and calculations"]
  node_settlement["Settlement algorithm<br/>[settlement.js]"]
  node_client["Supabase client<br/>[supabase.js]"]
  node_supabaseauth["Supabase Auth"]
  node_database[("Supabase database")]
end

node_actor(("Trip participants"))

node_actor -->|"signs in"| node_login
node_app -->|"provides auth"| node_auth
node_app -->|"routes to"| node_login
node_app -->|"guards admin"| node_adminlayout
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_tripadmin
node_app -->|"routes to"| node_usertrips
node_app -->|"routes to"| node_userdetail
node_login -->|"signs in via"| node_auth
node_auth -->|"checks session"| node_client
node_adminlayout -->|"reads profile"| node_auth
node_adminlayout -->|"offers sign-out"| node_actor
node_dashboard -->|"queries data"| node_client
node_dashboard -->|"manages trips and users"| node_database
node_dashboard -->|"creates accounts"| node_supabaseauth
node_tripadmin -->|"queries data"| node_client
node_tripadmin -->|"manages trip records"| node_database
node_tripadmin -->|"calculates settlement"| node_settlement
node_usertrips -->|"reads profile"| node_auth
node_usertrips -->|"loads assigned trips"| node_client
node_usertrips -->|"queries memberships"| node_database
node_userdetail -->|"reads profile"| node_auth
node_userdetail -->|"loads trip data"| node_client
node_userdetail -->|"queries trip records"| node_database
node_userdetail -->|"calculates settlement"| node_settlement
node_supabaseauth -.->|"stores profiles"| node_database

click node_app "https://github.com/bisensagar/expnslptr/blob/main/src/App.jsx"
click node_login "https://github.com/bisensagar/expnslptr/blob/main/src/pages/LoginPage.jsx"
click node_auth "https://github.com/bisensagar/expnslptr/blob/main/src/context/AuthContext.jsx"
click node_adminlayout "https://github.com/bisensagar/expnslptr/blob/main/src/pages/AdminLayout.jsx"
click node_dashboard "https://github.com/bisensagar/expnslptr/blob/main/src/pages/Dashboard.jsx"
click node_tripadmin "https://github.com/bisensagar/expnslptr/blob/main/src/pages/TripDetail.jsx"
click node_usertrips "https://github.com/bisensagar/expnslptr/blob/main/src/pages/UserTrips.jsx"
click node_userdetail "https://github.com/bisensagar/expnslptr/blob/main/src/pages/UserTripDetail.jsx"
click node_settlement "https://github.com/bisensagar/expnslptr/blob/main/src/lib/settlement.js"
click node_client "https://github.com/bisensagar/expnslptr/blob/main/src/lib/supabase.js"
click node_database "https://github.com/bisensagar/expnslptr/blob/main/supabase_schema.sql"

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_login,node_auth toneBlue
class node_adminlayout,node_dashboard,node_tripadmin toneAmber
class node_usertrips,node_userdetail toneMint
class node_settlement,node_client,node_supabaseauth,node_database toneRose
class node_actor toneIndigo
```

## Components

### App and access

- [Routes and guards](https://github.com/bisensagar/expnslptr/blob/main/src/App.jsx): `src/App.jsx`
- [Sign in](https://github.com/bisensagar/expnslptr/blob/main/src/pages/LoginPage.jsx): `src/pages/LoginPage.jsx`
- [Session and profile](https://github.com/bisensagar/expnslptr/blob/main/src/context/AuthContext.jsx): `src/context/AuthContext.jsx`

### Admin management

- [Admin shell](https://github.com/bisensagar/expnslptr/blob/main/src/pages/AdminLayout.jsx): `src/pages/AdminLayout.jsx`
- [Trips and users](https://github.com/bisensagar/expnslptr/blob/main/src/pages/Dashboard.jsx): `src/pages/Dashboard.jsx`
- [Trip management](https://github.com/bisensagar/expnslptr/blob/main/src/pages/TripDetail.jsx): `src/pages/TripDetail.jsx`

### Member experience

- [Assigned trips](https://github.com/bisensagar/expnslptr/blob/main/src/pages/UserTrips.jsx): `src/pages/UserTrips.jsx`
- [Trip overview](https://github.com/bisensagar/expnslptr/blob/main/src/pages/UserTripDetail.jsx): `src/pages/UserTripDetail.jsx`

### Services and calculations

- [Settlement algorithm](https://github.com/bisensagar/expnslptr/blob/main/src/lib/settlement.js): `src/lib/settlement.js`
- [Supabase client](https://github.com/bisensagar/expnslptr/blob/main/src/lib/supabase.js): `src/lib/supabase.js`
- **Supabase Auth**
- [Supabase database](https://github.com/bisensagar/expnslptr/blob/main/supabase_schema.sql): `supabase_schema.sql`

### Other components

- **Trip participants**

## Connections

- Trip participants → Sign in: signs in (evidence: `README.md`)
- Routes and guards → Session and profile: provides auth (evidence: `src/App.jsx`)
- Routes and guards → Sign in: routes to (evidence: `src/App.jsx`)
- Routes and guards → Admin shell: guards admin (evidence: `src/App.jsx`)
- Routes and guards → Trips and users: routes to (evidence: `src/App.jsx`)
- Routes and guards → Trip management: routes to (evidence: `src/App.jsx`)
- Routes and guards → Assigned trips: routes to (evidence: `src/App.jsx`)
- Routes and guards → Trip overview: routes to (evidence: `src/App.jsx`)
- Sign in → Session and profile: signs in via (evidence: `src/pages/LoginPage.jsx`)
- Session and profile → Supabase client: checks session (evidence: `src/context/AuthContext.jsx`)
- Admin shell → Session and profile: reads profile (evidence: `src/pages/AdminLayout.jsx`)
- Admin shell → Trip participants: offers sign-out (evidence: `README.md`)
- Trips and users → Supabase client: queries data (evidence: `src/pages/Dashboard.jsx`)
- Trips and users → Supabase database: manages trips and users (evidence: `src/pages/Dashboard.jsx`)
- Trips and users → Supabase Auth: creates accounts (evidence: `src/pages/Dashboard.jsx`)
- Trip management → Supabase client: queries data (evidence: `src/pages/TripDetail.jsx`)
- Trip management → Supabase database: manages trip records (evidence: `src/pages/TripDetail.jsx`)
- Trip management → Settlement algorithm: calculates settlement (evidence: `src/pages/TripDetail.jsx`)
- Assigned trips → Session and profile: reads profile (evidence: `src/pages/UserTrips.jsx`)
- Assigned trips → Supabase client: loads assigned trips (evidence: `src/pages/UserTrips.jsx`)
- Assigned trips → Supabase database: queries memberships (evidence: `src/pages/UserTrips.jsx`)
- Trip overview → Session and profile: reads profile (evidence: `src/pages/UserTripDetail.jsx`)
- Trip overview → Supabase client: loads trip data (evidence: `src/pages/UserTripDetail.jsx`)
- Trip overview → Supabase database: queries trip records (evidence: `src/pages/UserTripDetail.jsx`)
- Trip overview → Settlement algorithm: calculates settlement (evidence: `src/pages/UserTripDetail.jsx`)
- Supabase Auth → Supabase database: stores profiles (evidence: `README.md`)
