{"id":16002711,"url":"https://github.com/danstarns/graphql-microservices-realworld-example-system","last_synced_at":"2025-08-24T00:08:08.508Z","repository":{"id":62625618,"uuid":"251679231","full_name":"danstarns/graphql-microservices-realworld-example-system","owner":"danstarns","description":"Node.js powered distributed GraphQL schema built with modules, authentication, pagination, and more.","archived":false,"fork":false,"pushed_at":"2020-08-20T08:38:48.000Z","size":2655,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-28T03:25:53.469Z","etag":null,"topics":["apollo-server","example","graphql","idio-graphql","microservice","microservices","modules","moleculer","node-js","nodejs","realworld","realworld-backend"],"latest_commit_sha":null,"homepage":"https://github.com/danstarns/idio-graphql","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/danstarns.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}},"created_at":"2020-03-31T17:26:45.000Z","updated_at":"2022-11-03T04:49:50.000Z","dependencies_parsed_at":"2022-11-04T04:48:02.805Z","dependency_job_id":null,"html_url":"https://github.com/danstarns/graphql-microservices-realworld-example-system","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/danstarns%2Fgraphql-microservices-realworld-example-system","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danstarns%2Fgraphql-microservices-realworld-example-system/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danstarns%2Fgraphql-microservices-realworld-example-system/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danstarns%2Fgraphql-microservices-realworld-example-system/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danstarns","download_url":"https://codeload.github.com/danstarns/graphql-microservices-realworld-example-system/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243878439,"owners_count":20362432,"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-server","example","graphql","idio-graphql","microservice","microservices","modules","moleculer","node-js","nodejs","realworld","realworld-backend"],"created_at":"2024-10-08T10:03:12.701Z","updated_at":"2025-03-17T19:31:27.783Z","avatar_url":"https://github.com/danstarns.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GraphQL Microservices RealWorld Example System\n\n[![CircleCI](https://circleci.com/gh/danstarns/graphql-microservices-realworld-example-system/tree/master.svg?style=svg)](https://app.circleci.com/pipelines/github/danstarns/graphql-microservices-realworld-example-system?branch=master)\n[![CircleCI](https://img.shields.io/github/license/danstarns/idio-graphql)](https://github.com/danstarns/graphql-microservices-realworld-example-system/blob/master/LICENSE)\n\n\u003e ### Node.js powered distributed GraphQL schema built with modules, authentication, pagination, and more.\n\n# About\n\nThis codebase was created to demonstrate a distributed GraphQL schema built with [**idio-graphql**](https://danstarns.github.io/idio-graphql/) including modules, authentication, pagination, and more. \n\n\u003e There is a React frontend that works with this system [here](https://github.com/dostu/react-apollo-realworld-example-app)\n\n# Contributing\n\n1. [Eslint](https://eslint.org/) =\u003e `./eslintrc`\n2. [Git Trunk](https://trunkbaseddevelopment.com/) =\u003e `PR|\u003emaster`\n3. [Tests](#testing)\n\n# Getting started\n\n\u003e Docker is the best way to start\n\n1. Setup [Environment Variables](#Environment-Variables)\n2. `docker-compose up`\n3. Start client [here](https://github.com/dostu/react-apollo-realworld-example-app)\n# Environment Variables\n\n\u003e To start, copy `./.env.example`, in each service, to `./.env`.\n\n## Gateway Service \n\n```\nNATS_URL=nats://host.docker.internal:4222\nPORT=3000\nMONGODB_URI=mongodb://host.docker.internal:27017/Conduit\nDEBUG=@Conduit-Gateway-Service:*\nSECRET=supersecret\nNODE_ENV=develop\n```\n\n## Article Service\n\n```\nNATS_URL=nats://host.docker.internal:4222\nMONGODB_URI=mongodb://host.docker.internal:27017/Conduit\nDEBUG=@Conduit-Article-Service:*\nNODE_ENV=develop\n```\n\n## Comment Service\n\n```\nNATS_URL=nats://host.docker.internal:4222\nMONGODB_URI=mongodb://host.docker.internal:27017/Conduit\nDEBUG=@Conduit-Comment-Service:*\nNODE_ENV=develop\n```\n\n# GraphQL Schema\n\nThe foundations of this schema were ported from [rails-graphql-realworld-example-app](https://github.com/dostu/rails-graphql-realworld-example-app), although changes have been made, both for simplicity \u0026 to lean on features provided by `idio-graphql` such as [Inter-Schema Execution](https://danstarns.github.io/idio-graphql/docs/inter-schema-execution).\n\n\u003e Graphs generated from [Graphql Voyager](https://github.com/APIs-guru/graphql-voyager) available @ http://localhost:3000/voyager\n\n### Query\n![GraphQL Voyager Mutation View](./assets/query.jpg)\n\n### Mutation\n![GraphQL Voyager Mutation View](./assets/mutation.jpg)\n\n### SDL\n```graphql\ndirective @Auth(input: AuthInput) on FIELD_DEFINITION\n\ninput AddCommentInput {\n  articleId: ID!\n  body: String!\n}\n\ntype AddCommentPayload {\n  comment: Comment\n  errors: [UserError!]!\n}\n\ntype Article {\n  id: ID!\n  author: User!\n  body: String!\n  comments: [Comment!]!\n  description: String!\n  favoritesCount: Int!\n  slug: String!\n  tagList: [String!]!\n  title: String!\n  viewerHasFavorited: Boolean!\n  updatedAt: DateTime!\n  createdAt: DateTime!\n}\n\ntype ArticleConnection {\n  edges: [ArticleEdge]\n  pageInfo: PageInfo!\n}\n\ntype ArticleEdge {\n  cursor: String!\n  node: Article\n}\n\ninput AuthInput {\n  required: Boolean!\n  populate: Boolean = false\n}\n\ntype Comment {\n  id: ID!\n  article: Article\n  author: User\n  body: String!\n  createdAt: DateTime!\n  updatedAt: DateTime!\n}\n\ninput CreateArticleInput {\n  title: String!\n  description: String!\n  body: String!\n  tagList: [String!]!\n}\n\ntype CreateArticlePayload {\n  article: Article\n  errors: [UserError!]!\n}\n\ninput CreateUserInput {\n  username: String!\n  email: String!\n  password: String!\n}\n\ntype CreateUserPayload {\n  errors: [UserError!]!\n  user: User\n}\n\nscalar DateTime\n\ninput DeleteArticleInput {\n  id: ID!\n}\n\ntype DeleteArticlePayload {\n  article: Article!\n}\n\ninput DeleteCommentInput {\n  id: ID!\n}\n\ntype DeleteCommentPayload {\n  comment: Comment\n}\n\ninput FavoriteArticleInput {\n  id: ID!\n}\n\ntype FavoriteArticlePayload {\n  article: Article\n}\n\ntype FollowersConnection {\n  totalCount: Int!\n  nodes: [User]\n}\n\ninput FollowUserInput {\n  id: ID!\n}\n\ntype FollowUserPayload {\n  user: User\n}\n\ntype Mutation {\n  addComment(input: AddCommentInput!): AddCommentPayload\n  deleteComment(input: DeleteCommentInput!): DeleteCommentPayload\n  createUser(input: CreateUserInput!): CreateUserPayload\n  signInUser(input: SignInUserInput!): SignInUserPayload\n  followUser(input: FollowUserInput!): FollowUserPayload\n  unfollowUser(input: UnfollowUserInput!): UnfollowUserPayload\n  updateUser(input: UpdateUserInput!): UpdateUserPayload\n  pushFavoriteArticle(article: ID!): User\n  pullFavoriteArticle(article: ID!): User\n  createArticle(input: CreateArticleInput!): CreateArticlePayload\n  deleteArticle(input: DeleteArticleInput!): DeleteArticlePayload\n  updateArticle(input: UpdateArticleInput!): UpdateArticlePayload\n  favoriteArticle(input: FavoriteArticleInput!): FavoriteArticlePayload\n  unfavoriteArticle(input: UnfavoriteArticleInput!): UnfavoriteArticlePayload\n}\n\ntype PageInfo {\n  endCursor: String\n  hasNextPage: Boolean\n}\n\ntype Query {\n  articleComments(article: ID!): [Comment]\n  user(username: String!): User\n  userById(id: ID!): User\n  articleUserFavoriteCount(article: ID!): Int\n  article(slug: String!): Article\n  articleById(id: ID!): Article\n  tags: [String!]!\n  viewer: Viewer\n  articles(first: Int = 10, after: String = \"1\", tag: String, forUser: Boolean, feed: Boolean, ids: [String]): ArticleConnection!\n}\n\ninput SignInUserInput {\n  email: String!\n  password: String!\n}\n\ntype SignInUserPayload {\n  errors: [UserError!]!\n  token: String\n  viewer: Viewer\n}\n\ninput UnfavoriteArticleInput {\n  id: ID!\n}\n\ntype UnfavoriteArticlePayload {\n  article: Article\n}\n\ninput UnfollowUserInput {\n  id: ID!\n}\n\ntype UnfollowUserPayload {\n  user: User\n}\n\ninput UpdateArticleInput {\n  id: ID!\n  title: String!\n  description: String!\n  body: String!\n  tagList: [String!]!\n}\n\ntype UpdateArticlePayload {\n  article: Article\n  errors: [UserError!]!\n}\n\ninput UpdateUserInput {\n  email: String!\n  username: String!\n  bio: String\n  image: String\n  password: String\n}\n\ntype UpdateUserPayload {\n  errors: [UserError!]!\n  user: User\n}\n\ntype User {\n  id: ID!\n  image: String\n  username: String!\n  bio: String\n  email: String!\n  followedByViewer: Boolean!\n  articles(first: Int = 10, after: String = \"1\"): ArticleConnection!\n  favoriteArticles(first: Int = 10, after: String = \"1\"): ArticleConnection!\n  followers: FollowersConnection!\n  following: FollowersConnection!\n}\n\ntype UserEdge {\n  cursor: String!\n  node: User\n}\n\ntype UserError {\n  message: String!\n  path: String\n}\n\ntype Viewer {\n  feed(first: Int, after: String): ArticleConnection!\n  user: User\n}\n```\n\n# Testing\n\n\u003e Its recommended to run all test's in Docker\n\n1. [`mocha`](https://www.npmjs.com/package/mocha)\n2. [`chai`](https://www.npmjs.com/package/chai)\n3. [`nyc`](https://www.npmjs.com/package/nyc)\n5. [`apollo-server-testing`](https://www.npmjs.com/package/apollo-server-testing)\n\nYou can run this projects test suite with `$ npm run test-docker`.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanstarns%2Fgraphql-microservices-realworld-example-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanstarns%2Fgraphql-microservices-realworld-example-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanstarns%2Fgraphql-microservices-realworld-example-system/lists"}