Egg.js plugin for integrating GraphQL using Apollo GraphQL Tools and GraphQL Server. Version 2.8.0 supports Egg.js applications with Node >=8.0.0. Provides automatic schema loading from app/graphql directory, integrated DataLoader, custom directives, and GraphiQL development tool. Enables GraphQL-first development by separating schema, resolvers, connectors, and models. Compared to manual GraphQL setup, this plugin offers seamless Egg.js integration with configuration-driven routing, middleware support, and Apollo Server options passthrough. Active maintenance by the Egg.js team.
npm install egg-graphqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows minimal setup: install plugin, configure plugin and middleware, create schema and resolver, then query via browser.
Add graphql entry to config/plugin.js with enable: true and package: 'egg-graphql'.
Add 'graphql' to exports.middleware in config.default.js.
Ensure file is named schema.graphql and located under app/graphql/<model>/.
Use module.exports = { Query: { ... } } in resolver.js.Ensure schema.graphql files exist under app/graphql/<model>/ and directories are lowercase.
Add 'graphql' to exports.middleware in config.default.js and verify graphql config has router path.
Export an object with top-level Query/Mutation keys: module.exports = { Query: { ... } }.