# sithilsemitha/deathbed-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/sithilsemitha/deathbed-frontend
- Repository: https://github.com/sithilsemitha/deathbed-frontend

## Overview

This is a React decision-reflection app, not the generic Vite template its README describes. Users authenticate, provide consent and profile details, then enter decisions and can explore bias checks, regret ratings, matched profiles, and reflection journals. The dashboard presents saved activity; similar stories and follow-up preferences are additional features. Some API and storage behavior is visible, but many route implementations are unsampled, so their internal calls and transitions are not inferred.

Main entry points: [`src/App.tsx`](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/App.tsx) (Application router), [`src/components/auth/OnboardingWizard.tsx`](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/components/auth/OnboardingWizard.tsx) (Consent and profile), [`src/routes/DashboardRoute.tsx`](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/DashboardRoute.tsx) (Dashboard), [`src/routes/MatchedProfilesRoute.tsx`](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/MatchedProfilesRoute.tsx) (Profile matching)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and access"]
  node_app["Application router<br/>[App.tsx]"]
end

subgraph group_identity["Identity and onboarding"]
  node_login["Login<br/>[LoginRoute.tsx]"]
  node_signup["Sign up<br/>[SignUpRoute.tsx]"]
  node_callback["Auth callback"]
  node_auth["Session storage<br/>[auth.ts]"]
  node_onboarding["Consent and profile"]
  node_profile["Profile form"]
  node_datausage["Data usage<br/>[DataUsageRoute.tsx]"]
end

subgraph group_decisions["Decision tools"]
  node_decision["Decision input"]
  node_dashboard["Dashboard<br/>[DashboardRoute.tsx]"]
  node_bias["Bias check<br/>[BiasCheckRoute.tsx]"]
  node_regret["Regret rating"]
  node_matches["Profile matching"]
  node_comparison["Outcome comparison"]
end

subgraph group_reflection["Reflection and history"]
  node_followup["Follow-up preferences"]
  node_history["Journal history"]
  node_detail["Journal detail"]
  node_stories["Similar stories"]
  node_ratelimit["Rate limit notice"]
end

subgraph group_services["API and data"]
  node_matchdata["Match data and filters<br/>[matches.ts]"]
  node_journals["Journal data<br/>[journals.ts]"]
  node_accountdata["Dashboard data<br/>[accountData.ts]"]
  node_api["API client<br/>[api.ts]"]
end

node_user(("User"))
node_backend{{"Application API"}}

node_user -->|"uses"| node_app
node_app -->|"checks session"| node_auth
node_app -->|"routes"| node_login
node_app -->|"routes"| node_signup
node_app -->|"routes"| node_callback
node_app -->|"routes"| node_onboarding
node_app -->|"routes"| node_decision
node_app -->|"routes"| node_dashboard
node_app -->|"routes"| node_bias
node_app -->|"routes"| node_regret
node_app -->|"routes"| node_matches
node_app -->|"routes"| node_datausage
node_app -->|"routes"| node_followup
node_app -->|"routes"| node_history
node_app -->|"routes"| node_detail
node_app -->|"routes"| node_stories
node_onboarding -->|"renders"| node_profile
node_onboarding -->|"loads and saves profile"| node_api
node_callback -->|"clears session"| node_auth
node_dashboard -->|"loads and saves"| node_accountdata
node_dashboard -->|"clears session"| node_auth
node_matches -->|"renders"| node_comparison
node_matches -->|"uses match data"| node_matchdata
node_history -->|"reads journal data"| node_journals
node_detail -->|"reads journal data"| node_journals
node_bias -->|"renders"| node_ratelimit
node_stories -->|"renders"| node_ratelimit
node_api -->|"sends HTTP requests"| node_backend

