Quick Start

This quick start is intended for intermediate to advanced developers. For a gentler intro to Gatsby, head to our tutorial!

Use the Gatsby CLI

Install the Gatsby CLI

npm install -g gatsby-cli

The above command installs Gatsby CLI globally on your machine.

Create a new site

gatsby new gatsby-site

Change directories into site folder

cd gatsby-site

Start development server

gatsby develop

Gatsby will start a hot-reloading development environment accessible by default at http://localhost:8000.

Try editing the JavaScript pages in src/pages. Saved changes will live reload in the browser.

Create a production build

gatsby build

Gatsby will perform an optimized production build for your site, generating static HTML and per-route JavaScript code bundles.

Serve the production build locally

gatsby serve

Gatsby starts a local HTML server for testing your built site. Remember to build your site using gatsby build before using this command.

Access documentation for CLI commands

To see detailed documentation for the CLI commands, run gatsby --help in the terminal.

For specific commands, run gatsby COMMAND_NAME --help e.g. gatsby new --help.

For more information on the Gatsby CLI, visit the CLI reference section of the docs.

← previous item next item →
© 2020, Built with Gatsby, hosted on Netlify