Skip to content
akib35 edited this page Nov 5, 2026 · 6 revisions

BlockFlow internals wiki

BlockFlow is a browser extension (Chrome, Firefox, Safari) for building automations out of connectable blocks, n8n style, written with WXT + React + TypeScript + React Flow. This wiki is the internals reference: what every module does, how the pieces talk to each other, and how to change them safely.

Source: this wiki lives in the repo at docs/wiki and is published to the Forgejo and GitHub wikis with npm run wiki:publish. Edit the files in the repo, never the web wiki pages (the next publish overwrites them).

Which document do I want?

You want to… Read
Use BlockFlow or have an AI build workflows Usage guide and the generated block reference
Understand the design and why it is shaped this way Architecture
Learn to write extensions by hand, starting from plain JS Learning course
Find out what a module does, or change it This wiki
Send a change Contributing

The big picture

 Editor (React, src/entrypoints/editor)      Background worker (src/entrypoints/background.ts)        Web pages
 ─────────────────────────────────────       ──────────────────────────────────────────────────        ─────────
 edit workflows ───────▶ storage ──────────▶ diff workflows, start/stop triggers
 Run / Stop / Pick ────▶ messages ─────────▶ WorkflowRunner (src/core) ──▶ Host (src/browser) ──▶ page agent (src/dom)
 run log, reports ◀───── storage ◀────────── runs, logs, datasets          alarms, tabs, CDP, offscreen
  • src/core: the engine and all blocks. No browser APIs; everything external goes through the Host interface, so it runs in plain Node tests.
  • src/browser: the real Host: tabs, scripting, alarms, storage, CDP, popups, downloads.
  • src/dom: code injected into web pages: the page agent, locators, picker and recorder.
  • src/entrypoints: the extension's entry points: background worker, editor page, content scripts, offscreen document.
  • src/shared: message types and storage keys shared by the worker and the editor.

Pages

Engine (src/core)

  • Core Engine: runner, runs, ports, sessions, the Host interface and the block contract
  • Core Modules: expressions, templates, conditions, CSV, reports, schedules, URL patterns, Playwright export…
  • Page Protocol: every page request a block can send to a tab
  • Block Internals: how blocks are built, with a table of all of them
  • Adding a Block: step by step, with a checklist

Browser side (src/browser, src/shared)

In the page (src/dom)

  • Page Agent: how page ops are carried out inside tabs and frames
  • Locators: locator syntax, resolution and generated locators
  • Picker and Recorder: element picking and recording actions as blocks

Editor (src/entrypoints/editor)

  • Editor: structure, state, storage and the workflow ↔ canvas conversion
  • Editor Components: one section per component

Project

Rules worth knowing before you touch anything

These come from CLAUDE.md, which has the full list:

  • src/core never imports browser APIs or DOM types. It reaches the outside only through Host.
  • Blocks never use setTimeout for workflow timing, because the MV3 worker sleeps. Use ctx.timers and ctx.state.
  • Payloads stay JSON-serialisable.
  • Use relative imports only, and import type for types.
  • After changing blocks, run npm run guide:sync. After changing a lesson, run npm run learn:sync. npm run check must pass.

Clone this wiki locally