The mental model behind m0saic
m0 is a layout language. A single string describes how rectangles subdivide inside a canvas — no pixels, no coordinates, just structure.
2(F,3[F,F,F])→// two columns, left gets 70%
10(>,>,>,>,>,>,F,>,>,F)
// three equal rows
3[F,F,F]
// nested: 2 columns, right split into 3 rows
2(F,3[F,F,F])
// gap between two tiles
5(F,>,>,-,F)
// overlay: content layered on top
2(F,F){F}The language is small. () split columns, [] split rows. F claims a tile, > donates space forward, - marks empty space, and {} layers content on top. That’s the entire surface.
CSS is a layout solution for the browser. Flexbox, Grid, and absolute positioning solve responsive, interactive UI. m0 solves a different problem.
F can be replaced with any valid m0 expression — one character or thousands. 2(F,F) becomes 2(3[F,F,F],F) by swapping one token. No special API — just strings.The trade-off: a bare m0 string does not reflow. It describes one canvas, exactly. Adapting to a canvas is the template’s job — a template derives its geometry from the size it is asked for, so the same template renders 16:9, 9:16 and 1:1 with a different string each time, and every one of them is deterministic. When your output is a rendered frame, that beats dynamic reflow.
Traditional video tools organize content on a timeline. Layers stack vertically, clips stretch horizontally. Time is the primary axis.
That works for editing. But for generating video programmatically — bar charts, dashboards, data visualizations, social media templates — time is the wrong abstraction. The hard part isn’t sequencing clips. It’s placing content in space.
m0saic uses geometry as its base. m0 is the geometry solution.
Instead of a timeline, you describe a layout. Each rectangle becomes a content slot. Fill the slots with images, videos, text, colors — or another layout, or a whole template. Frames are composited onto a final canvas based on the m0 geometry, and the engine hands the result to ffmpeg.
Time is just another property of how that static rectangle behaves — enable at 2s, fade in over 500ms, hold for 3s, fade out. The rectangle itself is absolute. Everything else is configuration.
Traditional video scales horizontally — more clips on a longer timeline. m0saic scales vertically through composition. A dashboard is a layout that nests calls to opinionated templates (bar-graph, donut, leaderboard), each of which returns its own m0 geometry and sources to fill those rectangles. That is what the Compose surface in Mosaic Web builds and what a .mosaicx file stores. Complexity grows through depth, not duration.
Here’s a real example. The @m0saic/alpine/bar-graph/v1 template takes data and renders an animated bar chart. One CLI call:
$ npx m0saic make @m0saic/alpine/bar-graph/v1 \
-w 1920 -h 1080 \
--props '{"values": [72, 45, 88, 31, 66], "orientation": "vertical", "preset": "dark"}' \
-o bar_chart.mp4Same template, same data, different resolution. The template maps data to geometry. The geometry maps to pixels. ffmpeg renders the output. No timeline, no manual placement — and if you would rather see it than type it, Make in Mosaic Web runs the same template against a live preview and hands you this command.
m0saic is not a video editor. It’s a video compiler.
A traditional editor is an interactive tool whose output depends on the hands on it. m0saic is interactive too — Make, Layout and Compose are all live — but the output never depends on the hands: the same template, props and canvas give the same pixels from the CLI, from Mosaic Desktop, or from a browser tab.
That’s why rectangles. They’re the atom of visual composition — simple enough to reason about, powerful enough to express any grid-based layout, and deterministic enough to compile.
m0 is open and versioned on its own. The parser, the formats, and the spec are all public — you can build on the language without m0saic at all. The language is the bottom of a stack of open packages that runs up through the template libraries; only the render engine and the apps are closed. The Open Core page lays the whole stack out.
The interactive course in Mosaic Web walks the string one character at a time on a live canvas — no install, no account.
Learn the language →