Skip to content

Echo5414/Design-System-Docs

Repository files navigation

Design-System-Docs

A W3C Design Tokens-compliant platform for managing design tokens with GitHub integration and multi-platform distribution.

🎯 Project Vision

This platform serves as a centralized design token management system where:

  • Design teams can create and edit tokens through a web UI
  • Tokens are stored in GitHub as the single source of truth (W3C 2025.10 format)
  • Multiple platforms (Web, Flutter, etc.) consume tokens from GitHub
  • Optional Figma plugin allows editing tokens directly from Figma

πŸ—οΈ Architecture

Stack:

  • Frontend: SvelteKit (Vite)
  • Backend: Strapi 5.6.0 (Headless CMS)
  • Database: SQLite (dev), can be swapped for PostgreSQL/MySQL (prod)
  • Authentication: GitHub OAuth
  • Token Format: W3C Design Tokens Spec 2025.10

Flow:

User β†’ SvelteKit UI β†’ Strapi API β†’ SQLite (Draft State)
                                 ↓
                          GitHub Repo (Published State, W3C JSON)
                                 ↓
                   Consumers (Web, Flutter, Figma, etc.)

βœ… Current Implementation Status

Completed Features

1. Authentication & GitHub Integration

  • βœ… GitHub OAuth login
  • βœ… JWT stored in httpOnly cookies for security
  • βœ… GitHub access token stored in httpOnly cookies
  • βœ… Custom jwt-cookie middleware for Strapi authentication

2. Repository Setup

  • βœ… Create new GitHub repositories via UI
  • βœ… Connect to existing GitHub repositories
  • βœ… Searchable repository list with live filtering
  • βœ… Custom scrollbar styling matching design system

3. Strapi Content Types (W3C-Compliant)

  • βœ… Design System

    • Fields: name, slug, repo_owner, repo_name, branch, tokens_path, resolver_path
    • Tracks: last_published_commit_sha, last_published_at, last_synced_at
  • βœ… Token Collection (maps to W3C "groups")

    • Fields: name, key, description, design_system (relation)
    • Examples: Colors, Typography, Spacing
  • βœ… Token (W3C Design Token)

    • Fields: name, full_path, group_path, type, value (JSON), description
    • Supports: deprecated, alias_to, extensions
    • Types: color, dimension, fontFamily, fontWeight, duration, typography, shadow, gradient, etc.

4. API Endpoints

  • βœ… POST /api/github/create-repo - Create new GitHub repository
  • βœ… GET /api/github/repos - List user's GitHub repositories
  • βœ… POST /api/design-system/connect - Connect repo & create Design System + default collections
  • βœ… Full CRUD endpoints for Design Systems, Token Collections, Tokens (via Strapi)

5. Permissions

All endpoints secured with proper role-based permissions for "Authenticated" users.

🚧 In Progress

Dashboard Migration to Strapi (Current Task)

  • πŸ”„ Migrating from collections.json (local file) to Strapi API
  • Components to update:
    • Sidebar (fetch collections from Strapi)
    • TokenModal (POST/PUT tokens to Strapi)
    • Token list pages (fetch from Strapi)

πŸ“‹ Planned Features

Phase 2: Draft β†’ Publish Flow

  • "Publish Changes" button in UI
  • Strapi reads draft tokens β†’ generates W3C JSON β†’ commits to GitHub
  • Revision history (Git commit log)
  • Rollback capability

Phase 3: GitHub Token Import

  • Parse existing W3C tokens from GitHub when connecting repo
  • Sync GitHub β†’ Strapi on initial connection

Phase 4: Figma Plugin

  • Extract Figma variables/styles
  • Convert to W3C tokens
  • Push to Strapi β†’ GitHub

Phase 5: Multi-Platform Export

  • Style Dictionary integration
  • Generate platform-specific outputs (CSS, Dart, Swift, etc.)

πŸ“ Project Structure

