# d-sanderson/figma-tokens architecture

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

- Interactive diagram: https://gitdiagram.com/d-sanderson/figma-tokens
- Repository: https://github.com/d-sanderson/figma-tokens

## Overview

##### External Systems
- Figma (Design Environment)
- NPM Registry
- GitHub Repository

##### Main Process Components
- Tokens Studio Figma Plugin
- GitHub Actions Pipeline
- Style Dictionary Build System
- NPM Package Distribution

##### Component Representation

a. Design Section (Left):
- It to a smaller rectangle representing Tokens Studio Plugin

b. Processing Section (Middle):
- Inside it, include three connected workflow components:
- Build Workflow (transforms tokens)
- Bump Workflow (version management)
- Publish Workflow (NPM publishing)
- Style Dictionary as a processing unit within the build workflow

c. Distribution Section (Right):
- NPM Registry
- Consuming applications

##### Specific Elements
- Tokens.json file as a key artifact
- Three GitHub workflows as connected pipeline stages
- Branch management (develop → main)
- Version bumping process
- Pull request review points

##### Additional Details
- Version control flow indicators
- Approval checkpoints

Key Relationships to Highlight:
##### NPM Package → Consuming Applications

Level of Detail:
- Keep the main flow clear and prominent
- Use subdiagrams or callouts for complex processes
- File names for key artifacts (tokens.json, variables.css)
- Trigger points for automated processes

Remember to:
- Version control flow
- Clear separation between automated and manual processes
- Approval/review checkpoints

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Systems
    subgraph Design
        Figma[Figma Design Tool]:::design
        TokensStudio[Tokens Studio Plugin]:::design
    end

    subgraph "GitHub Repository"
        Tokens["Design Token Storage"]:::artifact
        click Tokens "https://github.com/d-sanderson/figma-tokens/blob/main/tokens/tokens.json"

        subgraph "GitHub Actions Pipeline"
            direction TB
            Build["Build Workflow"]:::pipeline
            click Build "https://github.com/d-sanderson/figma-tokens/blob/main/.github/workflows/build.yml"
            Bump["Version Management"]:::pipeline
            click Bump "https://github.com/d-sanderson/figma-tokens/blob/main/.github/workflows/bump.yml"
            Publish["NPM Publishing"]:::pipeline
            click Publish "https://github.com/d-sanderson/figma-tokens/blob/main/.github/workflows/publish.yml"

            Build --> Bump
            Bump --> Publish
        end

        subgraph "Build Process"
            Config["Build Configuration"]:::config
            click Config "https://github.com/d-sanderson/figma-tokens/blob/main/config.json"
            StyleDict["Style Dictionary"]:::process
            BuildOutput["CSS Variables"]:::artifact
            click BuildOutput "https://github.com/d-sanderson/figma-tokens/blob/main/build/css/variables.css"
        end

        PackageConfig["Package Configuration"]:::config
        click PackageConfig "https://github.com/d-sanderson/figma-tokens/blob/main/package.json"
        EntryPoint["Package Entry Point"]:::code
        click EntryPoint "https://github.com/d-sanderson/figma-tokens/blob/main/index.js"
    end

    subgraph Distribution
        NPMRegistry["NPM Registry"]:::external
        Consumers["Consuming Applications"]:::external
    end

    %% Relationships
    Figma --> TokensStudio
    TokensStudio --> Tokens
    Tokens --> Build
    Build --> StyleDict
    StyleDict --> BuildOutput
    Config --> StyleDict
    Build --> PackageConfig
    Publish --> NPMRegistry
    NPMRegistry --> Consumers

    %% Styling
    classDef design fill:#3498db,stroke:#2980b9,color:white
    classDef pipeline fill:#2ecc71,stroke:#27ae60,color:white
    classDef process fill:#e67e22,stroke:#d35400,color:white
    classDef artifact fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef config fill:#9b59b6,stroke:#8e44ad,color:white
    classDef external fill:#bdc3c7,stroke:#95a5a6,color:black
    classDef code fill:#f1c40f,stroke:#f39c12,color:black

    %% Legend
    subgraph Legend
        L1[Design Tools]:::design
        L2[Pipeline Steps]:::pipeline
        L3[Processes]:::process
        L4[Artifacts]:::artifact
        L5[Configuration]:::config
        L6[External Systems]:::external
        L7[Code Files]:::code
    end
```
