Skip to content

dsrDesign System Runtime

A persistent kernel that serves your design system graph to every tool in your stack — tokens, rules, components, and entropy — over a fast local IPC transport.

What is DSR?

The Design System Runtime (DSR) is a long-lived Node.js daemon that holds the complete design system graph in memory. It is the authoritative source of truth for:

  • Design tokens — resolved DTIF token graph, indexed by pointer and by type
  • Rules — configurable lint rules from design-lint and plugins
  • Components — registered component definitions and their design system relationships
  • Deprecations — token and component deprecation ledger with optional replacements
  • Entropy — a rolling score measuring design system health over time

Tools such as design-lint, LSP servers, MCP servers, and CI scripts connect to the kernel over the Kernel Wire Protocol (KWP) and use DSQL to query or mutate state. The kernel broadcasts all mutations as typed events to all connected clients.

Connect from any environment

DSR ships three connection environments out of the box:

  • NodeEnvironment — connects via Unix domain socket with automatic HTTP fallback. Used by design-lint CLI, LSP servers, and MCP servers running on the same host.
  • BrowserEnvironment — connects via HTTP with optional SSE push events. Used by online IDEs and browser-based design tools.
  • EdgeEnvironment — restores the kernel state from a binary snapshot without connecting to a live kernel. Used in CI pipelines, edge functions, and offline builds.

Query with DSQL

DSQL is a fluent, in-memory query API that speaks the same language whether the underlying executor is local (in-process) or remote (over KWP):

ts
import { NodeEnvironment } from '@lapidist/dsr/environments/node';

const env = new NodeEnvironment();
await env.connect();

// Find the closest token match for a raw CSS value
const matches = await env.dsql.tokens('color').closest('#3B82F6', 'color');

// List all enabled, fixable rules in the "tokens" category
const fixable = await env.dsql.rules('tokens').fixable();

Released under the MIT License.