Lab 01: Design System Architecture

Time: 60 minutes | Level: Architect | Docker: node:20-alpine

Overview

Build a production design system using a multi-tier token architecture (primitive → semantic → component), automated Style Dictionary pipelines, and versioning strategies for cross-platform delivery.


Step 1: Token Architecture — Three-Tier Model

Design tokens follow a strict hierarchy: Primitive → Semantic → Component.

tokens/
├── primitive/
│   ├── colors.json       # Raw values: blue-500: #3b82f6
│   ├── spacing.json      # Raw values: 4: 0.25rem
│   └── typography.json   # Raw values: font-size-base: 1rem
├── semantic/
│   ├── colors.json       # Aliases: brand-primary → {color.primitive.blue.500}
│   └── spacing.json      # Aliases: component-padding → {spacing.4}
└── component/
    └── button.json       # btn-bg → {color.semantic.brand.primary}

Primitive tokens — raw values with no semantic meaning:

💡 Never reference primitive tokens directly in components. Always go through semantic tokens — this is what enables theming.


Step 2: Semantic Token Layer


Step 3: Component Token Layer


Step 4: Style Dictionary Pipeline Configuration

💡 outputReferences: true preserves CSS custom property references (var(--ds-color-primitive-blue-500)) instead of resolved values — crucial for runtime theming.


Step 5: Run the Pipeline


Step 6: Versioning Strategy

Semantic versioning rules for design tokens:

  • PATCH (2.1.0 → 2.1.1): New tokens, description updates

  • MINOR (2.1.x → 2.2.0): Renamed tokens (keep old as deprecated aliases)

  • MAJOR (2.x.x → 3.0.0): Removed tokens, breaking value changes


Step 7: Storybook Integration Concept


Step 8: Capstone — Full Pipeline Demo

📸 Verified Output:


Summary

Concept
Tool/Pattern
Output

Primitive tokens

JSON source files

Raw design decisions

Semantic tokens

Alias references

Themeable meanings

Component tokens

Semantic aliases

Component-specific CSS vars

CSS output

Style Dictionary

--ds-* custom properties

iOS output

Style Dictionary

Swift constants

Android output

Style Dictionary

XML resources

TypeScript output

Custom formatter

Typed constants

Versioning

Semantic versioning

Breaking change tracking

Documentation

Storybook + designToken addon

Living style guide

Last updated