Architecture

How the core, extensions, adapters and docs fit together.

Layers

text
Your app (React / Vue / Svelte)
        |
   Framework adapter  (@tlob/babloom-react | vue | svelte)
        |
   Editor core        (@tlob/babloom-core)
   - document model   - commands
   - selection        - history
   - extensions       - serialization
        |
   Extensions  ->  starter-kit | image | link | placeholder

Monorepo structure

text
babloom/
  apps/
    docs/                 # documentation site
  packages/
    core/                 # framework-agnostic editor
      src/editor, document, commands, extensions,
          selection, history, events, serialization
    react/                # React adapter
    vue/                  # Vue 3 adapter
    svelte/               # Svelte 5 adapter
  examples/react | vue | svelte
  pnpm-workspace.yaml
  turbo.json

Design principles

NameTypeDescription
Framework agnosticcoreCore must not depend on React, Vue or Svelte.
Extension firstextensionsFeatures are extensions, not hardcoded behaviour.
Document modeljsonStructured JSON document of nodes and marks.
CommandsapiUI calls commands instead of mutating state.
TransactionsstateChanges flow through snapshots so history and collaboration are possible.
Upload abstractionmediaImage storage is delegated to a user-provided handler.
Framework parityadaptersEvery adapter exposes the same editor API.

Document model

Blocks: paragraph, heading, blockquote, bullet list, ordered list, list item, image, horizontal rule. Inline: text with bold, italic, underline, strike, code and link marks.

json
{
  "type": "doc",
  "content": [
    {
      "type": "paragraph",
      "content": [
        { "type": "text", "text": "Hello " },
        { "type": "text", "text": "world", "marks": [{ "type": "bold" }] }
      ]
    }
  ]
}