# cwaynes/ember architecture

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

- Interactive diagram: https://gitdiagram.com/cwaynes/ember
- Repository: https://github.com/cwaynes/ember

## Overview

Ember is an offline-first Bible study application centered on reading Scripture and opening contextual study tools from selected verses. The main workflow runs from chapter navigation and verse selection into reference, language, and personal-study tools; notes, tags, bookmarks, and markups accumulate locally against passages. Search and reading plans provide additional ways to revisit and structure study. The sampled source supports the app initialization, reader/database access, plans persistence, and language queries; some other feature connections are described by the README but their implementation wiring was not sampled.

Main entry points: [`js/db.js`](https://github.com/cwaynes/ember/blob/main/js/db.js) (Database access), [`js/reader.js`](https://github.com/cwaynes/ember/blob/main/js/reader.js) (Scripture reader), [`js/reference.js`](https://github.com/cwaynes/ember/blob/main/js/reference.js) (Reference panel), [`js/language.js`](https://github.com/cwaynes/ember/blob/main/js/language.js) (Original-language study)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_reading["Reading and navigation"]
  node_reader["Scripture reader<br/>[reader.js]"]
  node_selection["Verse selection<br/>[selection.js]"]
  node_translation_data[("Bible translations")]
  node_search["Unified search<br/>[search.js]"]
end

subgraph group_study["Contextual study"]
  node_reference["Reference panel<br/>[reference.js]"]
  node_language["Original-language study<br/>[language.js]"]
  node_grammar["Morphology decoding<br/>[grammar-decode.js]"]
  node_crossrefs[("Topics and cross-references<br/>[core.db]")]
end

subgraph group_personal["Personal study data"]
  node_notes["Notes and studies<br/>[notes.js]"]
  node_tags["Note tags<br/>[tags.js]"]
  node_bookmarks["Bookmarks<br/>[bookmarks.js]"]
  node_markups["Text markups<br/>[markups.js]"]
  node_plans["Reading plans<br/>[plans.js]"]
  node_templates["Study templates<br/>[study-templates.js]"]
end

subgraph group_platform["Local data and offline"]
  node_database["Database access<br/>[db.js]"]
  node_core_store[("Core study data<br/>[core.db]")]
  node_language_store[("Language data<br/>[language.db]")]
  node_persistence["Local persistence<br/>[storage-worker.js]"]
  node_offline["Offline app cache<br/>[sw.js]"]
  node_app["Application startup<br/>[app.js]"]
end

node_student(("Bible student"))

node_student -->|"navigates"| node_reader
node_reader -->|"loads chapters"| node_database
node_database -->|"queries verses"| node_translation_data
node_reader -->|"selects verses"| node_selection
node_selection -->|"opens context"| node_reference
node_reference -->|"reads related data"| node_crossrefs
node_reference -->|"opens language tab"| node_language
node_language -->|"queries words"| node_database
node_language -->|"decodes morphology"| node_grammar
node_grammar -->|"looks up categories"| node_database
node_database -->|"queries language data"| node_language_store
node_student -->|"creates notes"| node_notes
node_notes -->|"saves notes"| node_database
node_student -->|"saves verses"| node_bookmarks
node_bookmarks -->|"stores bookmarks"| node_database
node_student -->|"marks verses"| node_markups
node_markups -->|"stores markups"| node_database
node_notes -->|"adds tags"| node_tags
node_student -->|"searches study data"| node_search
node_search -->|"queries results"| node_database
node_student -->|"manages plans"| node_plans
node_plans -->|"imports plans"| node_database
node_student -->|"starts a study"| node_templates
node_app -->|"initializes"| node_database
node_database -->|"reads and writes"| node_core_store
node_database -->|"dispatches writes"| node_persistence
node_persistence -->|"persists bytes"| node_core_store
node_app -->|"registers service worker"| node_offline

click node_reader "https://github.com/cwaynes/ember/blob/main/js/reader.js"
click node_selection "https://github.com/cwaynes/ember/blob/main/js/selection.js"
click node_translation_data "https://github.com/cwaynes/ember/tree/main/data/translations"
click node_search "https://github.com/cwaynes/ember/blob/main/js/search.js"
click node_reference "https://github.com/cwaynes/ember/blob/main/js/reference.js"
click node_language "https://github.com/cwaynes/ember/blob/main/js/language.js"
click node_grammar "https://github.com/cwaynes/ember/blob/main/js/grammar-decode.js"
click node_crossrefs "https://github.com/cwaynes/ember/blob/main/data/core.db"
click node_notes "https://github.com/cwaynes/ember/blob/main/js/notes.js"
click node_tags "https://github.com/cwaynes/ember/blob/main/js/tags.js"
click node_bookmarks "https://github.com/cwaynes/ember/blob/main/js/bookmarks.js"
click node_markups "https://github.com/cwaynes/ember/blob/main/js/markups.js"
click node_plans "https://github.com/cwaynes/ember/blob/main/js/plans.js"
click node_templates "https://github.com/cwaynes/ember/blob/main/js/study-templates.js"
click node_database "https://github.com/cwaynes/ember/blob/main/js/db.js"
click node_core_store "https://github.com/cwaynes/ember/blob/main/data/core.db"
click node_language_store "https://github.com/cwaynes/ember/blob/main/data/language.db"
click node_persistence "https://github.com/cwaynes/ember/blob/main/js/storage-worker.js"
click node_offline "https://github.com/cwaynes/ember/blob/main/sw.js"
click node_app "https://github.com/cwaynes/ember/blob/main/js/app.js"

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_reader,node_selection,node_translation_data,node_search toneBlue
class node_reference,node_language,node_grammar,node_crossrefs toneAmber
class node_notes,node_tags,node_bookmarks,node_markups,node_plans,node_templates toneMint
class node_database,node_core_store,node_language_store,node_persistence,node_offline,node_app toneRose
class node_student toneIndigo
```

## Components

### Reading and navigation

- [Scripture reader](https://github.com/cwaynes/ember/blob/main/js/reader.js): `js/reader.js`
- [Verse selection](https://github.com/cwaynes/ember/blob/main/js/selection.js): `js/selection.js`
- [Bible translations](https://github.com/cwaynes/ember/tree/main/data/translations): `data/translations`
- [Unified search](https://github.com/cwaynes/ember/blob/main/js/search.js): `js/search.js`

### Contextual study

- [Reference panel](https://github.com/cwaynes/ember/blob/main/js/reference.js): `js/reference.js`
- [Original-language study](https://github.com/cwaynes/ember/blob/main/js/language.js): `js/language.js`
- [Morphology decoding](https://github.com/cwaynes/ember/blob/main/js/grammar-decode.js): `js/grammar-decode.js`
- [Topics and cross-references](https://github.com/cwaynes/ember/blob/main/data/core.db): `data/core.db`

### Personal study data

- [Notes and studies](https://github.com/cwaynes/ember/blob/main/js/notes.js): `js/notes.js`
- [Note tags](https://github.com/cwaynes/ember/blob/main/js/tags.js): `js/tags.js`
- [Bookmarks](https://github.com/cwaynes/ember/blob/main/js/bookmarks.js): `js/bookmarks.js`
- [Text markups](https://github.com/cwaynes/ember/blob/main/js/markups.js): `js/markups.js`
- [Reading plans](https://github.com/cwaynes/ember/blob/main/js/plans.js): `js/plans.js`
- [Study templates](https://github.com/cwaynes/ember/blob/main/js/study-templates.js): `js/study-templates.js`

### Local data and offline

- [Database access](https://github.com/cwaynes/ember/blob/main/js/db.js): `js/db.js`
- [Core study data](https://github.com/cwaynes/ember/blob/main/data/core.db): `data/core.db`
- [Language data](https://github.com/cwaynes/ember/blob/main/data/language.db): `data/language.db`
- [Local persistence](https://github.com/cwaynes/ember/blob/main/js/storage-worker.js): `js/storage-worker.js`
- [Offline app cache](https://github.com/cwaynes/ember/blob/main/sw.js): `sw.js`
- [Application startup](https://github.com/cwaynes/ember/blob/main/js/app.js): `js/app.js`

### Other components

- **Bible student**

## Connections

- Bible student → Scripture reader: navigates
- Scripture reader → Database access: loads chapters
- Database access → Bible translations: queries verses
- Scripture reader → Verse selection: selects verses
- Verse selection → Reference panel: opens context
- Reference panel → Topics and cross-references: reads related data
- Reference panel → Original-language study: opens language tab
- Original-language study → Database access: queries words
- Original-language study → Morphology decoding: decodes morphology
- Morphology decoding → Database access: looks up categories
- Database access → Language data: queries language data
- Bible student → Notes and studies: creates notes
- Notes and studies → Database access: saves notes
- Bible student → Bookmarks: saves verses
- Bookmarks → Database access: stores bookmarks
- Bible student → Text markups: marks verses
- Text markups → Database access: stores markups
- Notes and studies → Note tags: adds tags
- Bible student → Unified search: searches study data
- Unified search → Database access: queries results
- Bible student → Reading plans: manages plans
- Reading plans → Database access: imports plans
- Bible student → Study templates: starts a study
- Application startup → Database access: initializes
- Database access → Core study data: reads and writes
- Database access → Local persistence: dispatches writes
- Local persistence → Core study data: persists bytes
- Application startup → Offline app cache: registers service worker
