Building and Deploying the Project

Learn how to generate production builds of our project, ready for deployment.

Building the project

Now that we’re done with the local development of our project, it’s time to build it. Building Gatsby projects is as easy as running one line of command: gatsby build. This generates production-ready folders and files that can be hosted on our favorite hosting provider to make our site accessible to the public.

These build folders can also be served and tested locally to make sure things work well as expected when the site is deployed. For this, we run gatsby build first to build the site, and then gatsby serve to serve this build. While developing on a local machine, we can now test this build on localhost:9000.

Note: We have already looked at the gatsby build and gatsby serve commands in The Gatsby CLI lesson. We can reference it for command options.

Get hands-on with 1400+ tech skills courses.