How I built this blog, the logic behind it, and how to build yours
The decisions, stack, workflow and mistakes behind this Next.js and MDX blog, plus a step-by-step plan and checklist to build your own without a CMS or database.
On this page
- Why not use a platform?
- The rules I set before writing code
- How the content is organized
- The stack, and why each piece is there
- How an article becomes a page
- The features, in the order I built them
- The workflow: specs first, then implementation
- What went wrong
- Build your own
- 1. Decide your rules and structure
- 2. Create the project
- 3. Define your design tokens
- 4. Build the content system
- 5. Add the pages
- 6. Deploy early
- 7. Add features in small steps
- 8. Add tests where mistakes are costly
- 9. Write a README for yourself
- A checklist before you launch
- What I would do differently
This blog has no database, no admin panel and no CMS. Every article is a text file in a Git repository, and every page is built ahead of time and served as static HTML. That was a deliberate choice, and most of the other decisions follow from it. This article explains the logic first, then the stack and the workflow, then the mistakes I made, and ends with a plan you can follow to build your own.
Why not use a platform?
Medium, Substack and WordPress are good tools, and for many people they are the right answer. I wanted something different:
- Ownership. My articles are plain files in my repository. If a hosting service changes its rules, I move the files.
- A product I can improve. Search, tags, a newsletter and dark mode are features I could design myself, and I wanted to learn how they work.
- Speed. A static page is fast by default, and that helps both readers and search engines.
- A portfolio. The blog is itself a project I can point to.
If you only want to write, a platform is faster. Build your own if the building is part of the point.
The rules I set before writing code
Before the first line of code, I wrote down rules. They saved me from many later arguments with myself.
- It is a reading product. Fast, readable and easy to write for. Content matters more than features.
- No backend unless forced. Anything that seems to need a server must be justified. In the end only the newsletter form needs one.
- Content is data that fails loudly. A mistake in an article's header must stop the build with a message that names the file.
- One source of truth for structure. Sections and subsections are defined in one file and used everywhere else.
- Ask before adding anything that tracks people. Analytics and cookies come later, behind consent.
How the content is organized
The site has three sections, and each has two or three subsections:
| Section | Purpose | Subsections |
|---|---|---|
| Web | Evergreen articles and resources | concepts, technologies, dev-resources |
| AI | Curated tools and repositories | tools, repos |
| XR | Time-sensitive news | products, events |
An article lives at content/{section}/{subsection}/{slug}.mdx, and its URL is the same path. Keeping folder and URL identical means there is nothing to look up later.
Every article also has a format, which sets expectations for the reader and for me as the writer:
| Format | Use it for |
|---|---|
| article | A full explanation, tutorial or opinion |
| quick-pick | One tool or repository: what it is, who it is for, why it is worth it, and one limitation |
| news | A dated announcement, always with a source |
| roundup | A short curated list on one theme |
The stack, and why each piece is there
| Need | Choice | Reason |
|---|---|---|
| Framework | Next.js, App Router, TypeScript | Static generation, good defaults for SEO, and I already use it for client work |
| Styling | Tailwind CSS with design tokens as CSS variables | Colors, type and spacing are defined once, and dark mode changes only the variables |
| Content | MDX files rendered with next-mdx-remote | Markdown for writing, components when Markdown is not enough |
| Validation | Zod | A bad header fails the build instead of reaching readers |
| Search | Pagefind | A static search index with no server |
| Newsletter | MailerLite | Double opt-in and subscriber storage handled by a service built for it |
| Comments | Giscus | Comments stored as GitHub Discussions in a separate public repository |
| Analytics | Google Analytics 4 | Loaded only after the visitor accepts a consent banner |
| Hosting | Vercel | Deploys on every push to the main branch |
| Tests | Vitest and Playwright, run in GitHub Actions | Unit tests for the logic, browser tests for the flows that matter |
None of these is the only good option. The point is that each one solves a named problem, and none was added because it was fashionable.
How an article becomes a page
This pipeline is the core of the blog. It is short enough to hold in your head:
- I write an
.mdxfile with a header (the frontmatter) and a body. - A loader reads every file under
content, and Zod validates the header. - The loader checks that the
sectionandsubsectionin the header match the folder, and throws an error with the file path if they do not. - The body is compiled to React with plugins for heading links, tables and syntax-highlighted code.
- Next.js generates a static page for each article, plus the section pages, tag pages, the sitemap and the RSS feed.
- After the build, a script creates the search index.
The header is the contract between me and the site. This is a real one:
title: "How server-side rendering works"
description: "One or two sentences used for search results and cards."
date: 2026-10-14
section: web
subsection: concepts
format: article
tags: [nextjs, rendering]
featured: false
draft: false
lang: enThe schema enforces the rules: descriptions between 80 and 170 characters, lowercase hyphenated tags, a subsection that belongs to its section, and an alt text whenever there is a cover image. Drafts show in development and are excluded from production builds, the sitemap, the feed and search.
The features, in the order I built them
I split the work into phases, so the blog was usable early and never half-broken.
Phase 1: a blog that works. Project setup, the MDX content system, core pages, the post layout, responsive design with dark mode, SEO basics, the RSS feed and deployment.
Phase 2: a blog people can navigate. Tag pages, search, related posts with previous and next links, generated social images, and analytics.
Phase 3: a blog people can follow. Featured posts on the home page, share buttons and comments, searchable resource directories, and the newsletter.
Phase 4: a blog that is pleasant to write. Reusable MDX components such as callouts, code tabs, link cards and figures, a "last updated" label, and a saved list that lives in the reader's own browser.
A few details worth copying:
- SEO is built in, not added later. Every page has its own title, description, canonical URL and social image, and articles carry structured data.
- Social images are generated. If an article has a cover image, that image is used. Otherwise the site draws one from the title.
- Privacy is the default. Google Analytics does not load until a visitor accepts. Comments do not load until a reader asks for them. The saved list never leaves the reader's browser.
- The newsletter token stays on the server. The form posts to a server route that talks to MailerLite, so the API token never reaches the browser.
The workflow: specs first, then implementation
I did not ask an AI assistant to "build me a blog". I wrote small specification files, one per feature. Each file has a goal, the current starting point, a list of tasks and acceptance criteria that can be checked. I wrote and refined these specs with an AI assistant, and GitHub Copilot in VS Code did the implementation, one file at a time. I reviewed the result and made every commit myself.
Two project files carry the rules for every session:
AGENTS.mdholds the stack, folder layout, content model, coding rules and a list of things the agent must ask about before doing.DESIGN.mdholds the colors, type scale, spacing and component rules.
This approach has three advantages. Each task is small enough to review. The rules are written once instead of repeated in every prompt. And when something breaks, I know which spec to blame.
What went wrong
The mistakes taught me more than the plan did.
The search index worked locally and failed on Vercel. My first setup built the Pagefind index from the HTML in the .next folder. On Vercel, the build log showed that Pagefind found no HTML files, so the whole deployment failed. The fix was to stop depending on build output and to generate the search records from the same content loader the site uses.
A wide image overlapped the table of contents. The layout worked for normal figures, but a wide figure ran under the sidebar. The fix was a wider sidebar column at large screen sizes, with the figure width limited to match.
Search results opened a 404 page. The index stored links ending in .html, which the site does not serve. Stripping the extension fixed it.
Continuous integration could not find a script. A static server script worked on my machine only because I had never committed it. Commit everything your pipeline needs, and run the pipeline on a clean checkout.
The common thread: each of these passed on my computer and failed somewhere else. A deployment pipeline and a few browser tests catch that class of mistake, which is why I set them up.
Build your own
You can follow the same path. The steps below assume you know basic React and Git.
1. Decide your rules and structure
Write down what the blog is for, who reads it, and your sections. Keep the list short. You can add a section later, but renaming published URLs is painful.
2. Create the project
npx create-next-app@latest my-blogpnpm create next-app@latest my-blogyarn create next-app my-blogChoose TypeScript, Tailwind, the App Router and a src directory when prompted. The exact prompts change between versions, so read them before accepting the defaults.
3. Define your design tokens
Put colors, fonts and spacing in CSS variables, and override them for dark mode. Everything else should use the variables. This is what makes a later redesign a small change.
4. Build the content system
Install the content libraries:
npm install gray-matter zod next-mdx-remote remark-gfm reading-timepnpm add gray-matter zod next-mdx-remote remark-gfm reading-timeyarn add gray-matter zod next-mdx-remote remark-gfm reading-timeThen write a small loader that reads the files, parses the header with gray-matter, validates it with a Zod schema, and returns typed posts sorted by date. This is the most important file in the project, so test it first.
import { z } from "zod";
export const frontmatterSchema = z.object({
title: z.string().min(5),
description: z.string().min(80).max(170),
date: z.coerce.date(),
section: z.enum(["web", "ai", "xr"]),
subsection: z.string(),
format: z.enum(["article", "quick-pick", "news", "roundup"]),
tags: z
.array(z.string().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/))
.default([]),
featured: z.boolean().default(false),
draft: z.boolean().default(false),
});Adapt the sections and formats to your own blog.
5. Add the pages
You need a home page, section and subsection pages, and an article page that calls generateStaticParams so every article is built ahead of time. Add the metadata, sitemap and RSS feed at the same time, not at the end.
6. Deploy early
Push to GitHub and connect the repository to a host such as Vercel. Deploy after the first article renders. A deployment pipeline you set up on day one will catch problems while they are small.
7. Add features in small steps
Add them in this order, and stop whenever the blog is good enough: tags, search, related posts, social images, a newsletter, comments, and analytics with consent. After each feature, run the lint, type check and build, then commit.
8. Add tests where mistakes are costly
Test the loader and the pure helpers with unit tests, and the flows that must not break, such as search and newsletter signup, with a browser test. Run both in continuous integration.
9. Write a README for yourself
Document the header fields, the formats and the steps to publish. Future you will not remember.
A checklist before you launch
What I would do differently
I would write the tests earlier. I left them until Phase 1 and 2 were done, and then had to retrofit them around code that was already written. I would also make cover images a rule from the start, because adding them later touched every list page and the content schema.
The bigger lesson is about scope. The blog works because it stayed small: no database, no accounts, no admin dashboard. Every feature I did not build is a bug I do not have to fix. If you build your own, protect that simplicity as long as you can.
Comments
Comments are optional. Loading them connects your browser to Giscus and GitHub. Read the privacy details.