How vikiboss/60s-static-host works
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)