# adobe/spectrum-tokens architecture

> Architecture diagram of the GitHub repository adobe/spectrum-tokens, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/adobe/spectrum-tokens
- Repository: https://github.com/adobe/spectrum-tokens

## Overview

a. Token Definition Flow:
- Raw Token Files → Schema Validation → Transform/Build → Distribution

b. Documentation Generation:
- Token Definitions → Static Site Generator → Public Documentation

c. Visualization Flow:
- Token Definitions → Visualizer Engine → Interactive Display

##### Key Integration Points (use connection points)

- Schema Validation System
- Version Control Integration
- Build Pipeline Integration
- Package Distribution System

##### Specific Implementation Details

- JSON Schema Files (validation layer)
- Build Tools (transformation layer)
- Documentation Components
- Visualization Components
- Distribution Mechanisms

##### Component Interactions

How the following interact:
- Token Definition → Schema Validation
- Schema Validation → Build Process
- Build Process → Distribution
- Token Changes → Diff Generator
- Token Data → Visualizer

##### External Dependencies (show as external systems)

- NPM Registry
- GitHub Actions
- Documentation Hosting
- Build Systems

Flow from:
- Local Development → Validation → Testing → CI/CD → Release

Important Considerations:

##### Validation and transformation pipeline
- Schema validation
- Token transformation
- Build process
- Distribution

##### Monitoring and validation points
- Schema validation
- Test integration
- Build verification
- Release management

##### Separation between
- Development tools
- Build infrastructure
- Distribution systems
- Documentation platforms

Remember to indicate the asynchronous nature of certain processes (like builds and releases) and show how the different tools interact with the core token repository.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Core ["Core Token Management"]
        TD["Token Definitions"]
        SD["Schema Definitions"]
        TT["Token Types"]
    end

    subgraph Docs ["Documentation Layer"]
        DS["Static Documentation Site"]
        TV["Token Visualizer"]
    end

    subgraph Tools ["Tools Layer"]
        DG["Diff Generator"]
        CG["CSV Generator"]
        MB["Manifest Builder"]
        TF["Token Transformer"]
    end

    subgraph Build ["Build & Distribution"]
        PM["Package Management"]
        TR["Task Runner"]
        RM["Release Management"]
        CI["CI/CD Pipeline"]
    end

    TD --> SD
    SD --> TT
    TD --> Tools
    SD --> Tools

    DG --> Build
    CG --> Build
    MB --> Build
    TF --> Build

    TD --> DS
    TD --> TV
    
    Tools --> Build
    Build --> Docs

    %% Click events for component mapping
    click TD "https://github.com/adobe/spectrum-tokens/tree/main//packages/tokens/src/"
    click SD "https://github.com/adobe/spectrum-tokens/tree/main//packages/tokens/schemas/"
    click TT "https://github.com/adobe/spectrum-tokens/tree/main//packages/tokens/schemas/token-types/"
    click DS "https://github.com/adobe/spectrum-tokens/tree/main//docs/site/"
    click TV "https://github.com/adobe/spectrum-tokens/tree/main//docs/visualizer/"
    click DG "https://github.com/adobe/spectrum-tokens/tree/main//tools/diff-generator/"
    click CG "https://github.com/adobe/spectrum-tokens/tree/main//tools/token-csv-generator/"
    click MB "https://github.com/adobe/spectrum-tokens/tree/main//tools/token-manifest-builder/"
    click TF "https://github.com/adobe/spectrum-tokens/tree/main//tools/transform-tokens-json/"
    click PM "https://github.com/adobe/spectrum-tokens/blob/main//pnpm-workspace.yaml"
    click TR "https://github.com/adobe/spectrum-tokens/tree/main//.moon/"
    click RM "https://github.com/adobe/spectrum-tokens/tree/main//.changeset/"
    click CI "https://github.com/adobe/spectrum-tokens/tree/main//.github/workflows/"

    %% Styling
    classDef core fill:#e1f5fe,stroke:#01579b
    classDef docs fill:#e8f5e9,stroke:#1b5e20
    classDef tools fill:#fff3e0,stroke:#e65100
    classDef build fill:#f3e5f5,stroke:#4a148c

    class TD,SD,TT core
    class DS,TV docs
    class DG,CG,MB,TF tools
    class PM,TR,RM,CI build
```
