AstroWind template in depth
While easy to get started, AstroWind is quite complex internally. This page provides documentation on some of the more intricate parts of the template.
Project Structure
AstroWind follows a well-organized project structure that makes it easy to find and modify files:
src/pages/- Page routes and entry pointssrc/components/- Reusable UI componentssrc/layouts/- Page layout templatessrc/content/- Content collections for blog posts and other contentsrc/styles/- Global styles and CSS variables
Content Collections
AstroWind uses Astro’s content collections feature for managing blog posts and other structured content. Each collection has a defined schema using Zod for type-safe content.
Component Architecture
Components are organized into three categories:
Block Components
These are full-width page sections like Hero, Features, Pricing, and FAQ. They accept data through props and render complete sections.
Global Components
Shared across all pages - Navbar, Footer, SEO meta tags, and theme toggle.
UI Components
Small, reusable primitives like Button, Card, and Badge that are composed into larger blocks.
Tailwind CSS Configuration
The template extends Tailwind’s default configuration with:
- Custom color palette using CSS variables
- Extended typography settings
- Custom animation utilities
- Responsive breakpoint adjustments
Dark Mode Implementation
Dark mode is implemented using a combination of:
- CSS custom properties for color theming
- A JavaScript toggle that persists preference in localStorage
- System preference detection via
prefers-color-scheme
SEO and Meta Tags
Every page includes comprehensive SEO meta tags including Open Graph and Twitter Card data. The SEO component automatically generates appropriate tags based on page data.
Performance Optimizations
AstroWind achieves excellent performance through:
- Static site generation with minimal JavaScript
- Optimized image loading with Astro’s built-in image component
- Efficient CSS with Tailwind’s purging of unused styles
- Proper caching headers and asset optimization