Back to Blog

Astro Content Collections: Managing Content Without a Database

#astro#webdev#cms
Astro Content Collections: Managing Content Without a Database

When I rebuilt this site with Astro, one of my favorite features was Content Collections. It’s what lets my blog and portfolio run without a database at all — all the content is just Markdown files in the src/content/ folder.

The mechanism is simple: you define a schema (using Zod) for each “collection” — say, blog or portfolio — with required fields (title, description, publish date) and optional ones (tags, image, video). Astro automatically validates every Markdown file against that schema at build time. If a field has the wrong type or is missing, the build fails immediately with a clear error — much safer than a CMS with no type validation.

What makes this powerful for my case: writing a new post is just creating a new .md file with the right frontmatter, commit, push. No logging into an admin panel, no API calls, no database to back up or maintain.

For my workflow — brainstorming content with AI and then hand-editing — this fits perfectly. Markdown files are easy for both me and the AI tools I use to generate and edit directly.

If you’re building a personal blog or portfolio and don’t need complex CMS features (multi-user editing, approval workflows, and so on), Astro’s content collections are worth trying.