Astro + MDX + Tailwind = Your New Favorite Stack

Neelesh RoyNeelesh Roy
3 min read

Build blazing-fast websites with zero-JS defaults, Markdown superpowers, and utility-first styling.

If you’re tired of bloated SPAs, slow time-to-interactive, and clunky styling setups — I’ve got a stack for you.

Meet: Astro + MDX + Tailwind

This combo is perfect for blogs, marketing sites, personal portfolios, docs, and even light SaaS landing pages. It gives you the power of modern dev tooling without the baggage.

Why This Stack Slaps

  • Astro gives you static-by-default performance with optional interactivity.

  • MDX lets you mix Markdown and components like a god-tier CMS.

  • Tailwind CSS gives you rapid, scalable UI without leaving your HTML.

Together? You get a minimal, maintainable, scalable, and fast frontend.

Quick Setup

npm create astro@latest
cd your-project
npm install
npx astro add mdx
npx astro add tailwind

That’s it.

You’ve got:

  • .mdx support in /pages

  • Tailwind classes globally

  • Astro’s static rendering and component syntax

Writing Pages in MDX

src/pages/blog/my-post.mdx

---
title: "My First Astro Blog Post"
date: 2025-07-10
---

# Hello, world 👋

This blog post is written in Markdown.

<Counter client:load />

Tailwind in Markdown!

<div className="bg-blue-100 text-blue-800 p-4 rounded">
  This is a styled box using Tailwind
</div>

Layouts That Just Work

You can define a layout once, and reuse it across all MDX content.

src/layouts/BlogLayout.astro

---
const { title, date } = Astro.props;
---

<article class="prose prose-lg mx-auto py-8">
  <h1>{title}</h1>
  <p class="text-sm text-gray-500">{date}</p>
  <slot />
</article>

Now use it in your post:

---
layout: ../layouts/BlogLayout.astro
title: "My Post"
date: "July 10, 2025"
---

Content here.

This keeps your design clean and consistent.

Component Islands with client:*

Want interactivity? Use React, Svelte, Vue, or Solid only where needed.

---
import Counter from '../components/Counter.jsx';
---

<Counter client:load />

This avoids the React tax. Only interactive components ship JS.

Tailwind UI = Instant Polished Components

Tailwind is built for speed. Need a call-to-action box?

<div class="bg-indigo-600 text-white px-6 py-4 rounded-lg">
  <h2 class="text-lg font-semibold">Join the newsletter</h2>
  <p class="text-sm">Get tips weekly.</p>
  <button class="mt-2 bg-white text-indigo-600 px-3 py-1 rounded">
    Subscribe
  </button>
</div>

No component library needed. No configuration hell.

Performance: Built In

  • Static HTML pages

  • Minimal JS

  • Perfect Lighthouse scores

  • Instant load on 3G

Ideal Use Cases

Project TypePerfect for this Stack?
Blog✅ Yes
Docs Site✅ Yes
Portfolio✅ Yes
SaaS Landing Page✅ Yes
Full Dashboard SPA❌ No

You can still build SPAs using Astro, but that’s not where this stack shines.

SEO & Metadata

Each .mdx file can include frontmatter that Astro can map to SEO tags:

---
title: "Astro MDX Tailwind Stack"
description: "The ultimate modern stack for fast, content-rich websites."
---

Use @astro/meta, @astro/head, or just inject tags into <head> via your layout.

Final Thoughts

Astro + MDX + Tailwind isn’t just hype — it’s the most productive, fast, and enjoyable stack I’ve used in years.

You write Markdown. You sprinkle in React/Svelte/etc. only when needed. You style instantly with Tailwind. And the result? Zero JS bloat, 100% speed.

0
Subscribe to my newsletter

Read articles from Neelesh Roy directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Neelesh Roy
Neelesh Roy

Neelesh is a Senior Frontend Engineer in the insurance technology industry. He specializes in building responsive, reliable, and user-friendly web applications. With years of experience in modern JavaScript frameworks, he cares deeply about clean code, performance, and good user experience. Neelesh enjoys solving complex business problems with simple, practical solutions. He often works closely with designers and backend teams to bring ideas to life. Outside of work, he likes to stay updated with the latest in web development and technology trends.