# hwclass/buildless-site architecture

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

- Interactive diagram: https://gitdiagram.com/hwclass/buildless-site
- Repository: https://github.com/hwclass/buildless-site

## Overview

##### Main Components

a) Frontend Layer:
- Components (Static Preact Components)
- Hierarchy of basic components (Button, Footer, Header, etc.)
- Islands (Interactive Components)
- Three interactive components: Boilerplates, EmbedCode, and NotificationBar
- Static Assets
- CSS, Service Worker, and asset manifest

b) Routing Layer:
- Main routes structure:
- Home route (/)
- Blog routes (/blog and /blog/[slug])

c) API Layer:
- Sections API endpoint (/api/sections)
- External Data Source (awesome-buildless GitHub repository)

**[Client Browser] ←→ [Fresh Server]**
- ↑               ↑

**[Service Worker]    [Deno Runtime]**
- ↑

- [Components]
- [Static Components]
- [Islands (Interactive)]
- [Routes]
- ↑

- [External Data]
- [GitHub Repo]

##### Important Elements to Highlight

a) Fresh Framework Architecture:
- Distinction between static components and islands
- Server-side rendering aspect
- Routing system

b) Performance Features:
- Service worker implementation
- Static asset handling

c) Data Flow:
- How the sections API fetches data from GitHub
- Interaction between islands and the server

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        Browser["Browser"]
        SW["Service Worker"]:::sw
        click SW "https://github.com/hwclass/buildless-site/blob/main/static/sw.js"
        Browser --> SW
    end

    subgraph "Fresh Server"
        DR["Deno Runtime"]:::deno
        
        subgraph "Components Layer"
            direction TB
            SC["Static Components"]:::component
            click SC "https://github.com/hwclass/buildless-site/tree/main/components"
            
            subgraph "Static Components Detail"
                Header["Header"]:::component
                click Header "https://github.com/hwclass/buildless-site/blob/main/components/Header.tsx"
                Footer["Footer"]:::component
                click Footer "https://github.com/hwclass/buildless-site/blob/main/components/Footer.tsx"
                Hero["Hero"]:::component
                click Hero "https://github.com/hwclass/buildless-site/blob/main/components/Hero.tsx"
                Section["Section"]:::component
                click Section "https://github.com/hwclass/buildless-site/blob/main/components/Section.tsx"
                ItemList["ItemList"]:::component
                click ItemList "https://github.com/hwclass/buildless-site/blob/main/components/ItemList.tsx"
            end
            
            IC["Interactive Islands"]:::island
            click IC "https://github.com/hwclass/buildless-site/tree/main/islands"
            
            subgraph "Islands Detail"
                Boilerplates["Boilerplates"]:::island
                click Boilerplates "https://github.com/hwclass/buildless-site/blob/main/islands/Boilerplates.tsx"
                EmbedCode["EmbedCode"]:::island
                click EmbedCode "https://github.com/hwclass/buildless-site/blob/main/islands/EmbedCode.tsx"
                NotificationBar["NotificationBar"]:::island
                click NotificationBar "https://github.com/hwclass/buildless-site/blob/main/islands/NotificationBar.tsx"
            end
        end
        
        subgraph "Routing Layer"
            Routes["Routes Handler"]:::route
            click Routes "https://github.com/hwclass/buildless-site/tree/main/routes"
            HomeRoute["Home Route"]:::route
            click HomeRoute "https://github.com/hwclass/buildless-site/blob/main/routes/index.tsx"
            BlogRoutes["Blog Routes"]:::route
            click BlogRoutes "https://github.com/hwclass/buildless-site/blob/main/routes/blog/index.tsx"
        end
        
        subgraph "Static Assets"
            CSS["Styles"]:::asset
            click CSS "https://github.com/hwclass/buildless-site/blob/main/static/style.css"
            SWReg["SW Registration"]:::asset
            click SWReg "https://github.com/hwclass/buildless-site/blob/main/static/register-sw.js"
            AssetManifest["Asset Manifest"]:::asset
            click AssetManifest "https://github.com/hwclass/buildless-site/blob/main/static/asset-manifest.json"
        end
        
        subgraph "Configuration"
            MainEntry["Main Entry"]:::config
            click MainEntry "https://github.com/hwclass/buildless-site/blob/main/main.ts"
            DevEntry["Dev Entry"]:::config
            click DevEntry "https://github.com/hwclass/buildless-site/blob/main/dev.ts"
            FreshConfig["Fresh Config"]:::config
            click FreshConfig "https://github.com/hwclass/buildless-site/blob/main/fresh.gen.ts"
            DenoConfig["Deno Config"]:::config
            click DenoConfig "https://github.com/hwclass/buildless-site/blob/main/deno.json"
        end
        
        API["/api/sections"]:::api
    end
    
    subgraph "External"
        GitHub["GitHub Repository"]:::external
    end
    
    Browser <--> DR
    DR --> SC
    DR --> IC
    DR --> Routes
    API <--> GitHub
    Routes --> API
    
    %% Styling
    classDef deno fill:#2E8BC0
    classDef component fill:#4CAF50
    classDef island fill:#FF9800
    classDef route fill:#9C27B0
    classDef api fill:#E91E63
    classDef external fill:#795548
    classDef asset fill:#607D8B
    classDef config fill:#3F51B5
    classDef sw fill:#00BCD4
    
    %% Legend
    subgraph Legend
        L1["Deno Runtime"]:::deno
        L2["Static Component"]:::component
        L3["Interactive Island"]:::island
        L4["Route"]:::route
        L5["API Endpoint"]:::api
        L6["External Service"]:::external
        L7["Static Asset"]:::asset
        L8["Configuration"]:::config
        L9["Service Worker"]:::sw
    end
```
