Gatsby
Overview
Gatsby is a free, open-source, React-based framework "with performance, scalability, and security built in," used to build fast websites and apps. It pulls data from many sources into a unified GraphQL data layer and renders pages with React, with a large plugin ecosystem. Read this when building or maintaining a Gatsby site, especially content sites that aggregate data from CMSes, Markdown, or APIs.
Official sources
Install / setup
npm init gatsby
Core concepts
- React + GraphQL data layer. Pages are React components that query a unified GraphQL layer aggregating data from many sources.
- Source and transformer plugins. Plugins pull data in (CMS, filesystem, APIs) and transform it (e.g. Markdown → HTML) into the GraphQL layer.
- Pages. Components in
src/pages become routes automatically; pages can also be created programmatically in gatsby-node.
- Static generation. Gatsby builds pages ahead of time for fast, secure static delivery (with additional rendering modes available).
- Configuration files.
gatsby-config, gatsby-node, gatsby-browser, and gatsby-ssr configure plugins, build-time APIs, and runtime hooks.
Best practices
- Scaffold with
npm init gatsby (optionally npm init gatsby -- -y -ts my-site-name for defaults + TypeScript) as the quick-start docs show.
- Source and transform data through plugins rather than ad-hoc fetching so it flows into the GraphQL layer consistently.
- Query data with GraphQL (page queries /
useStaticQuery) to get exactly the data a component needs.
- Note the quick start targets intermediate-to-advanced developers; beginners should start with the official tutorial first (per the docs).
Common pitfalls
- Expecting
gatsby new / create-gatsby → the current quick-start command is npm init gatsby.
- Fetching data imperatively in components instead of via the GraphQL layer → use source/transformer plugins and GraphQL queries for build-time data.
- Treating the quick start as a beginner path → it is aimed at intermediate/advanced users; use the tutorial to learn the fundamentals.
Examples
// src/pages/index.js
import * as React from "react"
export default function Home() {
return <h1>Hello, Gatsby!</h1>
}
Further reading
Related skills
- ../nextjs — React framework with broader full-stack/SSR support
- ../astro — content-focused islands framework
- ../vite — modern build tooling for SPAs
1---2name: gatsby3description: React-based static-site framework with a GraphQL data layer and plugin ecosystem; consult when building or maintaining a Gatsby site.4domain: stack5category: meta6tags: [react, ssg, graphql, plugins, static-site]7official_sources:8 - https://www.gatsbyjs.com/docs/9 - https://github.com/gatsbyjs/gatsby10verified: 2026-06-1611metadata:12 source: https://skillmd.com/skills/gabriel7silva/gatsby13---1415# Gatsby1617## Overview18Gatsby is a free, open-source, React-based framework "with performance, scalability, and security built in," used to build fast websites and apps. It pulls data from many sources into a unified GraphQL data layer and renders pages with React, with a large plugin ecosystem. Read this when building or maintaining a Gatsby site, especially content sites that aggregate data from CMSes, Markdown, or APIs.1920## Official sources21- Docs: https://www.gatsbyjs.com/docs/22- Repo: https://github.com/gatsbyjs/gatsby23- Install / quick start: https://www.gatsbyjs.com/docs/quick-start/2425## Install / setup26```bash27npm init gatsby28```2930## Core concepts31- **React + GraphQL data layer.** Pages are React components that query a unified GraphQL layer aggregating data from many sources.32- **Source and transformer plugins.** Plugins pull data in (CMS, filesystem, APIs) and transform it (e.g. Markdown → HTML) into the GraphQL layer.33- **Pages.** Components in `src/pages` become routes automatically; pages can also be created programmatically in `gatsby-node`.34- **Static generation.** Gatsby builds pages ahead of time for fast, secure static delivery (with additional rendering modes available).35- **Configuration files.** `gatsby-config`, `gatsby-node`, `gatsby-browser`, and `gatsby-ssr` configure plugins, build-time APIs, and runtime hooks.3637## Best practices38- Scaffold with **`npm init gatsby`** (optionally `npm init gatsby -- -y -ts my-site-name` for defaults + TypeScript) as the quick-start docs show.39- Source and transform data through **plugins** rather than ad-hoc fetching so it flows into the GraphQL layer consistently.40- Query data with **GraphQL** (page queries / `useStaticQuery`) to get exactly the data a component needs.41- Note the quick start targets **intermediate-to-advanced developers**; beginners should start with the official tutorial first (per the docs).4243## Common pitfalls44- Expecting `gatsby new` / `create-gatsby` → the current quick-start command is `npm init gatsby`.45- Fetching data imperatively in components instead of via the GraphQL layer → use source/transformer plugins and GraphQL queries for build-time data.46- Treating the quick start as a beginner path → it is aimed at intermediate/advanced users; use the tutorial to learn the fundamentals.4748## Examples49```jsx50// src/pages/index.js51import * as React from "react"5253export default function Home() {54 return <h1>Hello, Gatsby!</h1>55}56```5758## Further reading59- Quick start: https://www.gatsbyjs.com/docs/quick-start/60- Tutorial: https://www.gatsbyjs.com/docs/tutorial/6162## Related skills63- ../nextjs — React framework with broader full-stack/SSR support64- ../astro — content-focused islands framework65- ../vite — modern build tooling for SPAs