# sotercare/web-dev-v2 architecture

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

- Interactive diagram: https://gitdiagram.com/sotercare/web-dev-v2
- Repository: https://github.com/sotercare/web-dev-v2

## Overview

SoterCare is a Next.js product website with a public community and news presence, a protected newsroom editor, and an authenticated live-monitoring dashboard. Public visitors browse product information, community details, and published articles; editors manage articles; caregivers use the dashboard to monitor vitals, alerts, devices, and activity. The graph reflects documented routes and sampled imports/calls. Several dashboard API handlers and editor internals were not sampled, so uncertain links are omitted; the README documents their capabilities.

Main entry points: [`src/lib/dashboardApi.ts`](https://github.com/sotercare/web-dev-v2/blob/main/src/lib/dashboardApi.ts) (Dashboard API client), [`src/lib/news-store.ts`](https://github.com/sotercare/web-dev-v2/blob/main/src/lib/news-store.ts) (News store), [`src/app/news/page.tsx`](https://github.com/sotercare/web-dev-v2/blob/main/src/app/news/page.tsx) (News index), [`src/lib/useAlerts.ts`](https://github.com/sotercare/web-dev-v2/blob/main/src/lib/useAlerts.ts) (Alert handling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public experience"]
  node_homepage["Product homepage<br/>[HomePage.tsx]"]
  node_community["Developer community<br/>[page.tsx]"]
  node_community_links["Community links<br/>[page.tsx]"]
end

subgraph group_news["News publishing"]
  node_news_index["News index<br/>[page.tsx]"]
  node_article_page["Article page<br/>[page.tsx]"]
  node_news_data[("News store<br/>[news-store.ts]")]
  node_news_order["Article sorting<br/>[news-sort.ts]"]
  node_news_types["Article model<br/>[news.ts]"]
  node_news_editor["Newsroom editor<br/>[NewsEditor.tsx]"]
  node_editor_actions["News actions<br/>[news-actions.ts]"]
end

subgraph group_dashboard["Care dashboard"]
  node_login["Dashboard login<br/>[page.tsx]"]
  node_dashboard_layout["Dashboard shell"]
  node_overview["Monitoring overview<br/>[page.tsx]"]
  node_timeline["Activity timeline<br/>[page.tsx]"]
  node_alerts["Alert handling<br/>[useAlerts.ts]"]
  node_device_id["Device selection<br/>[useDeviceId.ts]"]
  node_recycle_bin["Recycle bin<br/>[page.tsx]"]
  node_realtime["Realtime events"]
  node_dashboard_api["Dashboard API client<br/>[dashboardApi.ts]"]
  node_dashboard_routes["Dashboard API routes"]
end

subgraph group_shared["Shared services"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_api_client["API client<br/>[api.ts]"]
  node_seo["SEO metadata<br/>[seo.ts]"]
  node_llms["Site summary feed<br/>[route.ts]"]
  node_email_templates["Email templates"]
end

node_visitor(("Site visitor"))
node_caregiver(("Caregiver"))
node_email_service["Email delivery"]

node_visitor -->|"browses"| node_homepage
node_visitor -->|"visits"| node_community
node_visitor -->|"browses"| node_news_index
node_homepage -->|"builds metadata"| node_seo
node_homepage -->|"links to"| node_community
node_community -->|"presents"| node_community_links
node_news_index -->|"reads"| node_news_data
node_news_index -->|"sorts articles"| node_news_order
node_news_index -->|"links articles"| node_article_page
node_article_page -->|"reads"| node_news_data
node_article_page -->|"sorts related"| node_news_order
node_news_editor -.->|"uses actions"| node_editor_actions
node_news_editor -.->|"updates articles"| node_news_data
node_news_data -->|"stores records"| node_news_types
node_caregiver -->|"signs in"| node_login
node_login -->|"authenticates"| node_auth
node_login -->|"requests token"| node_api_client
node_dashboard_layout -->|"provides context"| node_realtime
node_caregiver -->|"monitors care"| node_overview
node_caregiver -->|"reviews activity"| node_timeline
node_caregiver -->|"reviews dismissed events"| node_recycle_bin
node_timeline -->|"loads timeline"| node_dashboard_api
node_timeline -->|"selects device"| node_device_id
node_alerts -->|"gets device"| node_device_id
node_alerts -->|"receives events"| node_realtime
node_alerts -->|"loads and updates"| node_dashboard_api
node_device_id -->|"queries devices"| node_dashboard_api
node_realtime -.->|"connects to services"| node_dashboard_routes
node_dashboard_api -->|"delegates requests"| node_api_client
node_dashboard_api -.->|"calls routes"| node_dashboard_routes
node_llms -->|"reads articles"| node_news_data
node_llms -->|"sorts articles"| node_news_order
node_llms -->|"uses site URL"| node_seo
node_email_templates -.->|"sent through"| node_email_service

click node_homepage "https://github.com/sotercare/web-dev-v2/blob/main/src/components/HomePage.tsx"
click node_community "https://github.com/sotercare/web-dev-v2/blob/main/src/app/community/page.tsx"
click node_community_links "https://github.com/sotercare/web-dev-v2/blob/main/src/app/community/page.tsx"
click node_news_index "https://github.com/sotercare/web-dev-v2/blob/main/src/app/news/page.tsx"
click node_article_page "https://github.com/sotercare/web-dev-v2/blob/main/src/app/news/%5Bslug%5D/page.tsx"
click node_news_data "https://github.com/sotercare/web-dev-v2/blob/main/src/lib/news-store.ts"
click node_news_order "https://github.com/sotercare/web-dev-v2/blob/main/src/lib/news-sort.ts"
click node_news_types "https://github.com/sotercare/web-dev-v2/blob/main/src/types/news.ts"
click node_news_editor "https://github.com/sotercare/web-dev-v2/blob/main/src/app/editnews/NewsEditor.tsx"
click node_editor_actions "https://github.com/sotercare/web-dev-v2/blob/main/src/app/dashboard/news-actions.ts"
click node_login "https://github.com/sotercare/web-dev-v2/blob/main/src/app/dashboard/login/page.tsx"
click node_dashboard_layout "https://github.com/sotercare/web-dev-v2/blob/main/src/components/dashboard/DashboardLayoutClient.tsx"
click node_overview "https://github.com/sotercare/web-dev-v2/blob/main/src/app/dashboard/page.tsx"
click node_timeline "https://github.com/sotercare/web-dev-v2/blob/main/src/app/dashboard/timeline/page.tsx"
click node_alerts "https://github.com/sotercare/web-dev-v2/blob/main/src/lib/useAlerts.ts"
click node_device_id "https://github.com/sotercare/web-dev-v2/blob/main/src/lib/useDeviceId.ts"
click node_recycle_bin "https://github.com/sotercare/web-dev-v2/blob/main/src/app/dashboard/recycle-bin/page.tsx"
click node_realtime "https://github.com/sotercare/web-dev-v2/blob/main/src/components/dashboard/WebSocketContext.tsx"
click node_dashboard_api "https://github.com/sotercare/web-dev-v2/blob/main/src/lib/dashboardApi.ts"
click node_dashboard_routes "https://github.com/sotercare/web-dev-v2/tree/main/src/app/api"
click node_auth "https://github.com/sotercare/web-dev-v2/blob/main/src/lib/auth.ts"
click node_api_client "https://github.com/sotercare/web-dev-v2/blob/main/src/lib/api.ts"
click node_seo "https://github.com/sotercare/web-dev-v2/blob/main/src/lib/seo.ts"
click node_llms "https://github.com/sotercare/web-dev-v2/blob/main/src/app/llms.txt/route.ts"
click node_email_templates "https://github.com/sotercare/web-dev-v2/blob/main/src/emails/WelcomeWaitlist.tsx"

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_homepage,node_community,node_community_links toneBlue
class node_news_index,node_article_page,node_news_data,node_news_order,node_news_types,node_news_editor,node_editor_actions toneAmber
class node_login,node_dashboard_layout,node_overview,node_timeline,node_alerts,node_device_id,node_recycle_bin,node_realtime,node_dashboard_api,node_dashboard_routes toneMint
class node_auth,node_api_client,node_seo,node_llms,node_email_templates toneRose
class node_visitor,node_caregiver,node_email_service toneIndigo
```

## Components

### Public experience

- [Product homepage](https://github.com/sotercare/web-dev-v2/blob/main/src/components/HomePage.tsx): `src/components/HomePage.tsx`
- [Developer community](https://github.com/sotercare/web-dev-v2/blob/main/src/app/community/page.tsx): `src/app/community/page.tsx`
- [Community links](https://github.com/sotercare/web-dev-v2/blob/main/src/app/community/page.tsx): `src/app/community/page.tsx`

### News publishing

- [News index](https://github.com/sotercare/web-dev-v2/blob/main/src/app/news/page.tsx): `src/app/news/page.tsx`
- [Article page](https://github.com/sotercare/web-dev-v2/blob/main/src/app/news/%5Bslug%5D/page.tsx): `src/app/news/[slug]/page.tsx`
- [News store](https://github.com/sotercare/web-dev-v2/blob/main/src/lib/news-store.ts): `src/lib/news-store.ts`
- [Article sorting](https://github.com/sotercare/web-dev-v2/blob/main/src/lib/news-sort.ts): `src/lib/news-sort.ts`
- [Article model](https://github.com/sotercare/web-dev-v2/blob/main/src/types/news.ts): `src/types/news.ts`
- [Newsroom editor](https://github.com/sotercare/web-dev-v2/blob/main/src/app/editnews/NewsEditor.tsx): `src/app/editnews/NewsEditor.tsx`
- [News actions](https://github.com/sotercare/web-dev-v2/blob/main/src/app/dashboard/news-actions.ts): `src/app/dashboard/news-actions.ts`

### Care dashboard

- [Dashboard login](https://github.com/sotercare/web-dev-v2/blob/main/src/app/dashboard/login/page.tsx): `src/app/dashboard/login/page.tsx`
- [Dashboard shell](https://github.com/sotercare/web-dev-v2/blob/main/src/components/dashboard/DashboardLayoutClient.tsx): `src/components/dashboard/DashboardLayoutClient.tsx`
- [Monitoring overview](https://github.com/sotercare/web-dev-v2/blob/main/src/app/dashboard/page.tsx): `src/app/dashboard/page.tsx`
- [Activity timeline](https://github.com/sotercare/web-dev-v2/blob/main/src/app/dashboard/timeline/page.tsx): `src/app/dashboard/timeline/page.tsx`
- [Alert handling](https://github.com/sotercare/web-dev-v2/blob/main/src/lib/useAlerts.ts): `src/lib/useAlerts.ts`
- [Device selection](https://github.com/sotercare/web-dev-v2/blob/main/src/lib/useDeviceId.ts): `src/lib/useDeviceId.ts`
- [Recycle bin](https://github.com/sotercare/web-dev-v2/blob/main/src/app/dashboard/recycle-bin/page.tsx): `src/app/dashboard/recycle-bin/page.tsx`
- [Realtime events](https://github.com/sotercare/web-dev-v2/blob/main/src/components/dashboard/WebSocketContext.tsx): `src/components/dashboard/WebSocketContext.tsx`
- [Dashboard API client](https://github.com/sotercare/web-dev-v2/blob/main/src/lib/dashboardApi.ts): `src/lib/dashboardApi.ts`
- [Dashboard API routes](https://github.com/sotercare/web-dev-v2/tree/main/src/app/api): `src/app/api`

### Shared services

- [Authentication](https://github.com/sotercare/web-dev-v2/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [API client](https://github.com/sotercare/web-dev-v2/blob/main/src/lib/api.ts): `src/lib/api.ts`
- [SEO metadata](https://github.com/sotercare/web-dev-v2/blob/main/src/lib/seo.ts): `src/lib/seo.ts`
- [Site summary feed](https://github.com/sotercare/web-dev-v2/blob/main/src/app/llms.txt/route.ts): `src/app/llms.txt/route.ts`
- [Email templates](https://github.com/sotercare/web-dev-v2/blob/main/src/emails/WelcomeWaitlist.tsx): `src/emails/WelcomeWaitlist.tsx`

### Other components

- **Site visitor**
- **Caregiver**
- **Email delivery**

## Connections

- Site visitor → Product homepage: browses
- Site visitor → Developer community: visits
- Site visitor → News index: browses
- Product homepage → SEO metadata: builds metadata (evidence: `src/app/page.tsx`)
- Product homepage → Developer community: links to
- Developer community → Community links: presents (evidence: `src/app/community/page.tsx`)
- News index → News store: reads (evidence: `src/app/news/page.tsx`)
- News index → Article sorting: sorts articles (evidence: `src/app/news/page.tsx`)
- News index → Article page: links articles (evidence: `src/app/news/page.tsx`)
- Article page → News store: reads (evidence: `src/app/news/[slug]/page.tsx`)
- Article page → Article sorting: sorts related (evidence: `src/app/news/[slug]/page.tsx`)
- Newsroom editor → News actions: uses actions
- Newsroom editor → News store: updates articles
- News store → Article model: stores records (evidence: `src/lib/news-store.ts`)
- Caregiver → Dashboard login: signs in
- Dashboard login → Authentication: authenticates (evidence: `src/app/dashboard/login/page.tsx`)
- Dashboard login → API client: requests token (evidence: `src/app/dashboard/login/page.tsx`)
- Dashboard shell → Realtime events: provides context (evidence: `src/components/dashboard/DashboardLayoutClient.tsx`)
- Caregiver → Monitoring overview: monitors care
- Caregiver → Activity timeline: reviews activity
- Caregiver → Recycle bin: reviews dismissed events
- Activity timeline → Dashboard API client: loads timeline (evidence: `src/app/dashboard/timeline/page.tsx`)
- Activity timeline → Device selection: selects device (evidence: `src/app/dashboard/timeline/page.tsx`)
- Alert handling → Device selection: gets device (evidence: `src/lib/useAlerts.ts`)
- Alert handling → Realtime events: receives events (evidence: `src/lib/useAlerts.ts`)
- Alert handling → Dashboard API client: loads and updates (evidence: `src/lib/useAlerts.ts`)
- Device selection → Dashboard API client: queries devices (evidence: `src/lib/useDeviceId.ts`)
- Realtime events → Dashboard API routes: connects to services
- Dashboard API client → API client: delegates requests (evidence: `src/lib/dashboardApi.ts`)
- Dashboard API client → Dashboard API routes: calls routes
- Site summary feed → News store: reads articles (evidence: `src/app/llms.txt/route.ts`)
- Site summary feed → Article sorting: sorts articles (evidence: `src/app/llms.txt/route.ts`)
- Site summary feed → SEO metadata: uses site URL (evidence: `src/app/llms.txt/route.ts`)
- Email templates → Email delivery: sent through
