How ss-vip/blog works
Project Type and Purpose
• This is a static site / blog built with Hugo (a static site generator), enhanced with a headless CMS (DecapCMS) and serverless API endpoints, and deployed on Cloudflare Pages.
• Purpose: serve a simple, ad-free technical blog; allow non-technical editors to update content via a web UI (DecapCMS); host on a fast global CDN with serverless functions for CMS authentication.
Main Components
a. Content Repository (Git)
• Stores markdown files under /content (about, posts).
• Stores Hugo config (hugo.toml) and theme-related files.
• Stores DecapCMS admin UI under /static/admin.
• Stores serverless function code under /functions/api.
b. Build Service (Cloudflare Pages + Hugo)
• Listens for Git pushes/merges.
• Runs Hugo build using hugo.toml + FixIt theme + /content → generates static HTML/CSS/JS.
c. Static CDN (Cloudflare Pages)
• Hosts the generated static site at is-cool.dev.
• Serves /index.html, /about, /posts/..., /robots.txt, /google25*.html.
d. Headless CMS UI (DecapCMS)
• Served from /admin/index.html on the same CDN.
• Client-side JS reads /static/admin/config.yml for API endpoints.
e. Serverless API (Cloudflare Functions)
• Two endpoints: api/auth.js and api/callback.js.
• Handle OAuth handshake with Git provider (e.g., GitHub) to enable Git-based commits from the CMS.
f. External Service
• Git hosting (e.g., GitHub) for OAuth and repository updates.
Relationships & Data Flows
• Content Author / Editor uses Browser → visits /admin (CMS UI).
• CMS UI → calls api/auth → redirects to GitHub OAuth → returns via api/callback → issues JWT to CMS UI.
• CMS UI → uses Git Gateway (authenticated) → reads/writes the content repo (pulls markdown, commits changes).
• Git repo push triggers Cloudflare Pages → runs Hugo → updates static assets.
• End User’s Browser requests pages → served by CDN.
Architectural Patterns & Design Principles
• Static Site Generation: content is pre-rendered for performance, SEO, and security.
• Jamstack: JavaScript (CMS UI), APIs (serverless functions), Markup (static HTML).
• Git-based content workflow: CMS commits directly to Git.
• Serverless functions decouple auth logic from the static build.