# parkavi111/nextstep-wellbeing-compass architecture

> Architecture diagram of the GitHub repository parkavi111/nextstep-wellbeing-compass, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/parkavi111/nextstep-wellbeing-compass
- Repository: https://github.com/parkavi111/nextstep-wellbeing-compass

## Overview

NextStep is a small wellbeing-guidance web app. A visitor answers four one-tap questions and may enter optional, in-memory text; the app checks safety first, then selects a suggested step, requests a short explanation, and presents alternatives and helpfulness feedback. A support screen bypasses recommendations when crisis text or specified severe answers are detected. The README documents Claude-generated explanations; sampled code shows the page calling the server function, but its implementation was not excerpted, so that integration is shown as documented rather than verified in source.

Main entry points: [`src/routes/index.tsx`](https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/routes/index.tsx) (Questionnaire and results), [`src/routeTree.gen.ts`](https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/routeTree.gen.ts) (Route registry), [`src/routes/__root.tsx`](https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/routes/__root.tsx) (Root shell), [`src/server.ts`](https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/server.ts) (SSR error handling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Guidance experience"]
  node_compass["Questionnaire and results<br/>[index.tsx]"]
  node_support["Human support screen<br/>[index.tsx]"]
  node_feedback["Alternatives and feedback<br/>[index.tsx]"]
end

subgraph group_decision["Recommendation logic"]
  node_safety["Safety screening<br/>[nextstep.ts]"]
  node_step["Step selection<br/>[nextstep.ts]"]
  node_why["Why explanation<br/>[why.functions.ts]"]
end

subgraph group_platform["App platform"]
  node_router["Router setup<br/>[router.tsx]"]
  node_routes["Route registry<br/>[routeTree.gen.ts]"]
  node_root["Root shell<br/>[__root.tsx]"]
  node_server["SSR error handling<br/>[server.ts]"]
  node_errorcapture["Error capture<br/>[error-capture.ts]"]
  node_errorpage["Error page renderer<br/>[error-page.ts]"]
  node_lovable["Lovable error reporting"]
end

subgraph group_components["UI components"]
  node_ui["UI primitives"]
  node_sidebar["Responsive sidebar<br/>[sidebar.tsx]"]
  node_mobile["Mobile breakpoint hook<br/>[use-mobile.tsx]"]
end

node_visitor(("Visitor"))
node_claude{{"Claude API"}}

node_visitor -->|"opens app"| node_router
node_router -->|"uses registry"| node_routes
node_routes -->|"registers root"| node_root
node_routes -->|"registers page"| node_compass
node_root -->|"renders route"| node_compass
node_visitor -->|"answers questions"| node_compass
node_compass -->|"checks support need"| node_safety
node_compass -->|"shows support screen"| node_support
node_compass -->|"selects suggestion"| node_step
node_compass -->|"requests explanation"| node_why
node_why -.->|"generates explanation"| node_claude
node_compass -->|"shows results"| node_feedback
node_sidebar -->|"checks breakpoint"| node_mobile
node_sidebar -->|"renders primitives"| node_ui
node_server -->|"consumes captured error"| node_errorcapture
node_server -->|"renders failure page"| node_errorpage
node_root -->|"reports boundary errors"| node_lovable

click node_router "https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/router.tsx"
click node_routes "https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/routeTree.gen.ts"
click node_root "https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/routes/__root.tsx"
click node_compass "https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/routes/index.tsx"
click node_safety "https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/lib/nextstep.ts"
click node_step "https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/lib/nextstep.ts"
click node_why "https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/lib/why.functions.ts"
click node_support "https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/routes/index.tsx"
click node_feedback "https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/routes/index.tsx"
click node_ui "https://github.com/parkavi111/nextstep-wellbeing-compass/tree/main/src/components/ui"
click node_sidebar "https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/components/ui/sidebar.tsx"
click node_mobile "https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/hooks/use-mobile.tsx"
click node_server "https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/server.ts"
click node_errorcapture "https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/lib/error-capture.ts"
click node_errorpage "https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/lib/error-page.ts"
click node_lovable "https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/lib/lovable-error-reporting.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_compass,node_support,node_feedback toneBlue
class node_safety,node_step,node_why toneAmber
class node_router,node_routes,node_root,node_server,node_errorcapture,node_errorpage,node_lovable,node_claude toneMint
class node_ui,node_sidebar,node_mobile toneRose
class node_visitor toneIndigo
```

## Components

### Guidance experience

- [Questionnaire and results](https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/routes/index.tsx): `src/routes/index.tsx`
- [Human support screen](https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/routes/index.tsx): `src/routes/index.tsx`
- [Alternatives and feedback](https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/routes/index.tsx): `src/routes/index.tsx`

### Recommendation logic

- [Safety screening](https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/lib/nextstep.ts): `src/lib/nextstep.ts`
- [Step selection](https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/lib/nextstep.ts): `src/lib/nextstep.ts`
- [Why explanation](https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/lib/why.functions.ts): `src/lib/why.functions.ts`

### App platform

- [Router setup](https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/router.tsx): `src/router.tsx`
- [Route registry](https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/routeTree.gen.ts): `src/routeTree.gen.ts`
- [Root shell](https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/routes/__root.tsx): `src/routes/__root.tsx`
- [SSR error handling](https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/server.ts): `src/server.ts`
- [Error capture](https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/lib/error-capture.ts): `src/lib/error-capture.ts`
- [Error page renderer](https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/lib/error-page.ts): `src/lib/error-page.ts`
- [Lovable error reporting](https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/lib/lovable-error-reporting.ts): `src/lib/lovable-error-reporting.ts`

### UI components

- [UI primitives](https://github.com/parkavi111/nextstep-wellbeing-compass/tree/main/src/components/ui): `src/components/ui`
- [Responsive sidebar](https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/components/ui/sidebar.tsx): `src/components/ui/sidebar.tsx`
- [Mobile breakpoint hook](https://github.com/parkavi111/nextstep-wellbeing-compass/blob/main/src/hooks/use-mobile.tsx): `src/hooks/use-mobile.tsx`

### Other components

- **Visitor**
- **Claude API**

## Connections

- Visitor → Router setup: opens app
- Router setup → Route registry: uses registry (evidence: `src/router.tsx`)
- Route registry → Root shell: registers root (evidence: `src/routeTree.gen.ts`)
- Route registry → Questionnaire and results: registers page (evidence: `src/routeTree.gen.ts`)
- Root shell → Questionnaire and results: renders route (evidence: `src/routes/__root.tsx`)
- Visitor → Questionnaire and results: answers questions (evidence: `src/routes/index.tsx`)
- Questionnaire and results → Safety screening: checks support need (evidence: `src/routes/index.tsx`)
- Questionnaire and results → Human support screen: shows support screen (evidence: `src/routes/index.tsx`)
- Questionnaire and results → Step selection: selects suggestion (evidence: `src/routes/index.tsx`)
- Questionnaire and results → Why explanation: requests explanation (evidence: `src/routes/index.tsx`)
- Why explanation → Claude API: generates explanation (evidence: `README.md`)
- Questionnaire and results → Alternatives and feedback: shows results (evidence: `src/routes/index.tsx`)
- Responsive sidebar → Mobile breakpoint hook: checks breakpoint (evidence: `src/components/ui/sidebar.tsx`)
- Responsive sidebar → UI primitives: renders primitives (evidence: `src/components/ui/sidebar.tsx`)
- SSR error handling → Error capture: consumes captured error (evidence: `src/server.ts`)
- SSR error handling → Error page renderer: renders failure page (evidence: `src/server.ts`)
- Root shell → Lovable error reporting: reports boundary errors (evidence: `src/routes/__root.tsx`)
