gatsby
Develop and build Gatsby websites
TLDR
Create a new site
Create a new site with a Gatsby starter
Start a live-reloading local development server
Perform a production build and generate static HTML
Start a local server which serves the production build
SYNOPSIS
gatsby [<options>] <command> [<args>]
PARAMETERS
-h, --help
Show help for the command
-v, --version
Display the Gatsby CLI version
--verbose
Enable verbose logging output
DESCRIPTION
The gatsby command is the official command-line interface for Gatsby, an open-source React-based framework for building high-performance websites and apps. It enables developers to scaffold new sites, run local development servers, build optimized static files for production, clean caches, preview builds, and manage plugins.
Gatsby sites leverage a GraphQL data layer, image optimization, and a vast plugin ecosystem, making it ideal for blogs, e-commerce, and documentation sites. The CLI automates workflows like hot-reloading during development and generating service workers for progressive web apps (PWAs).
Usage typically starts with gatsby new to create a starter site, followed by gatsby develop for local serving at http://localhost:8000. Production builds output to a public directory, deployable to any static host like Netlify or Vercel.
With over 2,500 plugins, Gatsby supports CMS integrations (e.g., WordPress, Contentful), Markdown, and headless e-commerce, powering sites for large brands.
CAVEATS
Not a native Linux command; requires Node.js (≥14) and global install via npm install -g gatsby-cli. Some subcommands like new are deprecated in Gatsby 5+; use npm init gatsby instead. Large sites may consume significant memory during builds.
COMMON SUBCOMMANDS
develop - Start dev server with hot-reload
build - Generate production static files
clean - Delete .cache and public
serve - Serve production build locally
info - Print environment info
INSTALLATION
Run npm install -g gatsby-cli after installing Node.js. Verify with gatsby --version.
HISTORY
Created by Kyle Mathews in 2015 as GatsbyJS; first CLI release alongside v0.1.0. Evolved through versions, reaching v5 in 2023 with improved performance and Nx integration for monorepos. Widely adopted in Jamstack era, powering 10,000+ sites.


