# boredmayonnaise/common_hearth architecture

> Architecture diagram of the GitHub repository boredmayonnaise/common_hearth, 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/boredmayonnaise/common_hearth
- Repository: https://github.com/boredmayonnaise/common_hearth

## Overview

Common Hearth is a private-circle care handbook. Users sign up and authenticate, create or join a circle by invite code, complete a trust profile, then write and edit shared practice notes, assign carriers, and mark handoffs received. Server-rendered Next.js pages and actions perform the workflow against Postgres; authentication and membership checks protect access. The README also documents the privacy boundary and the carrier/handoff list. Several note-edit and login/signup implementations are indexed but not excerpted, so their internal calls are not expanded here.

Main entry points: [`app/lib/db.ts`](https://github.com/boredmayonnaise/common_hearth/blob/master/app/lib/db.ts) (Postgres client), [`app/app/page.tsx`](https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/page.tsx) (Landing and home), [`app/app/notes/page.tsx`](https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/notes/page.tsx) (Notes and handoffs), [`app/app/signup/page.tsx`](https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/signup/page.tsx) (Account creation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Web experience"]
  node_home["Landing and home<br/>[page.tsx]"]
  node_navigation["App navigation<br/>[nav.tsx]"]
  node_signout["Sign out control<br/>[signout-button.tsx]"]
end

subgraph group_identity["Identity and profiles"]
  node_signup["Account creation<br/>[page.tsx]"]
  node_signup_api["Signup endpoint<br/>[route.ts]"]
  node_login["Credential login<br/>[page.tsx]"]
  node_auth_route["Auth route<br/>[route.ts]"]
  node_auth_config["Credential verification<br/>[auth.ts]"]
  node_profile["Trust profile<br/>[page.tsx]"]
end

subgraph group_circles["Private circles"]
  node_circle_page["Circle management<br/>[page.tsx]"]
  node_membership_helper["Membership lookup<br/>[membership.ts]"]
end

subgraph group_handbook["Practice handbook"]
  node_notes_list["Notes and handoffs<br/>[page.tsx]"]
  node_note_create["Practice note creation<br/>[page.tsx]"]
  node_note_edit["Practice note editing<br/>[page.tsx]"]
end

subgraph group_data["Persistence"]
  node_database_client["Postgres client<br/>[db.ts]"]
  node_postgres[("Postgres data store<br/>[schema.sql]")]
end

node_visitor(("Visitor"))

node_visitor -->|"opens"| node_home
node_home -->|"offers signup"| node_signup
node_home -->|"offers sign-in"| node_login
node_signup -.->|"submits account"| node_signup_api
node_signup_api -->|"inserts user"| node_database_client
node_login -.->|"starts sign-in"| node_auth_route
node_auth_route -->|"uses credentials"| node_auth_config
node_auth_config -->|"queries users"| node_database_client
node_home -->|"reads profile"| node_database_client
node_home -->|"redirects setup"| node_profile
node_profile -->|"reads and saves"| node_database_client
node_home -->|"links circle"| node_circle_page
node_circle_page -->|"manages membership"| node_database_client
node_home -->|"links notes"| node_notes_list
node_notes_list -->|"opens new note"| node_note_create
node_notes_list -->|"opens edit"| node_note_edit
node_notes_list -->|"reads and updates"| node_database_client
node_note_create -.->|"persists notes"| node_database_client
node_note_edit -.->|"reads and saves"| node_database_client
node_membership_helper -->|"queries memberships"| node_database_client
node_database_client -.->|"runs SQL"| node_postgres
node_navigation -->|"renders control"| node_signout

click node_home "https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/page.tsx"
click node_navigation "https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/nav.tsx"
click node_signout "https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/signout-button.tsx"
click node_signup "https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/signup/page.tsx"
click node_signup_api "https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/api/signup/route.ts"
click node_login "https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/login/page.tsx"
click node_auth_route "https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/api/auth/%5B...nextauth%5D/route.ts"
click node_auth_config "https://github.com/boredmayonnaise/common_hearth/blob/master/app/lib/auth.ts"
click node_profile "https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/profile/page.tsx"
click node_circle_page "https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/circle/page.tsx"
click node_notes_list "https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/notes/page.tsx"
click node_note_create "https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/notes/new/page.tsx"
click node_note_edit "https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/notes/%5Bid%5D/edit/page.tsx"
click node_membership_helper "https://github.com/boredmayonnaise/common_hearth/blob/master/app/lib/membership.ts"
click node_database_client "https://github.com/boredmayonnaise/common_hearth/blob/master/app/lib/db.ts"
click node_postgres "https://github.com/boredmayonnaise/common_hearth/blob/master/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_home,node_navigation,node_signout toneBlue
class node_signup,node_signup_api,node_login,node_auth_route,node_auth_config,node_profile toneAmber
class node_circle_page,node_membership_helper toneMint
class node_notes_list,node_note_create,node_note_edit toneRose
class node_database_client,node_postgres,node_visitor toneIndigo
```

## Components

### Web experience

- [Landing and home](https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/page.tsx): `app/app/page.tsx`
- [App navigation](https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/nav.tsx): `app/app/nav.tsx`
- [Sign out control](https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/signout-button.tsx): `app/app/signout-button.tsx`

### Identity and profiles

- [Account creation](https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/signup/page.tsx): `app/app/signup/page.tsx`
- [Signup endpoint](https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/api/signup/route.ts): `app/app/api/signup/route.ts`
- [Credential login](https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/login/page.tsx): `app/app/login/page.tsx`
- [Auth route](https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/api/auth/%5B...nextauth%5D/route.ts): `app/app/api/auth/[...nextauth]/route.ts`
- [Credential verification](https://github.com/boredmayonnaise/common_hearth/blob/master/app/lib/auth.ts): `app/lib/auth.ts`
- [Trust profile](https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/profile/page.tsx): `app/app/profile/page.tsx`

### Private circles

- [Circle management](https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/circle/page.tsx): `app/app/circle/page.tsx`
- [Membership lookup](https://github.com/boredmayonnaise/common_hearth/blob/master/app/lib/membership.ts): `app/lib/membership.ts`

### Practice handbook

- [Notes and handoffs](https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/notes/page.tsx): `app/app/notes/page.tsx`
- [Practice note creation](https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/notes/new/page.tsx): `app/app/notes/new/page.tsx`
- [Practice note editing](https://github.com/boredmayonnaise/common_hearth/blob/master/app/app/notes/%5Bid%5D/edit/page.tsx): `app/app/notes/[id]/edit/page.tsx`

### Persistence

- [Postgres client](https://github.com/boredmayonnaise/common_hearth/blob/master/app/lib/db.ts): `app/lib/db.ts`
- [Postgres data store](https://github.com/boredmayonnaise/common_hearth/blob/master/schema.sql): `schema.sql`

### Other components

- **Visitor**

## Connections

- Visitor → Landing and home: opens (evidence: `README.md`)
- Landing and home → Account creation: offers signup (evidence: `app/app/page.tsx`)
- Landing and home → Credential login: offers sign-in (evidence: `app/app/page.tsx`)
- Account creation → Signup endpoint: submits account
- Signup endpoint → Postgres client: inserts user (evidence: `app/app/api/signup/route.ts`)
- Credential login → Auth route: starts sign-in
- Auth route → Credential verification: uses credentials (evidence: `app/app/api/auth/[...nextauth]/route.ts`)
- Credential verification → Postgres client: queries users (evidence: `app/lib/auth.ts`)
- Landing and home → Postgres client: reads profile (evidence: `app/app/page.tsx`)
- Landing and home → Trust profile: redirects setup (evidence: `app/app/page.tsx`)
- Trust profile → Postgres client: reads and saves (evidence: `app/app/profile/page.tsx`)
- Landing and home → Circle management: links circle (evidence: `app/app/page.tsx`)
- Circle management → Postgres client: manages membership (evidence: `app/app/circle/page.tsx`)
- Landing and home → Notes and handoffs: links notes (evidence: `app/app/page.tsx`)
- Notes and handoffs → Practice note creation: opens new note (evidence: `app/app/notes/page.tsx`)
- Notes and handoffs → Practice note editing: opens edit (evidence: `app/app/notes/page.tsx`)
- Notes and handoffs → Postgres client: reads and updates (evidence: `app/app/notes/page.tsx`)
- Practice note creation → Postgres client: persists notes
- Practice note editing → Postgres client: reads and saves
- Membership lookup → Postgres client: queries memberships (evidence: `app/lib/membership.ts`)
- Postgres client → Postgres data store: runs SQL
- App navigation → Sign out control: renders control (evidence: `app/app/nav.tsx`)
