i built my own cms instead of installing one
Every few years I rebuild this site, and every time I end up in the same place: shopping for a CMS. WordPress, Ghost, one of the headless ones with a nice editor and a pricing page. And every time I close the tabs, because what I actually need is small and what they all bring along is not.
This time I didn't close the tabs and go back to hand-editing files. I built the CMS. It's small, it's boring, and it does exactly what I want.
What I actually needed
Here's the whole list:
- A place to write short posts (this syslog) and a few standalone pages.
- A way to edit the bits on the home page: the hero text, links, the
~/.plancard. - Images in posts.
- Something I can use from a phone, so I don't need a laptop and a terminal to fix a typo. That's it. No users, no roles, no plugin marketplace, no themes. One author. Me.
Why not just use one?
Because every option I looked at solved a much bigger problem than mine, and I'd be paying for that in upkeep.
- WordPress wants PHP, a database, and a steady stream of plugin and core updates. Its popularity makes it a favorite target, and running it means owning that patching schedule forever. For a site with one author, that's a lot of surface area to defend.
- Ghost is much nicer, but it's still a server and a database I'd have to run (or pay someone to run), plus a theme system I'd have to fight to get this terminal look.
- Headless CMSes move the database to someone else's cloud. Now my content lives in their format, behind their API, on their pricing tier. That's the lock-in I wrote about in why I self-host the boring stuff, just with a nicer editor. The common thread is overhead: another runtime, another database, another login, another thing to back up, another vendor that can change the deal. My content is a handful of posts and pages. It doesn't need a database. It needs a text file.
The design: the repo is the database
So the content lives in the repo, as plain JSON with markdown bodies:
content/syslog.jsonholds the posts.content/pages.jsonholds standalone pages like /music.content/site.jsonandcontent/now.jsonhold the home page copy and the~/.planlist.content/redirects.jsonholds redirects. Every file is checked against a schema at build time. If I save something broken, the build fails with a message that names the file and the bad field, and the live site stays on the last good version.
The site itself is Next.js, deployed on Cloudflare Workers through OpenNext. Pushes to main rebuild and deploy in a minute or two. The old site was Hugo, which got the "files in a repo" part right, but it came with a lot of extras I never used: themes, taxonomies, shortcodes, a whole templating language. I wanted only the parts I'd actually touch.
Every save is a commit
This is the part I like most.
There's a password-protected admin page. When I hit save, it doesn't write to a database. It commits the changed JSON file to GitHub through the Contents API, with a message like syslog: add "..." or pages: update "Music". Cloudflare sees the push and deploys.
That one decision buys a lot for free:
- Backups. The content is in Git. It's on GitHub, on my laptop, anywhere I've cloned it.
- An audit log.
git log content/is the full history of every edit I've ever made. - Undo. Each post and page has a version history built from the commits that touched it, and I can restore any past version from the admin. No revisions table, because Git already is one.
- No conflicts. Each save changes one item and is refused if that item changed since I opened it, so two open tabs can't quietly clobber each other.
- Nothing to migrate. If I ever leave Next.js, the content is still just JSON and markdown.
Images work the same way. Paste, drop, or pick one in the editor and it gets committed to
public/uploads/<year>/<month>/with a hash of the bytes in the filename, and the markdown link goes in at the cursor. No S3 bucket, no media library. PNG, JPEG, GIF, WebP and AVIF up to 5 MB. SVG is refused, because an SVG is really a document that can carry scripts.
Keeping the admin boring
A homemade admin is only a good idea if it's boring to attack. So it is:
- The password is stored as a scrypt hash, compared in constant time.
- The session is an HMAC-signed cookie:
HttpOnly,Secure,SameSite=Strict, scoped to the admin pages, and it expires after 12 hours. - Every server action checks the session again. Getting past the redirect isn't enough.
- Logins are delayed and throttled per client (5 tries per 15 minutes), where a client is an IPv4 address or an IPv6 /56, so you can't dodge the limit by hopping addresses. There's no global cap, so a flood from elsewhere can't lock me out.
- The client IP comes only from Cloudflare's
cf-connecting-ipheader, neverx-forwarded-for, which anyone can fake. - The GitHub token can write to this one repository's contents and nothing else, and it only exists on production. Branch previews don't get it. The markdown renderer is a small parser I own, with no dependencies, and it never passes raw HTML through. The whole site runs on Next, React and zod at runtime. Every dependency I didn't add is one I never have to update.
What it does now
It started as "edit a JSON file from a form" and grew one feature at a time, each one because I actually wanted it:
- Drafts. Posts and pages can be drafts, and the save button says what it's going to do ("Save draft" vs "Publish page"). I added that after I published a page that never showed up, because it had quietly saved as a draft.
- Scheduled posts. Date a post in the future and it stays hidden until it's due. An hourly GitHub Action checks for posts that came due and pokes a Cloudflare deploy hook, so they go live within the hour.
- Per-host syslog. Every post is tagged with the host it's about. Each host gets its own page and its own RSS feed, if you only care about one box.
- Redirects and search. Rename a slug and the admin offers to redirect the old URL (ticked by default). The post list has a search box.
- SEO and analytics. A sitemap,
robots.txt, a description and share image per post (defaulting to the first image in the body), and Cloudflare Web Analytics, which only loads on the real domain so previews never count. - Comments. Posts have comments through giscus, which stores them as GitHub Discussions in a public repo. Once again, no database of mine.
- The small stuff. The nav reads like paths (
~/ /syslog /music /contact), titles are lowercase across the site, and every post signs off with a proper--sig separator, the way mail and Usenet did it.
How it got built
I built this with Claude as a pair. Early on that was a little "software factory" in the repo: each feature got a written spec, a build on its own branch, and separate code, security, UI and UX reviews before I approved the merge. Later it turned into working through it in conversation, one pull request per feature. Either way the rule stayed the same: nothing merges without me reading it.
It's a good fit for this kind of project. The design decisions are mine (repo as database, commit on save, no new dependencies without a reason), and the AI is great at the careful, tedious parts: the throttle edge cases, the tests, the schema errors that name the right field.
Was it worth it?
For me, yes. The whole thing is under ten thousand lines I understand, running on a platform I don't have to patch, storing content in a format I'll still be able to read in twenty years. There's no database to back up, no plugin to update, and no vendor that can change the pricing page on me.
Would I tell everyone to do this? No. If you have a team of writers, editorial workflows, or a client who needs a familiar editor, use a real CMS. That's the problem they're built for.
But if it's just you and a handful of posts, you might not need a CMS. You might need a form that makes a commit.
-- jonwgeorge
comments
sign in with github to comment. comments are kept in github discussions.