Tools for building Offline-first Web Apps
README.md

Inro architecture specs #

The reference specs for how Inro works internally — data formats, protocols, interfaces, and invariants. These describe realized behavior: what the shipped code actually does. Design exploration, deferred ideas, and unrealized proposals are out of scope. When a realized feature has a known limitation, the spec notes it in one line.

For how to build apps on these packages, see docs/apps/. Those are task guides — this directory is the protocol/interface reference they link into.


Stable references (§N.S.T) #

Every feature is one numbered file under features/. A feature owns its number: its headings are ## N.S and ### N.S.T, so a section number is globally unique and its first digit identifies the file. Cite spec from anywhere — docs, code comments, commit messages — by the bare number, e.g. §1.4.5 = features/01_ui.md → 1.4.5 Rendered Shape, or §4.5 = features/04_versioning.md → the commit-store registration path.

§ Feature File Primary package(s)
1 UI features/01_ui.md @inro/ui
2 Client Runtime features/02_client_runtime.md @inro/ui (modules/)
3 Workers features/03_workers.md @inro/workers
4 Versioning features/04_versioning.md @inro/workers + @inro/cli
5 CLI features/05_cli.md @inro/cli

Cross-repo citations. Inro was carved out of the Civility monorepo, and the two reference each other. A bare §N always means this repo's spec; a citation into the sibling is written Civility §N.S.T and resolves against ../../civility/docs/spec/ (e.g. Civility §3.6.2 = the sync spec's blob proxy contract). Civility's docs cite back here as Inro §N.S.T.

Pre-split numbering. These specs kept their subsection numbers through the split, so a citation written against the old Civility numbering still resolves: old §6.x (UI) is now §1.x here, §19.x → §2.x, §17.x → §3.x, §18.x → §4.x, and §10.x (CLI, app half) → §5.x. Sections whose content stayed in Civility keep a numbered stub here pointing across (e.g. §1.4.2, §3.5).


System architecture #

An Inro app is a static bundle — HTML, an ES-module entry, a service worker, CSS — built by @inro/cli and served from any static host. The three packages divide the app shell:

┌──────────────────────────────────────────────────────────────┐
│  Inro app (static bundle)                                    │
├──────────────────────────────────────────────────────────────┤
│  @inro/ui        — presentation + app shell        (§1, §2)  │
│  ┌─────────────────────────────────────────────────────┐     │
│  │  inro.css     — landmarks, base, ui-*, themes  (§1) │     │
│  │  Router / createLayoutRouter                  (§1.2) │     │
│  │  createApp    — connectivity, notifications,        │     │
│  │                 version state                  (§2)  │     │
│  │  ui-* elements — light DOM, no invented classes     │     │
│  └─────────────────────────────────────────────────────┘     │
│  @inro/workers   — service-worker plugins + client (§3)      │
│  ┌─────────────────────────────────────────────────────┐     │
│  │  init([withPrecache, withCleanup, withUpdate…])     │     │
│  │  commit store — the page/worker version pin   (§4)  │     │
│  └─────────────────────────────────────────────────────┘     │
├──────────────────────────────────────────────────────────────┤
│  @inro/cli       — inro init / build / start       (§5)      │
│    versioned output dirs · __INRO__ banner · boot.js (§4)    │
└──────────────────────────────────────────────────────────────┘

Everything cloud-shaped — a document store, sync, sharing, encryption, accounts — is Civility's: its civ-* components render Inro elements, its worker plugins satisfy @inro/workers' structural WorkerPlugin, and its CloudStore satisfies createApp's structural SyncSource. The dependency points one way only.

The boundary rule #

No @inro/* package may depend on any @civility/* package, at any depth. Cloud-shaped collaborators arrive by structural type, never by import. This is enforced, not documented-and-hoped: scripts/check_boundaries.ts resolves every published export's full module graph with deno info and fails on any @civility/* specifier — including type-only imports and dangling import-map entries. It runs as deno task test:boundaries, a dependency of deno task test.

The one deliberate duplication this rule buys: @inro/ui/subscription's Emitter/KeyedEmitter/Subscription mirror @civility/store's (§2.0) — structural, so either side's subscriptions satisfy the other.

The build↔runtime contract between @inro/cli and @inro/workers (the __INRO__ banner, boot.js's hand-transcribed commit store, current.json) is convention rather than import, held together by tests over the generated output (§4, §5.4).