{"id":28714417,"url":"https://github.com/graphql-compose/graphql-compose-subscription-boilerplate","last_synced_at":"2025-08-27T22:11:39.890Z","repository":{"id":66102780,"uuid":"131313444","full_name":"graphql-compose/graphql-compose-subscription-boilerplate","owner":"graphql-compose","description":"GraphQL-compose boilerplate with subscriptions","archived":false,"fork":false,"pushed_at":"2018-04-28T10:52:19.000Z","size":50,"stargazers_count":11,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-01T07:44:25.882Z","etag":null,"topics":[],"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/graphql-compose.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-04-27T15:22:30.000Z","updated_at":"2020-12-17T23:56:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"946dc0e8-f311-49c2-a08e-576683b0036b","html_url":"https://github.com/graphql-compose/graphql-compose-subscription-boilerplate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-compose%2Fgraphql-compose-subscription-boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-compose%2Fgraphql-compose-subscription-boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-compose%2Fgraphql-compose-subscription-boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-compose%2Fgraphql-compose-subscription-boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graphql-compose","download_url":"https://codeload.github.com/graphql-compose/graphql-compose-subscription-boilerplate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-compose%2Fgraphql-compose-subscription-boilerplate/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":258151362,"owners_count":22657647,"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":[],"created_at":"2025-06-15T01:07:08.518Z","updated_at":"2025-06-15T01:07:08.970Z","avatar_url":"https://github.com/graphql-compose.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# graphql-compose-subscription-boilerplate\n\n## Includes\n\n* Babel (ES6, babel-preset-env)\n* ESLint\n* Flowtype\n* express\n* apollo-server-express\n* graphql\n* graphql-compose\n* graphql-subscriptions\n* subscriptions-transport-ws\n* nodemon\n\n## Usage\n\n```bash\ngit clone https://github.com/graphql-compose/graphql-compose-subscription-boilerplate\n\ncd graphql-compose-subscription-boilerplate\n\n# make it to your own\nrm -rf .git\n\nyarn install\n\n# start server with reloading on file changes\nyarn dev\n\n# OR start server\nyarn start\n```\n\n## How to subscribe\n\n1.  Describe your subscription like below\n\n```js\nschemaComposer.Subscription.addFields({\n  updatePost: {\n    type: 'Post',\n    resolve: payload =\u003e {\n      return payload.updatePost;\n    },\n    subscribe: () =\u003e pubsub.asyncIterator('updatePost'),\n  },\n});\n```\n\nAs you noticed, PubSub library is used that will help you.\n\n2.  In your mutation, specify the data that you want to subscribe to.\n\n```js\n...\npubsub.publish('updatePost', { updatePost: post });\n...\n```\n\nNow, when a mutation invokes, Subscription will watch and report changes in the data.\n\n3.  Customize server part like in boilerplate.\n    Pay attention, in comparison with the usual server for GraphQL, there is `SubscriptionServer` and `subscriptionsEndpoint`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphql-compose%2Fgraphql-compose-subscription-boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraphql-compose%2Fgraphql-compose-subscription-boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphql-compose%2Fgraphql-compose-subscription-boilerplate/lists"}