OWolf

AboutBlogProjects
©2025 OWolf.com

Privacy

Contact

Web Development

MDX Blog

October 4, 2024

O. Wolfson

A Developer-Centric Blogging Platform Powered by MDX & Next.js

Project by: O. Wolfson
Role: Full-Stack Developer, System Architect
Stack: Next.js 15 · MDX · Tailwind CSS · Supabase (optional) · TypeScript · Zod · React


Overview

MDXBlog is an open-source, developer-first blogging platform that blends the elegance of Markdown with the power of React components via MDX. Built with Next.js and a modern component architecture, MDXBlog enables anyone to spin up a fast, secure, and interactive blog in minutes—without needing a database or CMS.

This project grew out of a personal need: I wanted a writing experience that felt as seamless as coding. The result is a platform that puts content creation and developer comfort at the center.


Key Goals

  • ✅ Eliminate friction from the writing and publishing workflow
  • ✅ Let authors use their code editor as a CMS
  • ✅ Empower developers to build interactive blog content with React
  • ✅ Offer clean, modern, responsive design out of the box
  • ✅ Support scheduled publishing, custom components, and SEO

Technical Architecture

⚙️ Core Stack

  • Next.js 15 with App Router and static site generation for SEO and performance
  • MDX v3 (@mdx-js/loader, @next/mdx) to power interactive posts that embed JSX directly in Markdown
  • Tailwind CSS, tailwind-merge, and tailwindcss-animate for utility-first, responsive styling
  • React 18 + Zod + react-hook-form for form validation (e.g., donation, comments, admin tools)
  • Supabase (optional) for authentication or back-end persistence if needed

🗃️ File-Based Content Layer

MDXBlog stores posts as .mdx files in the local filesystem, keeping content portable, version-controlled, and easy to manage. Posts include embedded metadata using export const metadata = {} (preferred over frontmatter), enabling control over title, date, tags, author, and scheduling.

🧠 Content Caching System

json
"prebuild": "node lib/cache/generate-cache-posts.mjs"

At build time, MDXBlog generates a cache of all published posts based on metadata. This ensures lightning-fast page loads, avoids unnecessary rebuilds, and enables advanced features like scheduled publishing and draft visibility control in development mode.


Notable Features

✍️ Local-First Content Creation

  • Create a post instantly using the ➕ button in dev mode
  • Write in VSCode, with full access to Markdown and React syntax
  • No login, no admin panel—just code and content

📆 Scheduled Publishing

Posts with a future publishedAt date are hidden from public view until their scheduled release. This enables:

  • Planned editorial calendars
  • Time-sensitive announcements
  • Automatic post rollout with zero manual overhead

🧩 Custom Components

You can embed any React component directly inside .mdx posts. Built-in components include:

  • <YouTube id="..." /> — embed videos by ID
  • <Image src="..." caption="..." /> — optimized images with captions
  • <Code> blocks with syntax highlighting via rehype-highlight
  • <Alert>, <Note>, <Button> and any others you define

No extra imports needed—these are globally available across your MDX content.

🧠 Metadata-Driven Filtering

Posts are dynamically rendered based on:

  • Publication date (filters out future-dated posts)
  • Tags and categories
  • Author
  • Last modified date (displayed contextually)

This enables powerful custom blogroll logic, such as hiding drafts, showing "Recently Updated" flags, or sorting posts intelligently.


Developer Experience

bash
git clone https://github.com/your-org/mdxblog
npm install
npm run dev

Posts are stored in content/posts/. Each .mdx file is a full-featured post. Metadata is defined inline as a metadata export, no frontmatter needed. You can preview edits locally or deploy instantly with Vercel.

Other niceties:

  • EditPostButton and OpenInVSCode in dev mode
  • No backend required (optional Supabase integration available)
  • SEO optimized with sitemap generation (next-sitemap)

Use Cases

  • 🧑‍💻 Dev Blogs: Technical posts with embedded code and live components
  • 🎓 Courseware: Interactive tutorials with step-by-step guides
  • 📝 Portfolio Content: Easily manage articles alongside a personal site
  • 🧪 Experimental Publishing: Write essays that include React, sliders, visualizations, or media embeds

Why MDX?

MDXBlog is built around a simple belief:

Markdown is the best writing UX. React is the best rendering engine. MDX is both.

This makes the blog platform intuitive for developers, powerful for content creators, and blazingly fast for readers.


Final Thoughts

MDXBlog is more than a template—it’s a publishing philosophy. It’s designed for developers who want to write without being slowed down by CMS complexity or publishing constraints. It’s simple to install, easy to use, and endlessly extensible.

"If you can write Markdown and React, you already know how to blog with MDXBlog."


Want to Try It?

Check out: https://www.mdxblog.io Docs, demos, and the full codebase are available. Contributions are welcome.

If you’ve enjoyed using MDXBlog or find it useful for your projects, consider donating or sponsoring to help maintain its development for the MDX community.


▊