click node_app "https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/App.tsx"
click node_login "https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/LoginRoute.tsx"
click node_signup "https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/SignUpRoute.tsx"
click node_callback "https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/AuthCallbackRoute.tsx"
click node_auth "https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/lib/auth.ts"
click node_onboarding "https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/components/auth/OnboardingWizard.tsx"
click node_profile "https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/components/auth/ProfileSetupForm.tsx"
click node_decision "https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/DecisionInputRoute.tsx"
click node_dashboard "https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/DashboardRoute.tsx"
click node_bias "https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/BiasCheckRoute.tsx"
click node_regret "https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/RegretRatingRoute.tsx"
click node_matches "https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/MatchedProfilesRoute.tsx"
click node_comparison "https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/components/matching/FinancialComparisonSection.tsx"
click node_matchdata "https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/lib/matches.ts"
click node_datausage "https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/DataUsageRoute.tsx"
click node_followup "https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/FollowUpPreferenceRoute.tsx"
click node_history "https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/JournalHistoryRoute.tsx"
click node_detail "https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/JournalDetailRoute.tsx"
click node_journals "https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/lib/journals.ts"
click node_stories "https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/SimilarStoriesRoute.tsx"
click node_ratelimit "https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/components/shared/RateLimitNotice.tsx"
click node_accountdata "https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/lib/accountData.ts"
click node_api "https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/lib/api.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_app,node_user toneBlue
class node_login,node_signup,node_callback,node_auth,node_onboarding,node_profile,node_datausage toneAmber
class node_decision,node_dashboard,node_bias,node_regret,node_matches,node_comparison,node_backend toneMint
class node_followup,node_history,node_detail,node_stories,node_ratelimit toneRose
class node_matchdata,node_journals,node_accountdata,node_api toneIndigo
```

## Components

### App and access

- [Application router](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/App.tsx): `src/App.tsx`

### Identity and onboarding

- [Login](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/LoginRoute.tsx): `src/routes/LoginRoute.tsx`
- [Sign up](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/SignUpRoute.tsx): `src/routes/SignUpRoute.tsx`
- [Auth callback](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/AuthCallbackRoute.tsx): `src/routes/AuthCallbackRoute.tsx`
- [Session storage](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [Consent and profile](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/components/auth/OnboardingWizard.tsx): `src/components/auth/OnboardingWizard.tsx`
- [Profile form](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/components/auth/ProfileSetupForm.tsx): `src/components/auth/ProfileSetupForm.tsx`
- [Data usage](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/DataUsageRoute.tsx): `src/routes/DataUsageRoute.tsx`

### Decision tools

- [Decision input](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/DecisionInputRoute.tsx): `src/routes/DecisionInputRoute.tsx`
- [Dashboard](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/DashboardRoute.tsx): `src/routes/DashboardRoute.tsx`
- [Bias check](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/BiasCheckRoute.tsx): `src/routes/BiasCheckRoute.tsx`
- [Regret rating](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/RegretRatingRoute.tsx): `src/routes/RegretRatingRoute.tsx`
- [Profile matching](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/MatchedProfilesRoute.tsx): `src/routes/MatchedProfilesRoute.tsx`
- [Outcome comparison](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/components/matching/FinancialComparisonSection.tsx): `src/components/matching/FinancialComparisonSection.tsx`

### Reflection and history

- [Follow-up preferences](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/FollowUpPreferenceRoute.tsx): `src/routes/FollowUpPreferenceRoute.tsx`
- [Journal history](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/JournalHistoryRoute.tsx): `src/routes/JournalHistoryRoute.tsx`
- [Journal detail](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/JournalDetailRoute.tsx): `src/routes/JournalDetailRoute.tsx`
- [Similar stories](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/routes/SimilarStoriesRoute.tsx): `src/routes/SimilarStoriesRoute.tsx`
- [Rate limit notice](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/components/shared/RateLimitNotice.tsx): `src/components/shared/RateLimitNotice.tsx`

### API and data

- [Match data and filters](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/lib/matches.ts): `src/lib/matches.ts`
- [Journal data](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/lib/journals.ts): `src/lib/journals.ts`
- [Dashboard data](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/lib/accountData.ts): `src/lib/accountData.ts`
- [API client](https://github.com/sithilsemitha/deathbed-frontend/blob/main/src/lib/api.ts): `src/lib/api.ts`

### Other components

- **User**
- **Application API**

## Connections

- User → Application router: uses
- Application router → Session storage: checks session (evidence: `src/App.tsx`)
- Application router → Login: routes (evidence: `src/App.tsx`)
- Application router → Sign up: routes (evidence: `src/App.tsx`)
- Application router → Auth callback: routes (evidence: `src/App.tsx`)
- Application router → Consent and profile: routes (evidence: `src/App.tsx`)
- Application router → Decision input: routes (evidence: `src/App.tsx`)
- Application router → Dashboard: routes (evidence: `src/App.tsx`)
- Application router → Bias check: routes (evidence: `src/App.tsx`)
- Application router → Regret rating: routes (evidence: `src/App.tsx`)
- Application router → Profile matching: routes (evidence: `src/App.tsx`)
- Application router → Data usage: routes (evidence: `src/App.tsx`)
- Application router → Follow-up preferences: routes (evidence: `src/App.tsx`)
- Application router → Journal history: routes (evidence: `src/App.tsx`)
- Application router → Journal detail: routes (evidence: `src/App.tsx`)
- Application router → Similar stories: routes (evidence: `src/App.tsx`)
- Consent and profile → Profile form: renders (evidence: `src/components/auth/OnboardingWizard.tsx`)
- Consent and profile → API client: loads and saves profile (evidence: `src/components/auth/OnboardingWizard.tsx`)
- Auth callback → Session storage: clears session (evidence: `src/routes/AuthCallbackRoute.tsx`)
- Dashboard → Dashboard data: loads and saves (evidence: `src/routes/DashboardRoute.tsx`)
- Dashboard → Session storage: clears session (evidence: `src/routes/DashboardRoute.tsx`)
- Profile matching → Outcome comparison: renders (evidence: `src/routes/MatchedProfilesRoute.tsx`)
- Profile matching → Match data and filters: uses match data (evidence: `src/routes/MatchedProfilesRoute.tsx`)
- Journal history → Journal data: reads journal data (evidence: `src/routes/JournalHistoryRoute.tsx`)
- Journal detail → Journal data: reads journal data (evidence: `src/routes/JournalDetailRoute.tsx`)
- Bias check → Rate limit notice: renders (evidence: `src/routes/BiasCheckRoute.tsx`)
- Similar stories → Rate limit notice: renders (evidence: `src/routes/SimilarStoriesRoute.tsx`)
- API client → Application API: sends HTTP requests (evidence: `src/lib/api.ts`)
