Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

Running a Gatsby Preview Server

When editing content in a CMS, it’s great to see a preview of changes before they go live.

This can be accomplished by setting up a preview server with Gatsby, for which there are two options:

Rolling your own Preview

Roughly, you can follow these steps to enable your own preview server:

  • Run gatsby develop on a Node.js host like Heroku with the ENABLE_GATSBY_REFRESH_ENDPOINT environment variable enabled. This will configure the develop server to re-source data when it receives a POST request to /__refresh.
  • Then set up your CMS to ping this URL on the preview server whenever content is changed.

Using Gatsby Cloud Preview

For a managed Preview server without having to create infrastructure yourself, try out Gatsby Cloud. It’s free for personal projects and single-purpose sites, with paid packages for a range of project and company needs.

Edit this page on GitHub
© 2024 Gatsby, Inc.