Design-System-Docs/
β”œβ”€β”€ backend/                    # Strapi backend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”‚   β”œβ”€β”€ design-system/  # Design System content type
β”‚   β”‚   β”‚   β”œβ”€β”€ token-collection/
β”‚   β”‚   β”‚   β”œβ”€β”€ token/
β”‚   β”‚   β”‚   └── github/         # GitHub integration controllers
β”‚   β”‚   β”œβ”€β”€ middlewares/
β”‚   β”‚   β”‚   β”œβ”€β”€ jwt-cookie.ts   # Custom JWT authentication
β”‚   β”‚   β”‚   └── github-callback.ts
β”‚   β”‚   └── index.ts            # Permissions setup
β”‚   └── .env                    # GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET
β”‚
β”œβ”€β”€ frontend/                   # SvelteKit frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”‚   β”œβ”€β”€ (protected)/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ setup/      # Repository connection UI
β”‚   β”‚   β”‚   β”‚   └── dashboard/  # Token management UI
β”‚   β”‚   β”‚   β”œβ”€β”€ +page.server.ts # OAuth callback handler
β”‚   β”‚   β”‚   └── +layout.svelte
β”‚   β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”‚   β”œβ”€β”€ api/strapi.ts   # Strapi API client
β”‚   β”‚   β”‚   └── components/     # Reusable UI components
β”‚   β”‚   └── hooks.server.ts     # Auth hooks
β”‚   └── vite.config.ts
β”‚
└── README.md

πŸš€ Getting Started

Prerequisites

  • Node.js >= 18
  • GitHub OAuth App credentials

Setup

  1. Clone the repository

    git clone <your-repo-url>
    cd Design-System-Docs
  2. Backend Setup

    cd backend
    npm install
    
    # Create .env file
    echo "GITHUB_CLIENT_ID=your_client_id" > .env
    echo "GITHUB_CLIENT_SECRET=your_client_secret" >> .env
    
    npm run develop

    Backend runs on http://localhost:1337

  3. Frontend Setup

    cd frontend
    npm install
    npm run dev

    Frontend runs on http://localhost:5173

  4. Login

    • Navigate to http://localhost:5173
    • Click "Connect with GitHub"
    • Authorize the OAuth app

🎨 UI Styling Conventions

Tailwind CSS & Shadcn

  • Use Tailwind CSS for utility-first styling
  • Leverage Shadcn components from $lib/components/ui
  • Organize classes using cn() utility from $lib/utils

Shadcn Color System

Define CSS variables without color space function:

--primary: 222.2 47.4% 11.2%;
--primary-foreground: 210 40% 98%;

Usage:

<div class="bg-primary text-primary-foreground">Hello</div>

Key color variables:

  • --background, --foreground: Default body colors
  • --muted, --muted-foreground: Muted backgrounds
  • --card, --card-foreground: Card backgrounds
  • --primary, --primary-foreground: Primary button colors
  • --accent, --accent-foreground: Accent colors
  • --destructive, --destructive-foreground: Destructive actions
  • --ring: Focus ring color
  • --radius: Border radius for components

πŸ“š W3C Design Tokens Spec (2025.10)

This project follows the official W3C Design Tokens specification:

Example W3C Token Structure

{
  "$schema": "https://www.designtokens.org/technical-reports/",
  "color": {
    "brand": {
      "primary": {
        "$type": "color",
        "$value": {
          "colorSpace": "srgb",
          "hex": "#0057FF"
        },
        "$description": "Primary brand color"
      }
    }
  }
}

πŸ”’ Security

  • JWT & GitHub tokens stored in httpOnly cookies (not accessible via JavaScript)
  • CORS configured with credentials: true
  • Role-based permissions in Strapi for all API endpoints

🀝 Contributing

This project is in active development. Current focus: Dashboard migration to Strapi.

πŸ“ License

[Your License Here]


Last Updated: November 28, 2025
Status: Phase 1 (Repository Connection) βœ… Complete | Phase 2 (Dashboard Migration) 🚧 In Progress

one question, we generate the collections when we create a new repo right?

but lets assume we still have a repo somewhere and we want a design system for it, so when we

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published