2025-01-20 · 5 min · commit a47f2b1
blog/getting-started-with-astro.md
Getting Started with Astro
Astro is a modern static site generator that focuses on delivering fast, content-focused websites. One of its key features is shipping zero JavaScript by default.
Why Astro?
Here are some reasons why Astro stands out:
- Zero JS by default - Only ship JavaScript when you need interactivity
- Island Architecture - Hydrate only the components that need it
- Framework Agnostic - Use React, Vue, Svelte, or just plain HTML
- Content Collections - First-class support for Markdown and MDX
Quick Start
Creating a new Astro project is straightforward:
npm create astro@latest
Then start the dev server:
npm run dev
Content Collections
Astro’s Content Collections provide type-safe content management:
import { defineCollection, z } from 'astro:content';
const blog = defineCollection({
type: 'content',
schema: z.object({
title: z.string(),
pubDate: z.date(),
tags: z.array(z.string()),
}),
});
export const collections = { blog };
Conclusion
Astro is an excellent choice for content-heavy sites like blogs, documentation, and marketing pages. Its focus on performance and developer experience makes it a joy to work with.