# duckiteat/make-bio-database architecture

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

- Interactive diagram: https://gitdiagram.com/duckiteat/make-bio-database
- Repository: https://github.com/duckiteat/make-bio-database

## Overview

Duckiteat’s make bio database stores context-specific definitions as individually addressable concepts, with typed links and biochemical mechanism steps. The main workflow is: an AI drafts a patch from the current index, a person reviews it, and the browser or CLI validates and applies it to the database. Users can then inspect definition context and follow mechanism chains. The shared core implements the model and operations; the browser and CLI provide separate interfaces. Browser details and several README-described capabilities are represented from documentation, not sampled viewer source.

Main entry points: [`dbtool.mjs`](https://github.com/duckiteat/make-bio-database/blob/main/dbtool.mjs) (CLI), [`viewer.html`](https://github.com/duckiteat/make-bio-database/blob/main/viewer.html) (Browser viewer), [`examples/sample-patch.json`](https://github.com/duckiteat/make-bio-database/blob/main/examples/sample-patch.json) (Definition patch), [`data/db.json`](https://github.com/duckiteat/make-bio-database/blob/main/data/db.json) (Definition database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_browser_viewer["Browser viewer<br/>[viewer.html]"]
  node_index_entry["Index entry<br/>[index.html]"]
  node_cli["CLI<br/>[dbtool.mjs]"]
end

subgraph group_engine["Shared domain engine"]
  node_model_index["Definition and mechanism index<br/>[core.js]"]
  node_patch_engine["Patch and validation<br/>[core.js]"]
  node_context_engine["Context and mechanism output<br/>[core.js]"]
  node_prompt_migration["Prompt and migration<br/>[core.js]"]
end

subgraph group_knowledge["Database and history"]
  node_main_database[("Definition database<br/>[db.json]")]
  node_patch_history[("Applied patch history")]
  node_browser_storage[("Browser storage")]
end

subgraph group_ai["AI-assisted editing"]
  node_ai_guidance["AI instructions and index<br/>[core.js]"]
  node_patch_input["Definition patch<br/>[sample-patch.json]"]
  node_migration_input["Legacy bionote v3"]
  node_sample_patch["Sample patch<br/>[sample-patch.json]"]
end

node_person(("Person"))
node_ai_assistant(("AI assistant"))

node_person -->|"uses"| node_browser_viewer
node_index_entry -->|"aliases"| node_browser_viewer
node_browser_viewer -->|"loads database"| node_main_database
node_browser_viewer -->|"stores edits"| node_browser_storage
node_browser_viewer -->|"uses shared logic"| node_model_index
node_person -->|"runs commands"| node_cli
node_cli -->|"reads database"| node_main_database
node_cli -->|"validates and merges"| node_patch_engine
node_cli -->|"requests context or mechanism"| node_context_engine
node_cli -->|"requests prompt or migration"| node_prompt_migration
node_cli -->|"writes database"| node_main_database
node_cli -->|"records applied patches"| node_patch_history
node_model_index -->|"builds mechanism index"| node_context_engine
node_browser_viewer -->|"shows instructions"| node_ai_guidance
node_ai_guidance -->|"guides drafting"| node_ai_assistant
node_ai_assistant -->|"produces patch"| node_patch_input
node_patch_input -->|"is reviewed and applied"| node_browser_viewer
node_patch_input -->|"is merged"| node_cli
node_cli -->|"reads for migration"| node_migration_input
node_prompt_migration -->|"outputs migration patch"| node_patch_input
node_patch_input -->|"example format"| node_sample_patch

click node_browser_viewer "https://github.com/duckiteat/make-bio-database/blob/main/viewer.html"
click node_index_entry "https://github.com/duckiteat/make-bio-database/blob/main/index.html"
click node_cli "https://github.com/duckiteat/make-bio-database/blob/main/dbtool.mjs"
click node_model_index "https://github.com/duckiteat/make-bio-database/blob/main/core.js"
click node_patch_engine "https://github.com/duckiteat/make-bio-database/blob/main/core.js"
click node_context_engine "https://github.com/duckiteat/make-bio-database/blob/main/core.js"
click node_prompt_migration "https://github.com/duckiteat/make-bio-database/blob/main/core.js"
click node_main_database "https://github.com/duckiteat/make-bio-database/blob/main/data/db.json"
click node_patch_history "https://github.com/duckiteat/make-bio-database/tree/main/data/patches"
click node_ai_guidance "https://github.com/duckiteat/make-bio-database/blob/main/core.js"
click node_patch_input "https://github.com/duckiteat/make-bio-database/blob/main/examples/sample-patch.json"
click node_sample_patch "https://github.com/duckiteat/make-bio-database/blob/main/examples/sample-patch.json"

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_browser_viewer,node_index_entry,node_cli toneBlue
class node_model_index,node_patch_engine,node_context_engine,node_prompt_migration toneAmber
class node_main_database,node_patch_history,node_browser_storage toneMint
class node_ai_guidance,node_patch_input,node_migration_input,node_sample_patch toneRose
class node_person,node_ai_assistant toneIndigo
```

## Components

### User interfaces

- [Browser viewer](https://github.com/duckiteat/make-bio-database/blob/main/viewer.html): `viewer.html`
- [Index entry](https://github.com/duckiteat/make-bio-database/blob/main/index.html): `index.html`
- [CLI](https://github.com/duckiteat/make-bio-database/blob/main/dbtool.mjs): `dbtool.mjs`

### Shared domain engine

- [Definition and mechanism index](https://github.com/duckiteat/make-bio-database/blob/main/core.js): `core.js`
- [Patch and validation](https://github.com/duckiteat/make-bio-database/blob/main/core.js): `core.js`
- [Context and mechanism output](https://github.com/duckiteat/make-bio-database/blob/main/core.js): `core.js`
- [Prompt and migration](https://github.com/duckiteat/make-bio-database/blob/main/core.js): `core.js`

### Database and history

- [Definition database](https://github.com/duckiteat/make-bio-database/blob/main/data/db.json): `data/db.json`
- [Applied patch history](https://github.com/duckiteat/make-bio-database/tree/main/data/patches): `data/patches`
- **Browser storage**

### AI-assisted editing

- [AI instructions and index](https://github.com/duckiteat/make-bio-database/blob/main/core.js): `core.js`
- [Definition patch](https://github.com/duckiteat/make-bio-database/blob/main/examples/sample-patch.json): `examples/sample-patch.json`
- **Legacy bionote v3**
- [Sample patch](https://github.com/duckiteat/make-bio-database/blob/main/examples/sample-patch.json): `examples/sample-patch.json`

### Other components

- **Person**
- **AI assistant**

## Connections

- Person → Browser viewer: uses (evidence: `README.md`)
- Index entry → Browser viewer: aliases (evidence: `README.md`)
- Browser viewer → Definition database: loads database (evidence: `README.md`)
- Browser viewer → Browser storage: stores edits (evidence: `README.md`)
- Browser viewer → Definition and mechanism index: uses shared logic (evidence: `README.md`)
- Person → CLI: runs commands (evidence: `dbtool.mjs`)
- CLI → Definition database: reads database (evidence: `dbtool.mjs`)
- CLI → Patch and validation: validates and merges (evidence: `dbtool.mjs`)
- CLI → Context and mechanism output: requests context or mechanism (evidence: `dbtool.mjs`)
- CLI → Prompt and migration: requests prompt or migration (evidence: `dbtool.mjs`)
- CLI → Definition database: writes database (evidence: `dbtool.mjs`)
- CLI → Applied patch history: records applied patches (evidence: `dbtool.mjs`)
- Definition and mechanism index → Context and mechanism output: builds mechanism index (evidence: `core.js`)
- Browser viewer → AI instructions and index: shows instructions (evidence: `README.md`)
- AI instructions and index → AI assistant: guides drafting (evidence: `README.md`)
- AI assistant → Definition patch: produces patch (evidence: `README.md`)
- Definition patch → Browser viewer: is reviewed and applied (evidence: `README.md`)
- Definition patch → CLI: is merged (evidence: `README.md`)
- CLI → Legacy bionote v3: reads for migration (evidence: `dbtool.mjs`)
- Prompt and migration → Definition patch: outputs migration patch
- Definition patch → Sample patch: example format (evidence: `README.md`)
