Back to all articles

· 1 min read

A git-based CMS on Cloudflare Pages, no database

How to put a comfortable editing flow on top of Astro, Decap CMS, and GitHub — plus the OAuth proxy traps that usually break login.

Static sites have one classic weakness: who edits the copy? If the answer is “a developer via pull request”, the coordination cost quickly exceeds the hosting cost.

The pattern

Content stays as Markdown files in the repository. Only two things are added:

  1. An editing panel (Decap CMS) loaded from a CDN that talks to the GitHub API.
  2. A small OAuth proxy on Cloudflare Workers, because GitHub will not allow a browser-only OAuth flow without a client secret.

The flow is plain: an editor saves an article → Decap commits to main → Cloudflare Pages rebuilds → the new page is live within a minute.

Three real traps

First, the callback URL must match exactly. One differing character in the GitHub OAuth app produces a redirect_uri_mismatch that explains nothing.

Second, base_url in config.yml is not the site URL. It is the Worker proxy URL, not the website domain. This is the most common cause of a login screen that spins forever.

Third, CSP can block the CMS. The admin panel loads a script from unpkg.com and calls api.github.com. If security headers are too strict, the panel renders blank with no clear error — check the console first.

When this pattern doesn’t fit

If content needs processing (dynamic pricing, stock, comments), a static site is not the first choice. For editorial content that changes a few times a week, this pattern is hard to beat: no database, no server bill, free change history.