How this website is built: Next.js, Sanity and tests

Personal website

You are reading a page that was never written as a web page. It is a document in a content management system called Sanity, and the website fetches it when you visit. That split, content in one place and presentation in another, is the main idea behind this site.

Why a CMS for a personal site

A CMS lets me change my career history, projects and posts without touching code. In Sanity I edit a form, and the site picks up the change within about 30 seconds. The technical name for that is incremental static regeneration: pages are prebuilt for speed, then quietly rebuilt in the background on a timer.

How a page gets built

The site is Next.js 16. The data flows in one direction: Sanity, then query functions written in GROQ (Sanity's query language), then server components that render the page, then client components for anything interactive. TypeScript types are generated from the Sanity schema, so if I rename a field in the CMS the compiler tells me where the site breaks.

Styling is Tailwind CSS v4. Images go through Sanity's image URL API, which resizes and optimizes them.

Keeping it from breaking

  • Unit tests with Jest 30 and React Testing Library.
  • Visual tests with Playwright. They open 6 pages at 6 screen sizes, from a small phone to a desktop, and check for horizontal scrolling, broken images, console errors and the responsive layout rules.
  • A pre-push check using Husky. It blocks a push if test coverage falls under the thresholds: 25% of lines, 35% of functions and 15% of branches. The check is there to stop coverage from sliding.
  • ESLint and pre-commit hooks for the usual code quality checks.

Shipping

Every push to the main branch starts a GitHub Actions workflow. It builds the site first, then hands the finished build to Vercel with the --prebuilt flag, so Vercel does not build it a second time.

Working with AI tools

I built the site with help from Claude and GitHub Copilot. It is also where I try out AI-assisted workflows before I bring them into professional work. This post is a small example: it was created in Sanity by a script, as a disabled draft, so I can read it in the Studio before anyone else can.