Gatsby to Next.js Migration

Gatsby is in maintenance mode. I move Gatsby sites to Next.js or Astro — faster builds, an active ecosystem, and your search rankings intact.

Get a Migration Assessment →

Why Move Off Gatsby?

Stalled Development

Since the Netlify acquisition, Gatsby's core development has slowed to maintenance mode and Gatsby Cloud has shut down.

Plugin Rot

Abandoned plugins pin you to old dependencies — every update becomes riskier and security patches stop arriving.

Slow Builds

Content changes that should take seconds queue behind full rebuilds that take many minutes on larger Gatsby sites.

Shrinking Talent Pool

The ecosystem has moved to Next.js and Astro — finding developers who want to maintain Gatsby gets harder every year.

How the Migration Works

1. Audit

I map your pages, data sources, plugins and integrations, then recommend the right target — Next.js for apps, Astro for content-heavy sites.

2. Rebuild

Your React components carry over; GraphQL data layers and Gatsby plugins are replaced with modern, framework-native equivalents.

3. Preserve SEO

Every URL is kept or 301-redirected, metadata and structured data carry across, and rankings are protected through cutover.

4. Deploy

Automated deployments on Vercel, every page verified against the old site before the switch.

Deep Gatsby Experience

checkthatproperty.com.au

I rebuilt this site's entire Gatsby frontend and migrated its hosting to Netlify — so I know Gatsby's internals, data layer and plugin quirks first-hand. That's exactly what makes a migration off it safe: you can't cleanly leave a framework you don't deeply understand.

Next.js or Astro?

Both are real answers. Which one depends on what your site actually does, and picking wrong is the difference between a migration that simplifies things and one that trades one set of problems for another.

Next.js

If the site has application behaviour in it — logins, dashboards, forms that do real work, anything personalised per visitor.

  • Per-route rendering: static, server-rendered or streamed
  • Server Components cut the JavaScript sent to the browser
  • Incremental revalidation instead of a full rebuild per edit
  • Your React components mostly port straight across

Astro

If the site is mostly content — a marketing site, docs, a blog — and the priority is shipping as little JavaScript as possible.

  • Zero JavaScript by default; you opt in per component
  • Keeps your existing React components as islands
  • Content collections replace the GraphQL layer with typed frontmatter
  • Simpler mental model, which matters if you maintain it yourself

Most Gatsby sites turn out to be content sites, so Astro is a genuine option rather than a compromise. The audit is what settles it.

What actually changes in the code

Less than people expect. The components are React either way. What goes is Gatsby's build-time GraphQL layer and the plugins wrapped around it.

1. Page queries become plain data fetching

Gatsby's GraphQL is a build-time convenience, not a database. A page query is really just “read these files and sort them”, so it becomes exactly that.

Gatsby

// src/pages/blog.js
import { graphql } from "gatsby"

export const query = graphql`
  query {
    allMarkdownRemark(sort: { frontmatter: { date: DESC } }) {
      nodes {
        id
        frontmatter { title slug date }
      }
    }
  }
`

export default function Blog({ data }) {
  return <PostList posts={data.allMarkdownRemark.nodes} />
}

Next.js (App Router)

// app/blog/page.jsx
import { getAllPosts } from "@/lib/posts"

export default async function Blog() {
  const posts = await getAllPosts()   // reads the same markdown directly

  return <PostList posts={posts} />
}

PostList does not change. Neither does anything below it. Every useStaticQuery call gets the same treatment — it becomes a direct call to a CMS client, the filesystem, or an API.

2. The redirect map is the real deliverable

This is the part that decides whether rankings survive, and it is the part most migrations rush. Gatsby's default trailing slashes are the classic trap: if the old site served /blog/post/ and the new one serves /blog/post, every indexed URL is broken unless it is mapped. Every live URL gets mapped and verified before cutover, not after.

// next.config.js
module.exports = {
  trailingSlash: false,

  async redirects() {
    return [
      // Gatsby served these with a trailing slash
      { source: "/blog/:slug/", destination: "/blog/:slug", permanent: true },

      // Paths that moved during the rebuild
      { source: "/old-category/:slug", destination: "/guides/:slug", permanent: true },
    ]
  },
}

permanent: true is a 301, which is what passes ranking signals on. A 302 does not, and that single flag is the difference between keeping your traffic and starting again.

3. Images swap plugin for primitive

Gatsby's image pipeline was genuinely ahead of its time, which is why it needed a plugin, a GraphQL fragment and a component. Both target frameworks now do it natively.

// Gatsby: gatsby-plugin-image + a GraphQL fragment
<GatsbyImage image={getImage(data.hero)} alt="Workshop" />

// Next.js: next/image, no plugin, no query
<Image src={hero} alt="Workshop" sizes="100vw" priority />

4. Plugins get audited, not ported

A long gatsby-config.js looks like a lot of work to replace. Most of it is not. Sitemap, SEO metadata, sharp, manifest and filesystem sourcing are all framework features now rather than dependencies. The ones worth real attention are the source plugins talking to a CMS, and any plugin doing something genuinely bespoke — those get rewritten deliberately. The audit stage exists to separate the two before anything is quoted.

Gatsby migration questions

Why migrate off Gatsby at all?

Gatsby is in maintenance mode. Netlify acquired it in 2023 and active feature development stopped, so the plugin ecosystem it depended on has gone stale. Nothing breaks overnight, but security patches slow down, new React versions take longer to land, and the pool of developers who will touch a Gatsby codebase keeps shrinking.

Will I lose my Google rankings?

Not if the redirects are done properly, which is the main work of the migration. Every live URL is mapped to its new equivalent and served as a 301 before launch. Rankings move when URLs change without redirects, not because the framework changed.

Next.js or Astro?

Next.js if the site has application-like behaviour — logins, dashboards, anything interactive. Astro if it is mostly content and the priority is shipping the least JavaScript possible. Most Gatsby sites are content sites, so Astro is a genuine option and not a compromise.

What happens to my GraphQL queries?

They go. Gatsby's GraphQL layer is a build-time convenience specific to Gatsby, not a database, so page queries and the useStaticQuery calls get replaced with direct source calls — a CMS client, the filesystem, or an API — inside the new framework's data fetching.

How long does it take?

It depends on the number of templates rather than the number of pages — a thousand blog posts on one template is less work than fifteen bespoke landing pages. The redirect map and the data layer are the two things that drive the estimate.

Can you keep my existing design?

Yes. If the styling is already CSS Modules, Tailwind or styled-components it mostly ports across, since the components are React either way. A migration and a redesign are better done as two steps — doing both at once makes it impossible to tell which change caused a traffic shift.

Still on Gatsby?

Book a free assessment — I'll audit your site and give you a realistic migration plan: target framework, timeline and what it will cost.

Book a Free Consultation →

← See all services