{"id":16225474,"url":"https://github.com/mikebild/gatsby-source-modular-graphql","last_synced_at":"2026-02-26T18:02:32.656Z","repository":{"id":44843904,"uuid":"172758066","full_name":"MikeBild/gatsby-source-modular-graphql","owner":"MikeBild","description":"Gatsby source plugin which adds modularized third-party GraphQL schemas","archived":false,"fork":false,"pushed_at":"2022-12-03T01:02:16.000Z","size":147,"stargazers_count":4,"open_issues_count":6,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-17T19:49:54.726Z","etag":null,"topics":["apollo","client","gatsby","gatsby-plugin","gatsby-source","graphql","stitching"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MikeBild.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-26T17:30:24.000Z","updated_at":"2021-02-25T07:20:58.000Z","dependencies_parsed_at":"2023-01-23T08:46:18.982Z","dependency_job_id":null,"html_url":"https://github.com/MikeBild/gatsby-source-modular-graphql","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeBild%2Fgatsby-source-modular-graphql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeBild%2Fgatsby-source-modular-graphql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeBild%2Fgatsby-source-modular-graphql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeBild%2Fgatsby-source-modular-graphql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MikeBild","download_url":"https://codeload.github.com/MikeBild/gatsby-source-modular-graphql/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeBild%2Fgatsby-source-modular-graphql/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259184739,"owners_count":22818267,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apollo","client","gatsby","gatsby-plugin","gatsby-source","graphql","stitching"],"created_at":"2024-10-10T12:45:10.021Z","updated_at":"2026-02-26T18:02:32.596Z","avatar_url":"https://github.com/MikeBild.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gatsby Modular GraphQL Source Plugin\n\n\u003e Gatsby source plugin which adds modularized third-party GraphQL schemas to Gatsby GraphQL with Apollo-Client side execution support.\n\n## Conceptual thoughts\n\n- Unified and frontend-driven way to define schemas, resolvers, context and data queries/mutations\n- Adds local and remote third-party GraphQL schemas to the client-side and Gatsby GraphQL data sources\n- Modularize and combine multiple local and remote GraphQL-Schemas into [One-Graph](https://principledgraphql.com/integrity#1-one-graph)\n\n**Read more:**\n\n- [Principled GraphQL](https://principledgraphql.com/integrity#1-one-graph)\n- [Generating a schema](https://www.apollographql.com/docs/graphql-tools/generate-schema.html)\n- [Resolvers](https://www.apollographql.com/docs/graphql-tools/resolvers.html)\n- [Remote Schemas](https://www.apollographql.com/docs/graphql-tools/remote-schemas.html)\n- [Schema stitching](https://www.apollographql.com/docs/graphql-tools/schema-stitching.html)\n\n## Setup\n\n`npm install gatsby-source-modular-graphql --save-dev`\n`yarn add gatsby-source-modular-graphql --dev`\n\n## How to use?\n\n**`gatsby-config.js`**\n\n```javascript\n{\n  resolve: 'gatsby-source-modular-graphql',\n  options: {\n    path: './graphql',\n    schemaModules:\n      process.env.NODE_ENV === 'remote'\n        ? ['my-remote-schema']\n        : ['my-local-schema'],\n  },\n}\n```\n\n## How to add a local schema?\n\n**`./graphql/my-local-schema`**\n\n```javascript\nmodule.exports = {\n  typeDefs: `\n  type Query {\n    todos: [Todo]\n  }\n\n  type Todo {\n    id: ID!\n    description: String\n    done: Boolean\n  }\n  `,\n  resolvers: {\n    Query: {\n      todos: (parent, args, { todos: { todosAll } }) =\u003e {\n        return todosAll();\n      },\n    },\n  },\n  context: {\n    todos: {\n      todosAll: () =\u003e [\n        { id: 1, description: 'A', done: false, modifiedAt: Date.now() },\n        { id: 2, description: 'B', done: false, modifiedAt: Date.now() },\n      ],\n    },\n  },\n};\n```\n\n## How to add a remote schema?\n\n**`./graphql/my-remote-schema`**\n\n```javascript\nmodule.exports = {\n  uri: 'https://example.com/graphql',\n  headers: {\n    authorization: 'secret',\n  },\n  typeDefs: `\n  type Query {\n    todos: [Todo]\n  }\n\n  type Todo {\n    id: ID!\n    description: String\n    done: Boolean\n  }\n  `,\n};\n```\n\n## How to use in my Gatsby-Pages and React-Components?\n\n- Statically using [StaticQuery](https://www.gatsbyjs.org/docs/static-query/)\n- Dynamically using [Apollo-React Query](https://www.apollographql.com/docs/react/essentials/queries.html#basic) and [Apollo-React Muation](https://www.apollographql.com/docs/react/essentials/mutations.html#basic)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikebild%2Fgatsby-source-modular-graphql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikebild%2Fgatsby-source-modular-graphql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikebild%2Fgatsby-source-modular-graphql/lists"}