# vikiboss/60s-static-host architecture

> Architecture diagram of the GitHub repository vikiboss/60s-static-host, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vikiboss/60s-static-host
- Repository: https://github.com/vikiboss/60s-static-host

## Overview

##### Project type and purpose
- This is a lightweight, full-stack-leaning static data host that automatically fetches, processes, and publishes daily curated news JSON files. It uses GitHub Actions for scheduling, Node.js/TypeScript scripts for data collection, and serves the output as static assets via Vercel (and other CDNs).

##### File structure
- Top-level:
- .github/workflows/schedule.yaml → Cron config for auto-update
- src/ → TypeScript scripts that fetch, parse, screenshot, and update JSON data
- static/ → Generated JSON files under static/60s/ plus index.html and images
- debug/ → Test harness for local script debugging
- package.json, pnpm-lock.yaml, .node-version → Node.js project config
- readme.md → Documentation
- Patterns: scheduled pipeline → data ingestion → static site generation
- Deploy files: static/ folder is the publish artifact

##### README for additional insights
- Describes auto-update via GitHub Actions
- Emphasizes static JSON hosting, REST API style access via multiple CDNs
- No server-side runtime—purely static

a. Main components
- GitHub Repository (source code + static assets)
- GitHub Actions Scheduler (schedule.yaml)
- Runner Environment (Node.js + TypeScript)
- Scripts: fetch-articles.ts, parse-article-url.ts, screenshot.ts, update-60s.ts, utils.ts
- Generated static output (static/60s/*.json, index.html, images)
- CDNs & Hosting (Vercel, GitHub Raw, jsDelivr)
- Clients (web browsers, REST API consumers)
b. Relationships & interactions
1. Cron trigger (“schedule.yaml”) → activates GitHub Actions runner
2. Runner checks out repo → installs dependencies → executes update-60s.ts
3. update-60s.ts orchestrates:
- fetch-articles → parse URLs → maybe screenshot → assemble JSON
- writes to static/60s/[date].json
4. Runner commits & pushes changes to repository
5. Vercel (or GitHub Pages) picks up new static assets → deploys
6. End users retrieve JSON via CDN endpoints
c. Architectural patterns & principles
- Scheduled pipeline (cron → CI/CD → SSG)
- Static site generation (SSG) for maximum performance
- Separation of concerns: data ingestion scripts vs. static hosting
- “GitOps” style: commits to repo drive deploy
d. Key technologies & libraries
- GitHub Actions (CI/CD & scheduling)
- Node.js & TypeScript (scripts)
- pnpm (package manager)
- Vercel (static site hosting)
- jsDelivr & GitHub Raw (alternative CDNs)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Compute
    Scheduler["GitHub Actions Scheduler"]:::compute
    Runner["Actions Runner\n(Node.js Environment)"]:::compute
    Checkout["Checkout Repository"]:::compute
    ProjectConfig["Project Config\n(package.json,\npnpm-lock.yaml,\n.node-version)"]:::artifacts
    Deps["Install Dependencies\n(pnpm install)"]:::compute

    subgraph "Data Processor"
        direction TB
        fetch["fetch-articles.ts"]:::compute
        parse["parse-article-url.ts"]:::compute
        screenshot["screenshot.ts"]:::compute
        update["update-60s.ts"]:::compute
        utils["utils.ts"]:::compute
    end

    Debug["Debug Harness\n(debug/index.ts)"]:::compute

    Commit["Commit & Push Changes"]:::compute

    subgraph "Static Artifacts"
        direction TB
        StaticDir["static/"]:::artifacts
        JSON["static/60s/"]:::artifacts
        HTML["static/index.html"]:::artifacts
        Images["static/images/"]:::artifacts
    end

    subgraph "Hosting & CDN"
        direction TB
        Deploy["Deploy Static Assets\n(Vercel/GH Pages)"]:::external
        Vercel["Vercel"]:::external
        jsDelivr["jsDelivr"]:::external
        GitHubRaw["GitHub Raw"]:::external
    end

    Clients["Clients\n(Web Browsers & API Consumers)"]:::client
    Docs["Documentation\n(readme.md)"]:::artifacts

    %% Flow
    Scheduler --> Runner
    Runner --> Checkout
    Checkout --> ProjectConfig
    ProjectConfig --> Deps
    Deps --> fetch
    fetch --> parse
    parse --> screenshot
    screenshot --> update
    update --> StaticDir
    StaticDir --> Commit
    Commit --> Deploy
    Deploy --> Vercel
    Deploy --> jsDelivr
    Deploy --> GitHubRaw
    Vercel --> Clients
    jsDelivr --> Clients
    GitHubRaw --> Clients

    %% Utils usage
    utils -.-> fetch
    utils -.-> parse
    utils -.-> screenshot
    utils -.-> update

    %% Debug flow
    Deps --> Debug

    %% Documentation
    Checkout --> Docs

    %% Click Events
    click Scheduler "https://github.com/vikiboss/60s-static-host/blob/main/.github/workflows/schedule.yaml"
    click ProjectConfig "https://github.com/vikiboss/60s-static-host/blob/main/package.json"
    click ProjectConfig "https://github.com/vikiboss/60s-static-host/blob/main/pnpm-lock.yaml"
    click ProjectConfig "https://github.com/vikiboss/60s-static-host/blob/main/.node-version"
    click fetch "https://github.com/vikiboss/60s-static-host/blob/main/src/fetch-articles.ts"
    click parse "https://github.com/vikiboss/60s-static-host/blob/main/src/parse-article-url.ts"
    click screenshot "https://github.com/vikiboss/60s-static-host/blob/main/src/screenshot.ts"
    click update "https://github.com/vikiboss/60s-static-host/blob/main/src/update-60s.ts"
    click utils "https://github.com/vikiboss/60s-static-host/blob/main/src/utils.ts"
    click Debug "https://github.com/vikiboss/60s-static-host/blob/main/debug/index.ts"
    click StaticDir "https://github.com/vikiboss/60s-static-host/tree/main/static/"
    click JSON "https://github.com/vikiboss/60s-static-host/tree/main/static/60s/"
    click HTML "https://github.com/vikiboss/60s-static-host/blob/main/static/index.html"
    click Images "https://github.com/vikiboss/60s-static-host/tree/main/static/images/"
    click Docs "https://github.com/vikiboss/60s-static-host/blob/main/readme.md"

    %% Styles
    classDef compute fill:#AED6F1,stroke:#21618C,stroke-width:1px
    classDef artifacts fill:#ABEBC6,stroke:#1D8348,stroke-width:1px
    classDef external fill:#F5B041,stroke:#B9770E,stroke-width:1px
    classDef client fill:#D2B4DE,stroke:#6C3483,stroke-width:1px
```
