dspack Specification

May 21, 2026 · View on GitHub

Version: 0.1

Status: Draft

This document defines the dspack format version 0.1. dspack is a JSON-based format for representing design system corpora — tokens, components, patterns, anti-patterns, and framework bindings — in a structure that tools and AI coding agents can query.

This is a draft specification. It is not yet stable. Breaking changes may occur in future versions without a formal deprecation process. The spec will be stabilized at version 1.0.


Table of Contents

  1. Conformance
  2. File Identification
  3. Document Structure
  4. Metadata
  5. Tokens
  6. Components
  7. Patterns
  8. Anti-Patterns
  9. Framework Bindings
  10. Relationships
  11. Extensibility
  12. ID and Naming Conventions
  13. File Extension
  14. Open Questions

1. Conformance

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

A conforming dspack document is a JSON document that satisfies all MUST-level requirements defined in this specification.

A conforming consumer is a program that can parse any conforming dspack document without error. Conforming consumers MUST ignore properties they do not recognize rather than rejecting the document.


2. File Identification

A dspack document is identified by the presence and value of the dspack property at the top level of the JSON document.

  • The dspack property MUST be present.
  • The dspack property MUST be a string.
  • For documents conforming to this version of the specification, the value MUST be "0.1".

Consumers MUST check the dspack property before parsing the rest of the document. A consumer that does not recognize the major version (the portion before the first .) MUST reject the document. A consumer MAY accept a document with a higher minor version than it recognizes, ignoring any properties it does not understand.


3. Document Structure

A dspack document is a single JSON object. The top-level properties are:

PropertyTypeRequiredDescription
dspackstringREQUIREDSpec version. See File Identification.
namestringREQUIREDHuman-readable name of the design system.
$schemastringOPTIONALURI reference to a JSON Schema for editor validation. Consumers MUST NOT require this property.
descriptionstringOPTIONALBrief description of the design system's purpose and scope.
versionstringOPTIONALVersion of the design system content (not the spec). Semver is RECOMMENDED but not required.
metadataobjectOPTIONALExtensible metadata. See Metadata.
tokensobjectOPTIONALToken definitions organized by category. See Tokens.
componentsobjectOPTIONALComponent definitions keyed by component ID. See Components.
patternsarrayOPTIONALPattern entries. See Patterns.
antiPatternsarrayOPTIONALAnti-pattern entries. See Anti-Patterns.
frameworkBindingsobjectOPTIONALFramework-specific information. See Framework Bindings.

All top-level properties other than dspack and name are OPTIONAL. A valid dspack document MAY contain only the dspack version and a name. This allows the format to represent design systems that are partial, in transition, or that document only some aspects of their knowledge.

A conforming consumer MUST NOT reject a document because an optional section is absent.


4. Metadata

The metadata object carries information about the dspack file itself, as opposed to the design system it describes.

PropertyTypeRequiredDescription
generatedBystringOPTIONALTool or process that created the file.
generatedAtstringOPTIONALISO 8601 datetime when the file was generated.
sourcestringOPTIONALURL or description of the upstream source.
licensestringOPTIONALSPDX license identifier or freeform description.

The metadata object is explicitly extensible. Consumers MUST ignore properties in metadata that they do not recognize. Unlike other objects in the document, custom properties in metadata do not require the x- prefix defined in Extensibility.


5. Tokens

The tokens object organizes token definitions by category. Each key in the tokens object is a category name and its value is a token category object.

5.1 Token Category Object

PropertyTypeRequiredDescription
descriptionstringOPTIONALWhat this category covers.
valuesobjectREQUIREDMap of token name to token entry.

Each key in values is a token name and its value is a token entry object.

5.2 Token Entry Object

PropertyTypeRequiredDescription
valuestringREQUIREDThe resolved value of the token.
descriptionstringOPTIONALSemantic meaning of the token — what it represents, not just what it resolves to.
typestringOPTIONALThe value type. See Token Types.
deprecatedbooleanOPTIONALWhether this token is deprecated. Defaults to false if absent.
aliasesarray of stringsOPTIONALOther names by which this token is known.

The value property MUST be a string, even for values that could be represented as numbers. This preserves units, notation, and format (e.g., "0.25rem", "hsl(222.2, 47.4%, 11.2%)", "400").

Token values are resolved — they represent the final computed value of the token, not a reference to another token or a build-system variable. A dspack file is a snapshot of a design system's knowledge at a point in time. Token resolution pipelines are outside the scope of this specification.

5.3 Token Types

The type property indicates what kind of value the token represents. The following values are RECOMMENDED:

  • color — a color value in any notation (hex, rgb, hsl, oklch, etc.)
  • dimension — a size or distance value with a unit (e.g., "0.25rem", "4px")
  • fontFamily — a font family name or stack
  • fontWeight — a font weight value
  • fontSize — a font size value with a unit
  • lineHeight — a line height value
  • letterSpacing — a letter spacing value
  • duration — a time duration (e.g., "150ms", "0.2s")
  • cubicBezier — a cubic bezier easing curve
  • shadow — a shadow definition
  • borderRadius — a border radius value
  • opacity — an opacity value
  • number — a unitless numeric value
  • string — an arbitrary string value

