Migrate Gatsby to Astro | Social Animal
Your Gatsby Builds Are Burning 20 Minutes You'll Never Get Back
Why leave Gatsby?
- GraphQL forces you to write resolvers just to query local markdown files
- Builds balloon to 15–30 minutes once you cross 500 pages
- React runtime ships to every static page with zero interactive elements
- Plugin dependencies rot with unpatched CVEs and abandoned maintainers
- Development stalled post-Netlify acquisition with no major release roadmap
- Incremental builds fail unpredictably, forcing full rebuilds that kill momentum
What you gain
- Mobile Lighthouse scores hit 95–100 with zero client-side JavaScript by default
- Type-safe content queries via getCollection() replace GraphQL ceremony
- 500-page sites rebuild in under 30 seconds using Vite's dependency pre-bundling
- Islands architecture hydrates only your interactive components, leaving HTML static
- Active monthly releases and a growing integration ecosystem backed by real funding
- Your team deploys 6x per day instead of waiting for build queues to clear
Gatsby had a good run. It pioneered the React-based static site generator category and introduced thousands of developers to the JAMstack. But it's stalled. Netlify acquired Gatsby in early 2023, development has slowed to a crawl, the plugin ecosystem is deteriorating, and build times on large content sites are still painfully slow.
Astro was built to solve exactly the problems Gatsby created. Zero JavaScript by default, content collections that replace GraphQL complexity, build times that make Gatsby look embarrassingly slow. If you're maintaining a Gatsby content site, migrating to Astro isn't just an upgrade—it's overdue.
The Gatsby Pain Points Driving Migration
GraphQL Complexity for Simple Data
Gatsby's GraphQL data layer was innovative when it launched. It was also massive overkill for most content sites. Want to list your blog posts? Write a GraphQL query. Want to pull frontmatter from a markdown file? GraphQL query. Want to display an image? GraphQL query wrapped in a special component.
For a marketing site with 50 pages, you're maintaining dozens of GraphQL queries just to render content that lives in your own file system. The abstraction adds cognitive overhead without proportional benefit.
Build Times That Scale Poorly
Gatsby's build pipeline processes every page through its GraphQL layer, runs image transformations, and generates the full React bundle for each route. A 500-page content site can take 10-15 minutes to build. A 2,000-page site? You're looking at 30+ minutes, even with incremental builds enabled.
Every content update means waiting. Every typo fix means waiting. Your content team starts to resent the tool.
The Plugin Ecosystem Is Decaying
Gatsby's strength was its plugin ecosystem—gatsby-plugin-image, gatsby-plugin-sharp, gatsby-source-filesystem, gatsby-transformer-remark. Many of these plugins haven't been meaningfully updated in over a year. Dependency conflicts multiply. Security advisories pile up. You run npm audit and see 47 vulnerabilities, most buried deep in the Gatsby dependency tree.
Heavy JavaScript Bundles
Gatsby ships the entire React runtime to every visitor, even for pages with zero interactivity. A static "About Us" page still downloads React, ReactDOM, and Gatsby's runtime. Your Lighthouse scores suffer, Core Web Vitals tank, and users on slower connections pay the price.
What Astro Gives You
Content Collections Replace GraphQL
Astro's content collections are purpose-built for content sites. Define a schema in TypeScript, drop your markdown files in a folder, query them with getCollection('blog'). No GraphQL. No special plugins. Type-safe frontmatter validation out of the box.
// src/content/config.ts
import { defineCollection, z } from 'astro:content';
const blog = defineCollection({
schema: z.object({
title: z.string(),
date: z.date(),
tags: z.array(z.string()),
image: z.string().optional(),
}),
});
That's it. No gatsby-node.js, no createPages API, no GraphQL fragments. Your data fetching is a single function call in the component that needs it.
Zero JavaScript by Default
Astro ships zero client-side JavaScript unless you explicitly opt in. A 50-page marketing site sends pure HTML and CSS to the browser. When you need interactivity—a contact form, an image carousel, a search widget—you use Astro's Islands architecture to hydrate only that component.
The result: Lighthouse scores of 95-100 on mobile without any optimization tricks.
Sub-Second Builds
Astro runs on Vite. A 500-page content site builds in under 30 seconds. A 2,000-page site builds in under 2 minutes. Hot module replacement in development is instant. Your content team can preview changes in milliseconds instead of waiting for Gatsby's develop server to recompile its GraphQL schema.
Framework Agnostic Components
Already have React components from your Gatsby site? Astro renders them at build time or hydrates them client-side—your choice. Want to gradually migrate to Astro components, or try Vue or Svelte for specific features? Astro supports all of them in the same project.
Our Gatsby to Astro Migration Process
Phase 1: Audit and Architecture (Week 1)
We start by mapping your existing Gatsby site—every page template, every GraphQL query, every plugin dependency, every dynamic route. We document your gatsby-node.js configuration, identify custom source plugins, and catalog all third-party integrations.
From there, we design the Astro architecture: content collection schemas, layout hierarchy, integration selections, and deployment target.
Phase 2: Content Migration (Week 2)
We build automated migration scripts that transform your content from Gatsby's structure to Astro content collections. Frontmatter schemas get validated and normalized. MDX components get mapped to their Astro equivalents or wrapped as framework islands.
Gatsby's gatsby-image usage gets converted to Astro's built-in <Image /> component, which handles responsive images, format conversion, and lazy loading natively—no plugin chain required.
Phase 3: Template and Component Conversion (Weeks 2-3)
Gatsby page templates become Astro layouts and pages. React components that don't need client-side interactivity become Astro components—simpler, faster, zero JS. Interactive components stay as React (or get rewritten) and use client: directives for partial hydration.
We replace Gatsby plugins with Astro integrations:
gatsby-plugin-sitemap→@astrojs/sitemapgatsby-plugin-feed→ Custom RSS with@astrojs/rssgatsby-plugin-mdx→ Built-in MDX support via@astrojs/mdxgatsby-plugin-sharp→ Built-inastro:assetsimage optimization
Phase 4: SEO Preservation (Week 3)
This is where migrations live or die. We implement a thorough URL preservation strategy:
- 301 redirects for any URL structure changes, configured at the hosting level for zero-latency redirects
- Canonical tags on every page matching your existing URL structure
- Structured data (JSON-LD) migrated and validated against Google's Rich Results Test
- Meta tags preserved exactly—title tags, descriptions, Open Graph, Twitter Cards
- XML sitemap regenerated and submitted to Google Search Console
- Internal link audit to catch any broken references post-migration
We monitor Google Search Console for 30 days post-launch to catch indexing issues immediately.
Phase 5: Testing and Launch (Week 4)
Full visual regression testing against your existing Gatsby site. Performance benchmarks compared side-by-side. Accessibility audit. Cross-browser testing. We deploy to a staging URL for your team to review, then cut over with zero downtime.
If your Gatsby site was using a service worker (common with gatsby-plugin-offline), we deploy a replacement service worker that forces cache invalidation on existing visitors' browsers—a step most migration guides skip entirely.
Timeline and Pricing
A typical Gatsby to Astro migration for a content site with 50-200 pages runs 3-4 weeks and starts at $8,000. Larger sites with custom source plugins, complex dynamic routing, or heavy CMS integration may need 5-6 weeks.
Scope factors include: number of unique page templates, custom Gatsby plugins, third-party API integrations, and whether you want to keep React components or convert everything to native Astro.
The Bottom Line
Gatsby isn't dead, but it's not getting better. Astro's actively developed, has a thriving community, and was designed from the ground up for content-heavy websites. The migration path is well-documented, the performance gains are immediate, and your dev team will thank you for eliminating the GraphQL boilerplate.
Stop maintaining a framework that's standing still. Move to the one that's moving fast.
The migration process
Discovery & Audit
We map every page, post, media file, redirect, and plugin. Nothing gets missed.
Architecture Plan
New stack designed for your content structure, SEO requirements, and performance targets.
Staged Migration
Content migrated in batches. Each batch verified before the next begins.
SEO Preservation
301 redirects, canonical tags, sitemap, robots.txt — every ranking signal carried over.
Launch & Monitor
DNS cutover with zero downtime. 30-day monitoring period included.
Gatsby vs Astro
| Metric | Gatsby | Astro |
|---|---|---|
| Lighthouse Mobile | 45-65 | 95-100 |
| TTFB | 1.2-2.5s | <0.2s |
| Build Time (500 pages) | 8-15 min | 15-30s |
| Client JS Bundle | 200-400 KB | 0 KB (default) |
| Hosting Cost | $20-50/mo | $0-20/mo |
| Content Querying | GraphQL (complex) | Content Collections (simple) |
Common questions
How long does a Gatsby to Astro migration take?
Most content sites with 50-200 pages migrate in 3-4 weeks. That covers content migration, template conversion, SEO preservation, and thorough testing. Larger sites with custom Gatsby plugins or complex dynamic routing may need 5-6 weeks. We give you a detailed timeline after auditing your specific Gatsby setup.
Will I lose my Google rankings during the migration?
Not if it's done properly. We implement 301 redirects for every URL, preserve all meta tags and structured data, maintain your XML sitemap, and monitor Search Console for 30 days post-launch. Our SEO preservation process is designed specifically to protect your existing rankings and organic traffic through the transition.
Can I keep my React components when migrating to Astro?
Yes. Astro supports React components natively through its Islands architecture. Interactive React components can be hydrated client-side using Astro's client directives. Static React components render at build time with zero JavaScript shipped. You can also gradually convert React components to native Astro components over time—there's no pressure to do it all at once.
How much faster is Astro compared to Gatsby?
Build times typically drop by 80-90%. A Gatsby site that takes 10 minutes to build often finishes in under 60 seconds with Astro. Page load performance improves dramatically too—Astro ships zero JavaScript by default, so Lighthouse mobile scores jump from the 45-65 range to 95-100 without any optimization tricks.
What replaces Gatsby's GraphQL data layer in Astro?
Astro's content collections replace GraphQL for local content. You define a TypeScript schema, place files in a content directory, and query with getCollection() or getEntry(). For external data sources, Astro uses standard fetch calls at build time. It's dramatically simpler—no query fragments, no schema stitching, no GraphiQL debugging sessions.
What happens to gatsby-image and image optimization?
Astro has built-in image optimization through the astro:assets module and the Image component. It handles responsive sizes, lazy loading, and automatic format conversion to WebP and AVIF natively. No plugin chain required. We convert all gatsby-image usage to Astro's Image component during migration, with equivalent or better output quality.
Is Astro a good choice if my Gatsby site uses a headless CMS?
Absolutely. Astro integrates cleanly with every major headless CMS—Contentful, Sanity, Storyblok, Strapi, and others—using standard API calls or official integrations. Unlike Gatsby's source plugins and GraphQL layer, Astro fetches CMS data directly at build time, which is simpler to debug and maintain.
What are the disadvantages of using Gatsby?
Gatsby can be challenging due to its complex build times for larger sites, which can slow down the development process. It heavily relies on GraphQL, which may have a steep learning curve for developers unfamiliar with it. Gatsby's plugin ecosystem, while extensive, can sometimes lead to dependency issues or compatibility challenges. Additionally, because it is a static site generator, dynamic content requires additional configurations, which can add complexity and might not be ideal for sites needing frequent updates.
Why use Gatsby over React?
Gatsby is often preferred over React for building static websites due to its powerful static site generation capabilities. It comes with a rich ecosystem of plugins that simplify tasks like sourcing data and optimizing images, which can significantly speed up development time. Gatsby's default setup also includes performance optimizations like code splitting and lazy loading, which can be manually intensive in a pure React setup. Additionally, Gatsby's GraphQL integration allows for flexible data querying, making it a strong choice for content-heavy sites.
Ready to migrate?
Free assessment. We'll audit your current site and give you a clear migration plan — no commitment.
Let's build
something together.
Whether it's a migration, a new build, or an SEO challenge — the Social Animal team would love to hear from you.