# vapor/design architecture

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

- Interactive diagram: https://gitdiagram.com/vapor/design
- Repository: https://github.com/vapor/design

## Overview

##### Project type and purpose
- This is a design-system + static-site generation project. It bundles:
- A CSS/JS asset pipeline (Sass, Webpack, NPM scripts)
- A Swift library (`VaporDesign`) of Publish components for generating HTML
- A demo/design site that uses both pipelines, and finally deploys assets to a CDN

##### File structure
- Top-level build/config files:
- `.github/workflows/ci.yml`, `deploy.yml` – GitHub Actions for CI, build and deploy
- `webpack.config.js`, `package.json`/`package-lock.json`, `stack.yml` – NPM and Webpack config
- `Package.swift`, `Sources/` – Swift package for the `VaporDesign` library and demo site
- Content directories:
- `src/` – source SCSS, JS, images for the asset pipeline
- `static/` – prebuilt static files (zip packages, favicons, additional JS)
- `Content/` – placeholder for Publish content (demo markdown)
- Output directory (implicit, usually `Output/`) is generated by the pipelines

##### README insights
- Two main build steps:
1. `npm install && npm run build` – compiles SCSS to CSS, bundles JS, copies static files
2. `swift run && npm start` – generates HTML via Publish + VaporDesign, then rebuilds assets
- Final site is hosted at https://design.vapor.codes on a CDN

##### Elements
- Commit → CI
- CI → Asset Builder → Output/assets
- CI → Swift Generator → Output/html
- Output → Deploy → CDN
- Browser → CDN (fetch assets + HTML)
- Blue for code repositories & source folders
- Green for build processes (NPM, Webpack, Swift)
- Orange for outputs (compiled files, HTML)
- Purple for deployment target (CDN)

## Diagram (Mermaid)

```mermaid
graph TD
    Developer["Developer"]:::external
    Browser["Browser"]:::external

    subgraph "GitHub Repository" 
        Repo["GitHub Repo"]:::repo
        CI["CI/CD Workflows"]:::repo
        NPMConfig["NPM & Webpack Config"]:::repo
        SwiftConfig["Swift Package Config"]:::repo
    end

    subgraph "Source Code"
        AssetsSrc["Asset Pipeline Source"]:::repo
        ReferenceAssets["Reference Assets"]:::repo
        StaticAssets["Static Site Assets"]:::repo
        VaporDesignLib["VaporDesign Library"]:::repo
        DesignSiteGen["DesignSite Generator"]:::repo
        PublishContent["Publish Content Placeholder"]:::repo
    end

    subgraph "Build Pipelines"
        AssetBuilder["Asset Pipeline (Node.js + Webpack + Sass)"]:::build
        SwiftBuilder["Swift Publish Pipeline"]:::build
    end

    subgraph "Output"
        OutputAssets["Compiled CSS/JS & Media"]:::output
        OutputHTML["Generated HTML"]:::output
    end

    Deploy["Deploy to CDN"]:::deploy
    CDN["CDN (design.vapor.codes)"]:::deploy

    Developer -->|"push / PR"| Repo
    Repo -->|"on push"| CI
    CI -->|"build assets"| AssetBuilder
    CI -->|"generate site"| SwiftBuilder

    AssetBuilder -->|"CSS/JS, images, fonts"| OutputAssets
    SwiftBuilder -->|"HTML pages"| OutputHTML

    OutputAssets --> CombinedOutput["Output Directory"]:::output
    OutputHTML --> CombinedOutput

    CombinedOutput --> Deploy
    Deploy --> CDN

    Browser -->|"fetch HTML & assets"| CDN

    classDef repo fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef build fill:#90EE90,stroke:#000,stroke-width:1px
    classDef output fill:#FFA500,stroke:#000,stroke-width:1px
    classDef deploy fill:#9370DB,stroke:#000,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#000,stroke-width:1px

    click CI "https://github.com/vapor/design/blob/main/.github/workflows/ci.yml"
    click Deploy "https://github.com/vapor/design/blob/main/.github/workflows/deploy.yml"
    click NPMConfig "https://github.com/vapor/design/blob/main/package.json"
    click NPMConfig "https://github.com/vapor/design/blob/main/package-lock.json"
    click NPMConfig "https://github.com/vapor/design/blob/main/webpack.config.js"
    click SwiftConfig "https://github.com/vapor/design/blob/main/Package.swift"
    click SwiftConfig "https://github.com/vapor/design/blob/main/stack.yml"
    click AssetsSrc "https://github.com/vapor/design/tree/main/src/"
    click ReferenceAssets "https://github.com/vapor/design/tree/main/Reference/"
    click StaticAssets "https://github.com/vapor/design/tree/main/static/"
    click VaporDesignLib "https://github.com/vapor/design/tree/main/Sources/VaporDesign/"
    click DesignSiteGen "https://github.com/vapor/design/tree/main/Sources/DesignSite/"
    click PublishContent "https://github.com/vapor/design/tree/main/Content/"
```