This list is not exhaustive. Custom type values are permitted. Consumers that encounter an unrecognized type MUST NOT reject the token entry.


6. Components

The components object maps component IDs to component entry objects. Each key is a component ID conforming to the naming conventions defined in ID and Naming Conventions.

6.1 Component Entry Object

PropertyTypeRequiredDescription
namestringREQUIREDHuman-readable display name.
descriptionstringREQUIREDWhat the component is for.
whenToUsestringOPTIONALGuidance on when to use this component.
whenNotToUsestringOPTIONALGuidance on when to choose a different component.
propsobjectOPTIONALMap of prop name to prop descriptor. See Prop Descriptors.
tokensarray of stringsOPTIONALToken names this component depends on.
relatedComponentsarray of stringsOPTIONALComponent IDs of related components.
tagsarray of stringsOPTIONALFreeform classification tags.
deprecatedbooleanOPTIONALWhether this component is deprecated. Defaults to false if absent.
deprecatedMessagestringOPTIONALWhat to use instead of this component.

The whenToUse and whenNotToUse properties are separate fields rather than a combined structure. This allows consumers to retrieve usage guidance and avoidance guidance independently.

The tokens array contains token names (the keys within a token category's values object). If the same token name appears in more than one category, the reference is ambiguous. Authors SHOULD use unique token names across categories to avoid this.

The relatedComponents array contains component IDs (keys in the top-level components object). A consumer SHOULD NOT reject a document if a referenced component ID does not exist in the document; the reference MAY point to a component that is not included in this particular dspack file.

6.2 Prop Descriptor

Each key in the props object is a prop name, and its value is a prop descriptor object.

PropertyTypeRequiredDescription
typestringREQUIREDThe value type of the prop.
descriptionstringOPTIONALWhat this prop controls.
valuesarrayOPTIONALFor enum type, the allowed values.
defaultanyOPTIONALDefault value of the prop.
requiredbooleanOPTIONALWhether this prop must be provided. Defaults to false if absent.

The following type values are RECOMMENDED for prop descriptors:

  • string — a text value
  • number — a numeric value
  • boolean — a true/false value
  • enum — one of a fixed set of values (listed in values)
  • object — a structured value
  • array — a list value
  • node — a renderable child (framework-dependent concept)
  • function — a callback

Custom type values are permitted.

Prop descriptors describe the API surface of a component at a level sufficient for a consumer to understand how to use the component. They are not a complete type system. A dspack file does not replace TypeScript interfaces, PropTypes, or other framework-specific type definitions.


7. Patterns

The patterns property is an array of pattern entry objects. Patterns describe preferred ways of combining components to solve recurring problems.

7.1 Pattern Entry Object

PropertyTypeRequiredDescription
idstringREQUIREDUnique identifier. See ID and Naming Conventions.
namestringREQUIREDHuman-readable name.
descriptionstringREQUIREDWhat problem this pattern addresses.
intentstringOPTIONALThe underlying design goal or UX objective.
contextstringOPTIONALWhen this pattern applies — the conditions or use cases.
componentsarray of stringsOPTIONALComponent IDs involved in this pattern.
guidancestringOPTIONALProse guidance on how to apply the pattern correctly.
relatedPatternsarray of stringsOPTIONALPattern IDs of related patterns.
tagsarray of stringsOPTIONALFreeform classification tags.

Pattern IDs MUST be unique within the patterns array. A conforming consumer SHOULD NOT reject a document if a components reference or relatedPatterns reference does not match an entry in the document.

The guidance property is a prose string, not a structured set of steps. Pattern guidance is inherently contextual and does not lend itself to a rigid structure.


8. Anti-Patterns

The antiPatterns property is an array of anti-pattern entry objects. Anti-patterns describe approaches that the design system has deliberately ruled out.

8.1 Anti-Pattern Entry Object

PropertyTypeRequiredDescription
idstringREQUIREDUnique identifier. See ID and Naming Conventions.
namestringREQUIREDHuman-readable name describing what not to do.
descriptionstringREQUIREDWhat this anti-pattern is.
reasonstringREQUIREDWhy this approach is ruled out.
insteadUsestringOPTIONALPattern ID of the preferred approach.
componentsarray of stringsOPTIONALComponent IDs involved in this anti-pattern.
tagsarray of stringsOPTIONALFreeform classification tags.

The reason property is REQUIRED. An anti-pattern without a reason is a prohibition without context. The reason captures the institutional knowledge — why the team decided this approach is problematic — and is often the most valuable information in the entry.

The insteadUse property, when present, SHOULD reference the id of a pattern in the patterns array. This creates a direct link from "do not do this" to "do this instead."

Anti-pattern IDs MUST be unique within the antiPatterns array.


9. Framework Bindings

The frameworkBindings object maps framework identifiers to framework binding objects. Each key is a framework identifier conforming to the naming conventions defined in ID and Naming Conventions.

9.1 Framework Binding Object

PropertyTypeRequiredDescription
namestringREQUIREDHuman-readable framework name.
packagestringOPTIONALPrimary package name.
installCommandstringOPTIONALHow to install the framework binding.
descriptionstringOPTIONALWhat this binding provides.
guidancestringOPTIONALFramework-wide guidance.
componentsobjectOPTIONALPer-component framework details. See Per-Component Binding.

9.2 Per-Component Binding

Each key in the components object within a framework binding is a component ID (matching a key in the top-level components object), and its value is a component binding object.

PropertyTypeRequiredDescription
importPathstringOPTIONALWhere to import the component.
installCommandstringOPTIONALComponent-specific install command.
exportNamestringOPTIONALNamed export if different from the component name.
guidancestringOPTIONALFramework-specific usage guidance for this component.

Framework bindings are a top-level section rather than nested inside individual component entries. This keeps component definitions framework-agnostic and avoids repeating framework-wide information (package name, global install command) in every component.

The per-component details under frameworkBindings[framework].components are joined to the top-level components entries by component ID. A consumer that needs the full picture of a component in a specific framework combines the component entry with the corresponding per-component binding.


10. Relationships

Relationships between concepts in a dspack document are represented through ID references rather than explicit edge objects.

The following relationships are defined:

FromToPropertyMeaning
ComponentTokencomponent.tokens[]The component depends on these tokens.
ComponentComponentcomponent.relatedComponents[]These components are related.
PatternComponentpattern.components[]The pattern involves these components.
PatternPatternpattern.relatedPatterns[]These patterns are related.
Anti-patternPatternantiPattern.insteadUseUse this pattern instead.
Anti-patternComponentantiPattern.components[]These components are involved.
Framework bindingComponentframeworkBindings[fw].components[id]Framework-specific details for this component.

References are by ID string. A conforming consumer SHOULD NOT reject a document if a reference target does not exist in the same document. This allows partial documents where not every referenced entity is included.


11. Extensibility

dspack uses a reserved-prefix convention for extensibility.

11.1 Extension Properties

Any object in a dspack document MAY contain additional properties whose keys begin with x- (e.g., x-figmaNodeId, x-internalOwner, x-designStatus).

Conforming consumers MUST ignore x--prefixed properties that they do not recognize.

11.2 The Metadata Exception

The metadata object is fully extensible without the x- prefix. Custom keys in metadata do not need the x- prefix because metadata is explicitly designated as the location for tool-specific and organization-specific information.

11.3 Reserved Properties

Top-level properties and properties within spec-defined objects that do not start with x- and are not defined by this specification are reserved for future versions of the spec. Consumers SHOULD warn when they encounter unrecognized non-x- properties but MUST NOT reject the document.


12. ID and Naming Conventions

All identifiers used as object keys or reference values — component IDs, token names, token category names, pattern IDs, anti-pattern IDs, and framework identifiers — MUST conform to the following rules:

  • IDs MUST match the regular expression ^[a-z][a-z0-9-]*$ (lowercase ASCII letter followed by zero or more lowercase letters, digits, or hyphens).
  • IDs MUST be unique within their namespace. Component IDs are unique among components, pattern IDs are unique among patterns, anti-pattern IDs are unique among anti-patterns, token names are unique within a single token category, and token category names are unique within the tokens object.
  • IDs SHOULD be meaningful, readable slugs derived from the entity's name (e.g., alert-dialog for "Alert Dialog").

13. File Extension

The RECOMMENDED file extension for dspack documents is .dspack.json. This makes the file identifiable by name while retaining the .json suffix for editor support and tooling compatibility.

The file extension is a convention, not a requirement. Consumers MUST identify dspack documents by the presence and value of the dspack property, not by file extension.


14. Open Questions

The following are unresolved design questions acknowledged by this draft. They are non-normative and are recorded here to make open areas of the design explicit rather than leaving ambiguity hidden.

14.1 Token References

Version 0.1 requires token values to be resolved (final computed values). A future version may support token-to-token references (e.g., "value": "{color.primary}") to represent alias relationships. The design of such a reference system — including syntax, resolution order, and cycle detection — is deferred.

14.2 Compound Components

Some component libraries expose compound components — a primary component with closely related sub-components (e.g., AlertDialog.Trigger, AlertDialog.Content). Version 0.1 does not define a structured representation for sub-components. Authors MAY describe compound component structure in the component's description or whenToUse text. A future version may introduce a subComponents property or similar mechanism.

14.3 Localization

Version 0.1 does not define a mechanism for providing descriptions, guidance, or other prose fields in multiple languages. All string fields are assumed to be in a single language. If localization becomes a requirement, it would likely be addressed through a separate mechanism rather than by duplicating every string field.

14.4 Multi-File Documents

Version 0.1 assumes a dspack corpus is a single JSON file. Some design systems may be large enough to benefit from splitting the document across multiple files (e.g., one file per token category or component group). A future version may define conventions for multi-file corpora, including a manifest or index file.

14.5 Token Type Taxonomy

The recommended token types listed in Section 5.3 are an open set — custom values are permitted. A future version may choose to close this set or define a registry. The current approach favors flexibility over strictness.