The IR

The intermediate representation is the heart of Milda: a platform-neutral, serializable model of your entire design system. It is the single source of truth that the editor writes and every generator reads.

#What it is

The IR is a canonical model — think of it as an abstract syntax tree for a design system. It describes components, their structure and contracts, and the foundations they draw from. It has a human-readable form for diffing and review, but its canonical shape is plain data (JSON), so machines can consume it losslessly. It is produced by the editor, not hand-authored.

#Why platform-neutral

The IR deliberately contains no web-specific concepts — no CSS, no HTML element names, no framework hooks. A button is described by what it is and what it does, not by <button> or a class name. Everything platform-specific is decided later, by a generator, when it realizes the IR for a particular target.

This neutrality is what makes a single design system portable across targets:

  • Realizations map neutral structure and behavior to a target's primitives — a toggle becomes a checkbox on the web and could become a switch elsewhere.
  • Token aliasing resolves neutral values per context (color scheme, density, platform) without baking any one platform's answer into the model.

#Why a single source of truth matters

  • No drift. Editor, preview, and generated code all derive from the same model, so they can't disagree.
  • Interchange. Because the IR is a stable, serializable contract, tools can exchange design systems without a bespoke adapter for each pair.
  • Reproducibility. The same IR generates the same output every time — the foundation for versioning and safe releases.
The spec
The language version 0.1 is frozen, with a normative JSON Schema and grammar, and has been validated end-to-end against a real-world component corpus. The IR lives in the @milda/core package; see Packages. Editor-facing grammar tooling (syntax highlighting, transpilers) is on the roadmap, not yet built.

Next: how foundations and components are modeled within the IR — Foundations and Components & structure.