TypeScript Data Files as a Lightweight CMS
TypeScriptArchitectureContent
When building a small personal site, choosing how to manage content is one of the first architectural decisions you'll face. You could reach for a headless CMS, set up MDX, or go with something simpler.
The Case for TypeScript Data Files
For a site with fewer than 50 pieces of content, a typed TypeScript array gives you everything you need: type safety, IDE autocomplete, easy refactoring, and zero external dependencies. Your content lives right next to your code.
export type Article = {
slug: string;
title: string;
body: ContentBlock[];
};
export const articles: Article[] = [
{ slug: "my-post", title: "My Post", body: [...] }
];When to Migrate
This approach stops scaling well when you have non-developer contributors, need a preview/draft workflow, or your content count grows beyond what's comfortable in a single file. At that point, MDX or a headless CMS makes more sense — but you can migrate incrementally since your types already define the content shape.