DEV Community

Cover image for Building Git-like Version Control for a Headless CMS (Next.js + Supabase)
NextBlock
NextBlock

Posted on

Building Git-like Version Control for a Headless CMS (Next.js + Supabase)

How we implemented “Time Travel” for content editors without exploding our database.

I just merged one of the most requested features for NextBlock: Content Revision History.

We all know the pain of a client deleting a paragraph and then asking, “Can we get that back?” 😅

The Challenge: Most CMS solutions either don’t track history or bloat the database by duplicating entire rows for every save. We wanted something faster and smarter.

The Stack:

Next.js 15: For the reactive admin UI.
Supabase (PostgreSQL): Storing JSONB deltas.
Zod: Validating the schema integrity of past versions (so restoring an old version doesn’t break the new UI).
How it works: We are diffing the JSON content blocks and storing snapshots only when significant changes are detected. This keeps our storage footprint low while giving editors the confidence to “Save” without fear.

It’s live in the repo now. Go break it and let me know what you think! 👇
https://github.com/Webman-Dev/nextblock-monorepo

Sneak peak here: https://x.com/NextBlockCMS/status/2003474634340290704?s=20

Top comments (0)