Open core. The language is yours.

m0saic is one idea — every layout is a string of rectangles — carried by a stack of small packages. Everything from the language up through the template libraries is open source or on its way there: 12 packages, four already on npm, the rest landing in the m0saic-project org. This page is the architecture in one read: what each layer does, what it depends on, and where to find it.

closedMosaic DesktopMosaic Webthe CLIthe render engine
the line
opentemplatesplatformtypesthe m0 languagethe Community M
01
The language
The m0 string — every layout is one line of rectangles. Parser, validator, algebra, file formats and the builders that produce m0. This is the substrate; everything else sits on it.
@m0saic/dsl

The m0 grammar: parser, validator and AST algebra. Frozen at 1.x — the one package the whole system agrees on.

depends on:

@m0saic/dsl-stdlib

Builders, transforms and queries that produce m0 strings — placeRect, golden, bentoGrid, weightedSplit, the QR generator. If it emits m0, it lives here.

depends on: dsl · dsl-file-formats

@m0saic/dsl-file-formats

The on-disk transport: parse and serialize .m0, .m0c and .m0p — a bare layout, a layout with labels and overlays, a pack of them.

depends on: dsl

@m0saic/dsl-visual-tests

The golden visual-test harness and the DSL coverage suite — pixel-diffed, pinned to one rasterizer, the proof that the grammar renders the same everywhere.

depends on: dsl · dsl-file-formats · dsl-stdlib

02
Contracts and platform
The shared vocabulary and the plumbing. Types every package agrees on, plus the layer that loads documents, resolves assets and template repos, speaks the share-link wire format, and records local telemetry — in the open, so you can read exactly what leaves your machine.
@m0saic/types

Canonical TypeScript types for documents, sources, templates, outputs and telemetry. The lowest-level public surface; nothing below it but the DSL.

depends on: dsl

@m0saic/platform

Document loaders and validators, asset and secret resolvers, template-repo loading, the ffmpeg toolchain fetch, the share-link codec, and the telemetry client (local records, rollups, the sender). Public so the privacy story is checkable.

depends on: dsl · dsl-stdlib · types

@m0saic/text

Text → SVG glyph paths with a bundled deterministic font, so text in a layout is geometry too and renders identically on every machine.

depends on:

@m0saic/dictionary

The shape library: named layouts — the 33-tile M, the brand pattern, QR bodies, masks, generators — as .m0c entries any template or the editor can drop in.

depends on: dsl · dsl-file-formats · dsl-stdlib · types

03
Templates
What people actually render. A template is a TypeScript function that returns a document: a layout string, one source per tile, typed props the editor turns into controls. The runtime helpers, the built-in library, and the community library.
@m0saic/template-utils

The authoring runtime — defineMosaicTemplate, props schemas, seeded randomness, primitives, ffmpeg expression builders, the forensic namespace. Anything an author uses that isn't producing m0.

depends on: dsl · dsl-stdlib · platform · types

@m0saic/templates

The built-in library that ships with the product: brand, hero, charts, alpine data-viz, media, social, agents, GitHub, forensic. One registry, every id frozen once shipped.

depends on: dictionary · dsl-stdlib · platform · template-utils · types

@m0saic/community-templates

Community-contributed templates, one folder per publisher, ids @handle/pack/slug/vN. Signed releases; the same manifest shape as the official library.

depends on: dsl-stdlib · platform · template-utils · types

04
Community
The brand mark itself is a layout, and every tile of it is a slot someone can claim.
@m0saic/community-m

The Community M — the 33-tile brand M as .m0c/.m0p, one slot folder per contributor, the generated index the app and CLI read, and zero-dependency tools to validate, assemble and claim a tile.

depends on:

Dependency graph of every public m0saic package: templates depend on platform and types, which depend on the m0 language packages. Arrows point from a package to what it depends on.
Every public package and what it depends on, with the closed render engine at the top as the one consumer. Arrows point to the dependency; nothing points up, and nothing public points at the engine. The engine pulls from this graph, one WebAssembly library for SVG rasterizing, and the ffmpeg binary it fetches on request — nothing else. Orange nodes are on npm today. Generated from the monorepo package map by scripts/gen-dependency-graph.mjs.

Dependencies only point down. The language depends on nothing. Types and platform depend on the language. Templates depend on types, platform and the language. Nothing public reaches into the closed engine — that rule is enforced by an import-graph check in the monorepo, so a public package can always be built and tested on its own. The published DSL packages carry semver with a changelog entry on every change; the rest are versioned with the product until they graduate.

Want to build on it today? The template repo starter is a working template repository against the published packages, the language paper is the grammar in full, and Learn in Mosaic Web teaches it interactively.

Next: write a template · the Community M · why rectangles