Back to blog

Building a Blog with Next.js and Markdown

A walkthrough of how I built this blog using Next.js App Router, Tailwind CSS, and Markdown files — no backend required.

nextjs
react
markdown

Why Next.js for a Blog?

When I set out to build my personal blog, I wanted something that was fast, easy to maintain, and didn't require a backend. Next.js with its static site generation (SSG) capabilities was the perfect fit.

The Stack

Here's what I'm using:

  • Next.js — React framework with App Router
  • Tailwind CSS — Utility-first styling
  • Markdown (MDX) — Write posts in Markdown, render as React
  • Vercel — Zero-config deployment

How It Works

Each blog post is a .mdx file in the content/posts/ directory. The frontmatter at the top of each file contains metadata like the title, date, tags, and description.

import fs from "fs";
import matter from "gray-matter";

const fileContent = fs.readFileSync("my-post.mdx", "utf-8");
const { data, content } = matter(fileContent);

At build time, Next.js reads all the Markdown files, parses them, and generates static HTML pages. This means:

  1. Zero server costs — Everything is pre-built
  2. Instant loading — Pages are served from a CDN
  3. Easy writing — Just add a .mdx file and deploy

What's Next

I plan to add more features like:

  • RSS feed generation
  • Reading time estimates
  • Related posts suggestions

Stay tuned for more updates!