Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

Adapters

Introduction

Adapters are responsible for taking the production output from Gatsby and turning it into something your deployment platform understands. They make it easier to build and deploy Gatsby sites on any deployment platform.

Gatsby has different rendering options and features like Deferred Static Generation (DSG) and Server-Side rendering (SSR) require more setup than classic static site generation (SSG). Users can also set HTTP headers or create redirects.

Gatsby passes all the required information during the build to adapters to prepare these outputs for deployment on a specific platform. Here are some of the actions an adapter automatically takes:

  • Applies HTTP headers to assets
  • Applies redirects and rewrites. The adapter can also create its own redirects or rewrites if necessary, for example to map serverless functions to internal URLs.
  • Wraps serverless functions coming from Gatsby with platform-specific code (if necessary). Gatsby will produce Express-like handlers.
  • Apply trailing slash behavior and path prefix to URLs
  • Possibly uploads assets to CDN

This feature was added in gatsby@5.12.0.

Finding adapters

You can use these official adapters:

To find additional community adapters, search npm for gatsby-adapter.

Can’t find an adapter for your platform? Consider creating an adapter yourself.

Using adapters

Use the adapter option inside gatsby-config:

If the adapter accepts custom options, you can set them like this:

Additional resources

Start building today on Netlify!
Edit this page on GitHub
© 2023 Gatsby, Inc.