To set up our development server, we need to install Node.js, Git, and Gatsby CLI.
If you’re using Mac, I recommend installing Node using Homebrew.
brew install node
For other operating systems, please check Node documentation for more information.
brew install git
Gatsby CLI tool lets us quickly create new Gatsby-powered sites and run commands.
To install Gatsby CLI globally.
npm install -g gatsby-cli
To check a list of commands and options, run:
gatsby --help
After installing Gatsby CLI, change into the directory where you want to store the project and run the following command.
gatsby new <PROJECT NAME> <STARTER THEME>
For example
gatsby new my-gatsby-project https://github.com/gatsbyjs/gatsby-starter-hello-world
Gatsby will use the default starter if we leave out the starter theme. Check more Gatsby Starter themes.
Then, navigate into your site’s directory and start.
cd my-gatsby-project
gatsby develop
Here is a list of useful commands.
.cache
and public
directoriesOur Gatsby project has the following folder structure.