# vapor/website architecture

> Architecture diagram of the GitHub repository vapor/website, 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/website
- Repository: https://github.com/vapor/website

## Overview

##### Project Type and Purpose
- This is a static website generator project for the Vapor framework’s official website (vapor.codes).
- It uses the Publish library (a Swift-based SSG) to transform Swift templates, Markdown content, and static assets into a ready-to-serve static site.
- It includes CI/CD workflows (GitHub Actions) for automated deploys.

##### High-Level Architecture Components
a. Developer Environment
- Local machine with Swift toolchain and Publish CLI
b. Version Control & CI/CD
- GitHub repository (.github/workflows)
- Dependabot for dependency updates
c. Static Site Generator Pipeline
- Publish CLI (invokes `publish run`)
- Sources/Website: Swift files defining pages and theme
- Content: Markdown error pages and future content
- Resources/static: images, CSS, JS assets
d. Output Static Site
- Generated HTML, CSS, JS, images in a deployable folder (e.g., `Public` or `Output`)
e. Hosting / Delivery
- Target hosting (e.g., GitHub Pages, S3 + CloudFront, Vapor Cloud)
- DNS and optional CDN layer for vapor.codes

##### Relationships & Data Flow
- Developer commits code → pushes to GitHub → GitHub Actions CI
- CI uses Publish CLI on the repo’s Sources/Website, Content, Resources → generates static site
- CI deploys the generated site to the hosting environment
- End users request pages via DNS/CDN → static assets served

##### Architectural Patterns & Principles
- Static Site Generation (SSG) pattern: compile-time page assembly
- Single codebase for all pages (no separate frontend/backend)
- CI/CD “Infrastructure as code” via GitHub workflows
- Clear separation of concerns:
- Content (Markdown)
- Presentation Logic (Swift Publish DSL)
- Static Assets (images, JS)

##### Key Technologies & Frameworks
- Swift & Swift Package Manager (Package.swift, Package.resolved)
- Publish (static site generator)
- GitHub Actions (deploy.yml, pr.yaml)
- Dependabot (dependabot.yml)
- JavaScript for UI enhancements (scrollNavbar.js, updateStarsCount.js)

## Diagram (Mermaid)

```mermaid
graph TB
    %% Developer Environment
    subgraph "Developer Environment"
        Dev["Developer Workstation"]:::code
    end

    %% Version Control & CI/CD
    subgraph "Version Control & CI/CD"
        Repo["GitHub Repo"]:::code
        subgraph "Repository Files"
            dependabot["Dependabot Config"]:::ci
            workflowsGroup["GitHub Workflows"]:::ci
            subgraph "Workflows"
                pr["pr.yaml"]:::ci
                prClosed["pr-closed.yaml"]:::ci
                deployWF["deploy.yml"]:::ci
            end
            manifest["Package.swift"]:::code
            resolved["Package.resolved"]:::code
            subgraph "Sources/Website"
                mainSwift["main.swift"]:::storage
                themeSwift["Theme.swift"]:::storage
                comingSoon["ComingSoonPage.swift"]:::storage
                evangelist["EvangelistPage.swift"]:::storage
                home["HomePage.swift"]:::storage
                showcase["ShowcasePage.swift"]:::storage
                supporters["SupportersPage.swift"]:::storage
                team["TeamPage.swift"]:::storage
            end
            subgraph "Content/error"
                error404["404.md"]:::storage
            end
            subgraph "Resources/static"
                imagesDir["images"]:::storage
                subgraph "JS Assets"
                    scrollNav["scrollNavbar.js"]:::storage
                    scrollShow["scrollShowcase.js"]:::storage
                    updateStars["updateStarsCount.js"]:::storage
                end
            end
            readme["README.md"]:::code
            stack["stack.yml"]:::code
        end
    end

    %% Build Server and Tools
    subgraph "Build Server (CI/CD)"
        GHActions["GitHub Actions Runner"]:::ci
        PublishCLI["Publish CLI"]:::tool
    end

    %% Hosting / Delivery
    subgraph "Hosting / Delivery"
        Hosting["Hosting / CDN / DNS"]:::delivery
    end

    %% End User
    EndUser["End User Browser"]:::delivery

    %% Connections
    Dev -->|"push code"| Repo
    Repo -->|"trigger on push/PR"| GHActions
    GHActions -->|"invoke publish run"| PublishCLI
    PublishCLI -->|"generate static site"| Hosting
    GHActions -->|"deploy artifacts"| Hosting
    EndUser -->|"HTTP Request"| Hosting
    Hosting -->|"Serve static assets"| EndUser

    %% Click Events
    click dependabot "https://github.com/vapor/website/blob/main/.github/dependabot.yml"
    click pr "https://github.com/vapor/website/blob/main/.github/workflows/pr.yaml"
    click prClosed "https://github.com/vapor/website/blob/main/.github/workflows/pr-closed.yaml"
    click deployWF "https://github.com/vapor/website/blob/main/.github/workflows/deploy.yml"
    click manifest "https://github.com/vapor/website/blob/main/Package.swift"
    click resolved "https://github.com/vapor/website/blob/main/Package.resolved"
    click mainSwift "https://github.com/vapor/website/blob/main/Sources/Website/main.swift"
    click themeSwift "https://github.com/vapor/website/blob/main/Sources/Website/Theme.swift"
    click comingSoon "https://github.com/vapor/website/blob/main/Sources/Website/ComingSoonPage.swift"
    click evangelist "https://github.com/vapor/website/blob/main/Sources/Website/EvangelistPage.swift"
    click home "https://github.com/vapor/website/blob/main/Sources/Website/HomePage.swift"
    click showcase "https://github.com/vapor/website/blob/main/Sources/Website/ShowcasePage.swift"
    click supporters "https://github.com/vapor/website/blob/main/Sources/Website/SupportersPage.swift"
    click team "https://github.com/vapor/website/blob/main/Sources/Website/TeamPage.swift"
    click error404 "https://github.com/vapor/website/blob/main/Content/error/404.md"
    click imagesDir "https://github.com/vapor/website/tree/main/Resources/static/images"
    click scrollNav "https://github.com/vapor/website/blob/main/Resources/static/js/scrollNavbar.js"
    click scrollShow "https://github.com/vapor/website/blob/main/Resources/static/js/scrollShowcase.js"
    click updateStars "https://github.com/vapor/website/blob/main/Resources/static/js/updateStarsCount.js"

    %% Styles
    classDef code fill:#fde2e2,stroke:#d1495b,stroke-width:1px
    classDef ci fill:#fff3b0,stroke:#f4a261,stroke-width:1px
    classDef tool fill:#e2f0cb,stroke:#2a9d8f,stroke-width:1px
    classDef storage fill:#d0e1f9,stroke:#264653,stroke-width:1px
    classDef delivery fill:#e6f4ea,stroke:#2a623d,stroke-width:1px
```
