Skip to main content

Gatsby Node APIs

Gatsby gives plugins and site builders many APIs for controlling your site’s data in the GraphQL data layer.

Async plugins

If your plugin performs async operations (disk I/O, database access, calling remote APIs, etc.) you must either return a promise (explicitly using Promise API or implicitly using async/await syntax) or use the callback passed to the 3rd argument. Gatsby needs to know when plugins are finished as some APIs, to work correctly, require previous APIs to be complete first. See Debugging Async Lifecycles for more info.

If your plugin does not do async work, you can just return directly.

Usage

Implement any of these APIs by exporting them from a file named gatsby-node.js in the root of your project.

APIs

Edit this page on GitHub
Docs
Tutorials
Blog
Showcase