StealThis .dev

Astro + Tailwind Starter

Astro starter with Tailwind CSS integration, content collections, island architecture, and zero-JS-by-default static site generation.

लैब में खोलें
astro tailwindcss typescript
Targets: HTML

Code

Astro + Tailwind Starter

Astro ships zero JavaScript by default and lets you bring your favorite UI framework as interactive islands. Combined with Tailwind CSS and content collections, it’s the ideal stack for content-driven sites.

Quick Start

npm create astro@latest my-site
cd my-site
npx astro add tailwind
npm run dev

The create astro CLI offers templates (minimal, blog, starlight). The astro add command auto-installs and configures integrations.

What You Get

  • Zero JS by default — Static HTML output, no client runtime unless you opt in
  • Island Architecture — Hydrate only the interactive components you need (client:load, client:visible, etc.)
  • Content Collections — Type-safe Markdown/MDX with schema validation via Zod
  • Tailwind CSS — Configured via @astrojs/tailwind integration
  • TypeScript — First-class support with strict mode
  • SSG + SSR — Static generation by default, with optional server rendering per route
  • View Transitions — Built-in page transition API

Generated Project Structure

my-site/
├── public/
│   └── favicon.svg
├── src/
│   ├── components/
│   │   └── Card.astro
│   ├── content/
│   │   └── config.ts
│   ├── layouts/
│   │   └── Layout.astro
│   └── pages/
│       └── index.astro
├── astro.config.mjs
├── package.json
├── tailwind.config.mjs
└── tsconfig.json

Key Files

  • astro.config.mjs — Integrations (Tailwind, React, MDX), output mode, adapters, and Vite overrides.
  • src/content/config.ts — Define content collection schemas with Zod. Astro auto-generates types for your content.
  • src/layouts/Layout.astro — Base HTML shell with <slot /> for page content.
  • src/pages/index.astro — File-based routing. .astro files render to static HTML at build time.

Extend With

ToolPurpose
React / Vue / SvelteInteractive islands with your preferred framework
MDXMarkdown with components for rich content
StarlightFull-featured documentation theme
Astro DBBuilt-in SQL database for content
View TransitionsSmooth page transitions without a SPA

References

  • Astro Documentation — Complete guide to Astro features, integrations, and deployment
  • onwidget/astrowind (5.5k+ stars) — Community template with Tailwind, MDX, blog, and landing page patterns