Modularize `gatsby-node.js` to Improve Maintainability and Build Velocity
@Manishnemade12 is already working on this.
Since Apr 11, 2026.
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 1.6k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 18
Description
Description
The gatsby-node.js file is currently a monolithic runtime file spanning over 1,200 lines. It handles Node creation, GraphQL querying, and the generation of virtually every dynamic page on the Layer5 site sequentially (blogposts, resources, careers, member profiles, kanvas labs, programs, integrations, and sistent components). This monolithic structure creates a very high likelihood of merge conflicts for concurrent PRs targeting dynamic page logic. It also yields poor maintainability as the site scales, mixing logic for drastically different collections in a single massive createPages export.
Expected Behavior
gatsby-node.js should be refactored by orchestrating its logic into a new src/node-api/ directory (or similar utility structure) utilizing functional composition. The API should extract createPages logic related to the blog, category, and tags into a dedicated createBlogPages.js module, and similarly for Kanvas labs and Sistent components. The main node file should then cleanly require these smaller handler functions and pass the graphql and createPage actions via dependency injection. This vast minimization of merge conflicts improves CI/CD integrity and Developer Velocity.
Screenshots
Environment:
- Host OS:
- Browser:
Contributor Resources and Handbook
The layer5.io website uses Gatsby, React, and GitHub Pages. Site content is found under the master branch.
- 📚 See contributing instructions.
- 🎨 Wireframes and designs for Layer5 site in Figma (open invite)
- 🙋🏾🙋🏼 Questions: Discussion Forum and Community Slack.
Join the Layer5 Community by submitting your community member form.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.