Check if it fits Tell us what keeps taking extra work or getting delayed. We will check what, if anything, makes sense next, at no cost.
← All posts

From MDX to Sanity: How I Built a Real-Time Publishing System

When a website grows, its publishing system must grow with it. For years, my site used MDX files, simple, reliable, but slow for non-technical editing. Each update meant touching Git, rebuilding the site, and waiting for deployment. That friction didn’t scale.

By Mirko Imperio Trotta

system-log-003-or-headless-cms-architecture-with-sanity-io-and-real-time-revalidation

When a website grows, its publishing system must grow with it. At the beginning, my site used MDX files, simple, reliable, but slow for non-technical editing. Each update meant touching Git, rebuilding the site, and waiting for deployment. That friction didn’t scale.

This post explains how I migrated to Sanity.io, integrated real-time revalidation, and turned a static blog into a living publishing system.

Why the Change

The MDX setup worked well for personal notes but failed when I needed:

  • Bilingual content management (English and German)
  • Rich media, links, and structured metadata
  • Simple editing for future collaborators or clients

The biggest issue was speed. Updating text shouldn’t require a build pipeline. I wanted a system where editors could publish in seconds, without losing developer control over structure or design.

The New Architecture

The site now runs on Next.js 15, connected to Sanity.io as the headless CMS, and deployed through Docker on a Hetzner VPS. The migration removed the need for local content files entirely. Posts, tags, categories, and metadata all live inside Sanity.

Each time content is published in Sanity, the site instantly refreshes. There’s no redeployment or build step. This is achieved through a webhook connection that tells the live site which content changed, prompting immediate revalidation.

The difference is dramatic, what once took minutes now takes seconds.

Workflow in Practice

Writers can now:

  1. Create and edit content directly in Sanity’s interface.
  2. Preview drafts live on the same domain, without separate staging.
  3. Publish when ready and see the update appear almost instantly.

As a developer, I still control the schema, fields, and layout. This balance between flexibility for editors and structure for developers is the real power of headless architecture.

Results and Lessons Learned

The migration changed how I publish content:

  • Updates appear live within seconds.
  • No build queues or redeploys.
  • Draft previews for review before publishing.
  • Centralized content management for both languages.

It also made the system easier to maintain. Removing MDX reduced repo size, simplified Docker images, and eliminated broken paths caused by local content syncing.

This setup proves that real-time publishing doesn’t need massive infrastructure, it just needs the right architecture.

Closing Note

Migrating from MDX to Sanity was more than a technical upgrade, it redefined my publishing workflow. It showed that modern web systems can be both structured and flexible, giving editors freedom while keeping developers in control.

This is what I value most: simple systems that scale naturally, without friction.

Is recurring work behind the question?

Tell us what keeps happening in the free fit check. We will review whether Groundlens is the right next step.