{"id":15192469,"url":"https://github.com/lucasconstantino/graphql-modules","last_synced_at":"2025-10-02T08:30:41.271Z","repository":{"id":68375776,"uuid":"73958551","full_name":"lucasconstantino/graphql-modules","owner":"lucasconstantino","description":":warning: [DEPRECATED] GraphQL module library for Apollo.","archived":true,"fork":false,"pushed_at":"2019-01-31T01:25:12.000Z","size":55,"stargazers_count":51,"open_issues_count":0,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-09-27T21:40:58.969Z","etag":null,"topics":["apollo","archived","deprecated","graphql","graphql-modules","graphql-schema","obsolete"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lucasconstantino.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-16T20:32:31.000Z","updated_at":"2023-01-28T19:08:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"e1262f7f-f35a-421c-a004-060bd54fe1d8","html_url":"https://github.com/lucasconstantino/graphql-modules","commit_stats":{"total_commits":34,"total_committers":5,"mean_commits":6.8,"dds":"0.11764705882352944","last_synced_commit":"9e1d432ba56720e074b37dca3846c472b19df717"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasconstantino%2Fgraphql-modules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasconstantino%2Fgraphql-modules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasconstantino%2Fgraphql-modules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasconstantino%2Fgraphql-modules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucasconstantino","download_url":"https://codeload.github.com/lucasconstantino/graphql-modules/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234957753,"owners_count":18913343,"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","archived","deprecated","graphql","graphql-modules","graphql-schema","obsolete"],"created_at":"2024-09-27T21:40:28.064Z","updated_at":"2025-10-02T08:30:40.818Z","avatar_url":"https://github.com/lucasconstantino.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DEPRECATED\n\n:warning: _This project is no longer maintained. We recommend you use [Urigo/graphql-modules](https://github.com/Urigo/graphql-modules) instead._\n\n---\n\n## GraphQL Modules\n\nA library to simplify modularization of [Apollo server](http://dev.apollodata.com/tools/graphql-server/index.html) applications.\n\n[![No Maintenance Intended](http://unmaintained.tech/badge.svg)](http://unmaintained.tech/) ![Build status](https://travis-ci.org/lucasconstantino/graphql-modules.svg?branch=master)\n\n## Installation\n\nThis package is available on [npm](https://www.npmjs.com/package/graphql-modules) as: *graphql-modules*\n\n```\nnpm install graphql-modules\n```\n\n\u003e You should consider using [yarn](https://yarnpkg.com/), though.\n\n## Basic usage\n\n```js\n// module-a.js\n// -----------\nconst moduleA = {\n  queries: `\n    helloWorld: String\n  `\n  resolvers: {\n    queries: {\n      helloWorld: () =\u003e 'Hello World!'\n    }\n  }\n}\n\nexport default moduleA\n\n// module-b.js\n// -----------\nconst moduleB = {\n  queries: `\n    helloYou(name: String): String\n  `,\n  resolvers: {\n    queries: {\n      helloYou: (root, { name }) =\u003e `Hello ${name}!`\n    }\n  }\n}\n\nexport default moduleB\n\n// schema.js\n// ---------\nimport { bundle } from 'graphql-modules'\nimport { makeExecutableSchema } from 'graphql-tools'\n\nimport moduleA from './module-a'\nimport moduleB from './module-b'\n\nconst modules = [moduleA, moduleB]\n\n\nexport default makeExecutableSchema(bundle(modules))\n```\n\n## Complex needs\n\nThis library handles complex situations such as cyclic dependencies between modules. For that to work, each module can be a factory function - besides being a module object. That allows for dependencies to be handled on runtime, making ES6 module binding work as desired. This is pretty much what is proposed by the [official Apollo docs](http://dev.apollodata.com/tools/graphql-tools/generate-schema.html#modularizing).\n\nSay you have a system with books and authors - two modules that are interdependent; books have authors and authors have books. You could end up with something like this:\n\n\n#### /books.js\n ```js\n import authors, { data as authorList } from './authors'\n\n export const data = [\n   { id: 1, title: 'JavaScript: The Good Parts', author: 1 },\n   { id: 2, title: 'End to end testing with Protractor', author: 2 }\n ]\n\n const schema = `\n   type Book {\n     id: String\n     title: String\n     author: Author\n   }\n `\n\n export const queries = `\n   books: [Book]\n   book(id: Int): Book\n `\n const books = () =\u003e data\n const book = (root, args) =\u003e data.find(book =\u003e book.id === args.id)\n\n const resolvers = {\n   queries: {\n     books,\n     book\n   },\n   Book: {\n     author: book =\u003e authorList.find(author =\u003e author.id === book.author)\n   }\n }\n\n export default () =\u003e ({\n   schema,\n   queries,\n   resolvers,\n   modules: [authors]\n })\n ```\n\n\nIn this file, we define a schema, queries, and resolvers. At the end, we export those assets in a single object - the module.\n\n\n#### /authors.js\n ```js\n import books, { data as bookList } from './books'\n\n export const data = [\n    { id: 1, name: 'Douglas Crockford' },\n    { id: 2, name: 'Walmyr Lima' }\n ]\n\n const schema = `\n    type Author {\n      id: String\n      name: String\n      books: [Book]\n    }\n `\n\n export const queries = `\n    authors: [Author]\n    author(id: Int): Author\n `\n const authors = () =\u003e data\n const author = (root, args) =\u003e data.find(author =\u003e author.id === args.id)\n\n const resolvers = {\n   queries: {\n     authors,\n     author\n   },\n   Author: {\n     books: author =\u003e bookList.filter(book =\u003e book.author === author.id)\n   }\n }\n\n export default () =\u003e ({\n   schema,\n   queries,\n   resolvers,\n   modules: [books]\n })\n ```\n\nThis file is almost copy and paste from the previous.\n\n#### /schema.js\n ```js\n import { bundle } from 'graphql-modules'\n import { makeExecutableSchema } from 'graphql-tools'\n\n import books from './books'\n\n const modules = [books]\n\n export default makeExecutableSchema(bundle(modules))\n ```\n\n\nAt this last file, we create our schema (for this example, we are using [graphql-tools](https://github.com/apollostack/graphql-tools)'s `makeExecutableSchema`).\n\n## Further steps\n\nThis project is a work in process, a proof of concept, and can be expanded as wish. I believe this should some day be integrated into the *graphql-tools* project somehow.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucasconstantino%2Fgraphql-modules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucasconstantino%2Fgraphql-modules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucasconstantino%2Fgraphql-modules/lists"}