# Deploy Gatsby

Gatsby is detected from its dependency and `gatsby-config`, and deploys as a static site: `npm run build` fills `public/`, and the CDN serves it with [free bandwidth](/billing/pricing#static-sites). No server, no region, no cold starts.

## Build

- **Output directory:** `public` - Gatsby's fixed output.
- **Install:** follows your lockfile - see [How detection works](/platform/frameworks#how-detection-works).
- Source plugins that pull from CMSs and APIs run during the build, so their credentials must be available then - which they are: static builds run [with the environment's variables set](/platform/environment-variables#build-time-and-runtime).

## Environment variables

`GATSBY_*` values inline into the browser bundle; unprefixed variables stay build-side (`gatsby-node`, source plugins), per [environment](/platform/preview-environments) - a preview can build against a staging CMS space.

> [!WARNING]
> `GATSBY_*` values ship to every browser - CMS delivery tokens for public content are usually fine, management tokens never are.

## Rebuilding on content changes

Builds trigger on push. Content edited in a headless CMS becomes visible on the next deploy - push a commit or press **Redeploy** on the environment. See [Rollbacks and redeploys](/platform/deployments/rollbacks#redeploy).

## Related

- [Build settings](/create/build-settings): Install, build, and output configuration.
- [Environment variables](/platform/environment-variables): Build-time values per environment.
- [Custom domains](/platform/custom-domains): Your own hostname on the CDN.
