# dltkdgns00/duobible architecture

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

- Interactive diagram: https://gitdiagram.com/dltkdgns00/duobible
- Repository: https://github.com/dltkdgns00/duobible

## Overview

duobible is a daily Bible-reading web app for a church group. A reader opens the day’s chapter, views its text and community read-checks, and—when logged in—marks or unmarks it as read; the app also presents reading stats and reflection notes. Separate branches cover PIN-based accounts and admin progress management. The README documents the major capabilities; source-index references and sampled excerpts support the relationships shown, while component-to-API wiring not shown in the evidence is omitted.

Main entry points: [`src/app/components/ReadingView.tsx`](https://github.com/dltkdgns00/duobible/blob/main/src/app/components/ReadingView.tsx) (Reading view), [`src/lib/db.ts`](https://github.com/dltkdgns00/duobible/blob/main/src/lib/db.ts) (Application database), [`src/app/api/admin/users/route.ts`](https://github.com/dltkdgns00/duobible/blob/main/src/app/api/admin/users/route.ts) (Admin user API), [`src/lib/session.ts`](https://github.com/dltkdgns00/duobible/blob/main/src/lib/session.ts) (Session access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_reading["Daily reading"]
  node_home["Reading page<br/>[page.tsx]"]
  node_offsetpage["Past-day page<br/>[page.tsx]"]
  node_readingview["Reading view<br/>[ReadingView.tsx]"]
  node_chapterreader["Chapter display<br/>[ChapterReader.tsx]"]
  node_chapternav["Chapter navigation<br/>[ChapterNav.tsx]"]
  node_markread["Read check<br/>[MarkReadButton.tsx]"]
end

subgraph group_accounts["Accounts"]
  node_login["Login page<br/>[page.tsx]"]
  node_authform["Sign-in and registration<br/>[AuthForm.tsx]"]
  node_authapi["Account API<br/>[route.ts]"]
  node_registerapi["Registration API<br/>[route.ts]"]
  node_pinapi["Change PIN API<br/>[route.ts]"]
  node_me["My reading record<br/>[page.tsx]"]
end

subgraph group_community["Reading community"]
  node_today["Today’s readers<br/>[page.tsx]"]
  node_comments["Reflection notes"]
  node_commentsapi["Comment API<br/>[route.ts]"]
end

subgraph group_admin["Administration"]
  node_adminpage["Admin page<br/>[page.tsx]"]
  node_adminpanel["User management<br/>[AdminPanel.tsx]"]
  node_adminapi["Admin user API<br/>[route.ts]"]
end

subgraph group_core["Domain and persistence"]
  node_bible["Bible and calendar<br/>[bible.ts]"]
  node_offset["Reading offsets<br/>[offset.ts]"]
  node_reads["Read logs and stats<br/>[reads.ts]"]
  node_progress["Progress alignment<br/>[progress.ts]"]
  node_session["Session access<br/>[session.ts]"]
  node_db[("Application database<br/>[db.ts]")]
end

node_reader(("Church reader"))

node_reader -->|"opens"| node_home
node_home -->|"renders"| node_readingview
node_reader -->|"opens past day"| node_offsetpage
node_offsetpage -->|"renders"| node_readingview
node_readingview -->|"gets chapter"| node_bible
node_readingview -->|"resolves day"| node_offset
node_readingview -->|"loads read data"| node_reads
node_readingview -->|"gets session"| node_session
node_readingview -->|"loads note"| node_db
node_readingview -->|"renders"| node_chapterreader
node_readingview -->|"renders"| node_chapternav
node_readingview -->|"renders"| node_markread
node_reader -->|"views readers"| node_today
node_reader -->|"manages notes"| node_commentsapi
node_commentsapi -->|"checks login"| node_session
node_commentsapi -->|"reads and writes"| node_db
node_reader -->|"opens account"| node_login
node_login -->|"renders"| node_authform
node_reader -->|"signs in"| node_authapi
node_reader -->|"registers"| node_registerapi
node_authapi -->|"checks account"| node_db
node_authapi -->|"sets session"| node_session
node_registerapi -->|"creates account"| node_db
node_registerapi -->|"sets session"| node_session
node_reader -->|"changes PIN"| node_pinapi
node_pinapi -->|"checks session"| node_session
node_pinapi -->|"updates PIN"| node_db
node_reader -->|"views record"| node_me
node_me -->|"loads stats"| node_reads
node_me -->|"loads notes"| node_db
node_reader -->|"opens admin"| node_adminpage
node_adminpage -->|"renders"| node_adminpanel
node_adminpanel -->|"manages users"| node_adminapi
node_adminapi -->|"checks admin"| node_session
node_adminapi -->|"reads and updates"| node_db
node_adminapi -->|"aligns progress"| node_progress
node_adminapi -->|"gets stats"| node_reads
node_adminapi -->|"resolves chapter"| node_bible
node_reads -->|"queries read logs"| node_db
node_reads -->|"maps chapters"| node_bible
node_progress -->|"aligns records"| node_db
node_progress -->|"uses chapter data"| node_bible

click node_home "https://github.com/dltkdgns00/duobible/blob/main/src/app/page.tsx"
click node_offsetpage "https://github.com/dltkdgns00/duobible/blob/main/src/app/%5Boffset%5D/page.tsx"
click node_readingview "https://github.com/dltkdgns00/duobible/blob/main/src/app/components/ReadingView.tsx"
click node_chapterreader "https://github.com/dltkdgns00/duobible/blob/main/src/app/components/ChapterReader.tsx"
click node_chapternav "https://github.com/dltkdgns00/duobible/blob/main/src/app/components/ChapterNav.tsx"
click node_markread "https://github.com/dltkdgns00/duobible/blob/main/src/app/components/MarkReadButton.tsx"
click node_today "https://github.com/dltkdgns00/duobible/blob/main/src/app/today/page.tsx"
click node_comments "https://github.com/dltkdgns00/duobible/blob/main/src/app/components/CommentsSection.tsx"
click node_commentsapi "https://github.com/dltkdgns00/duobible/blob/main/src/app/api/comments/route.ts"
click node_login "https://github.com/dltkdgns00/duobible/blob/main/src/app/login/page.tsx"
click node_authform "https://github.com/dltkdgns00/duobible/blob/main/src/app/components/AuthForm.tsx"
click node_authapi "https://github.com/dltkdgns00/duobible/blob/main/src/app/api/auth/login/route.ts"
click node_registerapi "https://github.com/dltkdgns00/duobible/blob/main/src/app/api/auth/register/route.ts"
click node_pinapi "https://github.com/dltkdgns00/duobible/blob/main/src/app/api/auth/change-pin/route.ts"
click node_me "https://github.com/dltkdgns00/duobible/blob/main/src/app/me/page.tsx"
click node_adminpage "https://github.com/dltkdgns00/duobible/blob/main/src/app/admin/page.tsx"
click node_adminpanel "https://github.com/dltkdgns00/duobible/blob/main/src/app/components/AdminPanel.tsx"
click node_adminapi "https://github.com/dltkdgns00/duobible/blob/main/src/app/api/admin/users/route.ts"
click node_bible "https://github.com/dltkdgns00/duobible/blob/main/src/lib/bible.ts"
click node_offset "https://github.com/dltkdgns00/duobible/blob/main/src/lib/offset.ts"
click node_reads "https://github.com/dltkdgns00/duobible/blob/main/src/lib/reads.ts"
click node_progress "https://github.com/dltkdgns00/duobible/blob/main/src/lib/progress.ts"
click node_session "https://github.com/dltkdgns00/duobible/blob/main/src/lib/session.ts"
click node_db "https://github.com/dltkdgns00/duobible/blob/main/src/lib/db.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_home,node_offsetpage,node_readingview,node_chapterreader,node_chapternav,node_markread toneBlue
class node_login,node_authform,node_authapi,node_registerapi,node_pinapi,node_me toneAmber
class node_today,node_comments,node_commentsapi toneMint
class node_adminpage,node_adminpanel,node_adminapi toneRose
class node_bible,node_offset,node_reads,node_progress,node_session,node_db,node_reader toneIndigo
```

## Components

### Daily reading

- [Reading page](https://github.com/dltkdgns00/duobible/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Past-day page](https://github.com/dltkdgns00/duobible/blob/main/src/app/%5Boffset%5D/page.tsx): `src/app/[offset]/page.tsx`
- [Reading view](https://github.com/dltkdgns00/duobible/blob/main/src/app/components/ReadingView.tsx): `src/app/components/ReadingView.tsx`
- [Chapter display](https://github.com/dltkdgns00/duobible/blob/main/src/app/components/ChapterReader.tsx): `src/app/components/ChapterReader.tsx`
- [Chapter navigation](https://github.com/dltkdgns00/duobible/blob/main/src/app/components/ChapterNav.tsx): `src/app/components/ChapterNav.tsx`
- [Read check](https://github.com/dltkdgns00/duobible/blob/main/src/app/components/MarkReadButton.tsx): `src/app/components/MarkReadButton.tsx`

### Accounts

- [Login page](https://github.com/dltkdgns00/duobible/blob/main/src/app/login/page.tsx): `src/app/login/page.tsx`
- [Sign-in and registration](https://github.com/dltkdgns00/duobible/blob/main/src/app/components/AuthForm.tsx): `src/app/components/AuthForm.tsx`
- [Account API](https://github.com/dltkdgns00/duobible/blob/main/src/app/api/auth/login/route.ts): `src/app/api/auth/login/route.ts`
- [Registration API](https://github.com/dltkdgns00/duobible/blob/main/src/app/api/auth/register/route.ts): `src/app/api/auth/register/route.ts`
- [Change PIN API](https://github.com/dltkdgns00/duobible/blob/main/src/app/api/auth/change-pin/route.ts): `src/app/api/auth/change-pin/route.ts`
- [My reading record](https://github.com/dltkdgns00/duobible/blob/main/src/app/me/page.tsx): `src/app/me/page.tsx`

### Reading community

- [Today’s readers](https://github.com/dltkdgns00/duobible/blob/main/src/app/today/page.tsx): `src/app/today/page.tsx`
- [Reflection notes](https://github.com/dltkdgns00/duobible/blob/main/src/app/components/CommentsSection.tsx): `src/app/components/CommentsSection.tsx`
- [Comment API](https://github.com/dltkdgns00/duobible/blob/main/src/app/api/comments/route.ts): `src/app/api/comments/route.ts`

### Administration

- [Admin page](https://github.com/dltkdgns00/duobible/blob/main/src/app/admin/page.tsx): `src/app/admin/page.tsx`
- [User management](https://github.com/dltkdgns00/duobible/blob/main/src/app/components/AdminPanel.tsx): `src/app/components/AdminPanel.tsx`
- [Admin user API](https://github.com/dltkdgns00/duobible/blob/main/src/app/api/admin/users/route.ts): `src/app/api/admin/users/route.ts`

### Domain and persistence

- [Bible and calendar](https://github.com/dltkdgns00/duobible/blob/main/src/lib/bible.ts): `src/lib/bible.ts`
- [Reading offsets](https://github.com/dltkdgns00/duobible/blob/main/src/lib/offset.ts): `src/lib/offset.ts`
- [Read logs and stats](https://github.com/dltkdgns00/duobible/blob/main/src/lib/reads.ts): `src/lib/reads.ts`
- [Progress alignment](https://github.com/dltkdgns00/duobible/blob/main/src/lib/progress.ts): `src/lib/progress.ts`
- [Session access](https://github.com/dltkdgns00/duobible/blob/main/src/lib/session.ts): `src/lib/session.ts`
- [Application database](https://github.com/dltkdgns00/duobible/blob/main/src/lib/db.ts): `src/lib/db.ts`

### Other components

- **Church reader**

## Connections

- Church reader → Reading page: opens
- Reading page → Reading view: renders (evidence: `src/app/page.tsx`)
- Church reader → Past-day page: opens past day (evidence: `src/app/[offset]/page.tsx`)
- Past-day page → Reading view: renders (evidence: `src/app/[offset]/page.tsx`)
- Reading view → Bible and calendar: gets chapter (evidence: `src/app/components/ReadingView.tsx`)
- Reading view → Reading offsets: resolves day (evidence: `src/app/components/ReadingView.tsx`)
- Reading view → Read logs and stats: loads read data (evidence: `src/app/components/ReadingView.tsx`)
- Reading view → Session access: gets session (evidence: `src/app/components/ReadingView.tsx`)
- Reading view → Application database: loads note (evidence: `src/app/components/ReadingView.tsx`)
- Reading view → Chapter display: renders (evidence: `src/app/components/ReadingView.tsx`)
- Reading view → Chapter navigation: renders (evidence: `src/app/components/ReadingView.tsx`)
- Reading view → Read check: renders (evidence: `src/app/components/ReadingView.tsx`)
- Church reader → Today’s readers: views readers
- Church reader → Comment API: manages notes
- Comment API → Session access: checks login (evidence: `src/app/api/comments/route.ts`)
- Comment API → Application database: reads and writes (evidence: `src/app/api/comments/route.ts`)
- Church reader → Login page: opens account
- Login page → Sign-in and registration: renders (evidence: `src/app/login/page.tsx`)
- Church reader → Account API: signs in
- Church reader → Registration API: registers
- Account API → Application database: checks account (evidence: `src/app/api/auth/login/route.ts`)
- Account API → Session access: sets session (evidence: `src/app/api/auth/login/route.ts`)
- Registration API → Application database: creates account (evidence: `src/app/api/auth/register/route.ts`)
- Registration API → Session access: sets session (evidence: `src/app/api/auth/register/route.ts`)
- Church reader → Change PIN API: changes PIN
- Change PIN API → Session access: checks session (evidence: `src/app/api/auth/change-pin/route.ts`)
- Change PIN API → Application database: updates PIN (evidence: `src/app/api/auth/change-pin/route.ts`)
- Church reader → My reading record: views record (evidence: `src/app/me/page.tsx`)
- My reading record → Read logs and stats: loads stats (evidence: `src/app/me/page.tsx`)
- My reading record → Application database: loads notes (evidence: `src/app/me/page.tsx`)
- Church reader → Admin page: opens admin
- Admin page → User management: renders (evidence: `src/app/admin/page.tsx`)
- User management → Admin user API: manages users
- Admin user API → Session access: checks admin (evidence: `src/app/api/admin/users/route.ts`)
- Admin user API → Application database: reads and updates (evidence: `src/app/api/admin/users/route.ts`)
- Admin user API → Progress alignment: aligns progress (evidence: `src/app/api/admin/users/route.ts`)
- Admin user API → Read logs and stats: gets stats (evidence: `src/app/api/admin/users/route.ts`)
- Admin user API → Bible and calendar: resolves chapter (evidence: `src/app/api/admin/users/route.ts`)
- Read logs and stats → Application database: queries read logs (evidence: `src/lib/reads.ts`)
- Read logs and stats → Bible and calendar: maps chapters (evidence: `src/lib/reads.ts`)
- Progress alignment → Application database: aligns records (evidence: `src/lib/progress.ts`)
- Progress alignment → Bible and calendar: uses chapter data (evidence: `src/lib/progress.ts`)
