Skip to content

Modularize gatsby-node.js to Improve Maintainability and Build Velocity #7615

@Manishnemade12

Description

@Manishnemade12

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.

Join the Layer5 Community by submitting your community member form.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions