Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

Build

Learn what build means and how to set up a build process for your Gatsby project.

What is a build?

Build refers to the process of compiling your site. During a build, or at build time, your project gets transformed from component files to optimized HTML, CSS, and JavaScript files that you can deploy to your hosting provider.

There are a few ways to create a build. You can build your site locally on your computer using the Gatsby CLI, and then deploy changes to your host. If you use Gatsby Cloud, you can take advantage of Gatsby Builds, a feature available with every Gatsby Cloud account. You can also use a continuous deployment service such as AWS Amplify or Netlify.

For larger teams or larger projects, you may want to use a continuous deployment approach to create builds. Each CD/CI service works slightly differently. Almost all of them, however, use the contents of a Git repository to build your site.

Gatsby Cloud, for example, integrates with GitHub, and a number of hosted content management systems. Gatsby Cloud creates a new build after every commit or content change, although you can also trigger a build manually.

Using Gatsby CLI

For smaller teams and projects, use gatsby build. The gatsby build command is part of the Gatsby command line interface (or CLI). You’ll need to install the CLI interface to create a site with Gatsby. Install it globally using npm.

Installing gatsby-cli globally makes Gatsby commands available system-wide. You’ll use gatsby new to create a new site, and gatsby develop to start a development server on your local machine.

When you’re ready to publish your project, run the gatsby build command to create a production-ready version of your site. Once built, you can use an SFTP client, the rsync utility, or similar tool to transfer these files to your host.

Learn more about builds

Edit this page on GitHub
© 2024 Gatsby, Inc.