Chapter 14. Gatsby Internals

Throughout this book, we’ve taken a tour through the compelling set of features available to developers building Gatsby sites. And in the previous chapter, we explored advanced topics in Gatsby for expert-level use cases that go well beyond its out-of-the-box capabilities. But what about those who are interested in contributing to Gatsby, extending it, or learning about its inner workings?

In this chapter, we’ll take a look at some of the nuts and bolts of how Gatsby functions. This will help you gain a deeper understanding of the framework, and become a better debugger when things go awry. Having a decent grasp of the internals can be helpful not only for developing your own contributions to Gatsby, but also to have an idiomatic sense of what is happening when APIs or plugins are invoked, during each stage of the Gatsby build lifecycle, and when Gatsby performs bundling to generate a high-performing static site ready for the browser.


At the time this chapter was written, Gatsby 3.0 had only recently been released. For this reason, it covers only Gatsby 2.0, is based on the Gatsby documentation’s guide to Gatsby 2.0 internals, and is not up to date for Gatsby 3.0, which was released in March 2021. For a high-level overview of the Gatsby build process with examples taken from the Gatsby CLI’s terminal output during a typical build, consult the Gatsby documentation’s overview of the Gatsby build process.

APIs and Plugins in Gatsby

When you invoke ...

Get Gatsby: The Definitive Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.