{"id":15192352,"url":"https://github.com/hasura/client-side-graphql","last_synced_at":"2025-10-02T07:30:34.697Z","repository":{"id":87598120,"uuid":"142847848","full_name":"hasura/client-side-graphql","owner":"hasura","description":null,"archived":true,"fork":false,"pushed_at":"2019-02-12T10:20:23.000Z","size":340,"stargazers_count":146,"open_issues_count":3,"forks_count":13,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-01-21T12:35:58.824Z","etag":null,"topics":["graphql","graphql-client","schema-stitching"],"latest_commit_sha":null,"homepage":null,"language":null,"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/hasura.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-30T08:32:57.000Z","updated_at":"2024-10-01T11:30:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"e554329a-4e4d-4113-9ff6-e0f27018b39b","html_url":"https://github.com/hasura/client-side-graphql","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"8608faf48bfe89b0bc8b6ab5dcc0e6e8142fc64c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hasura/client-side-graphql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasura%2Fclient-side-graphql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasura%2Fclient-side-graphql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasura%2Fclient-side-graphql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasura%2Fclient-side-graphql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hasura","download_url":"https://codeload.github.com/hasura/client-side-graphql/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasura%2Fclient-side-graphql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277974403,"owners_count":25908396,"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","status":"online","status_checked_at":"2025-10-02T02:00:08.890Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["graphql","graphql-client","schema-stitching"],"created_at":"2024-09-27T21:21:56.985Z","updated_at":"2025-10-02T07:30:34.368Z","avatar_url":"https://github.com/hasura.png","language":null,"funding_links":[],"categories":["Others"],"sub_categories":[],"readme":"# GraphQL without a server\n\n## TL;DR\n\n- You do not need a GraphQL server to use the GraphQL APIs on the client. ([Example](https://github.com/hasura/client-side-graphql/tree/master/examples/graphql-wrapper-rest))\n- You do not need a separate GraphQL server to stitch the schemas of two existing GraphQL APIs. ([Example](https://github.com/hasura/client-side-graphql/tree/master/examples/schema-stitching))\n\n## Introduction\n\nGraphQL is essentially a syntax that describes how to ask for data. A GraphQL API is something that accepts queries in GraphQL syntax and resolves them to whatever is asked by a query. Traditionally, this are written on a server and exposed on a single endpoint. However, since the growth of [Apollo Client](https://www.apollographql.com/client/), and the tools around it, this GraphQL wrapper can be written on the client as well.\n\n## Analogy\n\n![traditional](https://raw.githubusercontent.com/hasura/client-side-graphql/master/assets/server.png)\n\n![no-server](https://raw.githubusercontent.com/hasura/client-side-graphql/master/assets/no-server.png)\n\n## Examples\n\n### Simple GraphQL schema\n\nThis example makes a simple hello-world GraphQL schema.\n\n```js\nimport { makeExecutableSchema } from 'graphql-tools';\nimport { SchemaLink } from 'apollo-link-schema';\nimport { InMemoryCache } from 'apollo-cache-inmemory';\nimport ApolloClient from 'apollo-client';\n\nconst typeDefs = `\n  type Hello {\n    message: String\n  }\n`;\n\nconst resolvers = {\n  Query: {\n    message: (root, args, context, info) =\u003e \"hello-world\"\n  }\n};\n\nconst schema = makeExecutableSchema({\n  typeDefs,\n  resolvers\n});\n\nconst client = new ApolloClient({\n  link: new SchemaLink({ schema }),\n  cache: new InMemoryCache()\n})\n\n// You can use this client in your app and it will work like any other GraphQL server\n\n```\n\nCheck out [this example](https://github.com/hasura/client-side-graphql/tree/master/examples/graphql-wrapper-rest) where we have written a GraphQL wrapper over the [Meta weather REST API](https://www.metaweather.com/).\n\n### Schema Stitching\n\nThis is an example of stitching two remote GraphQL schemas.\n\n```js\nimport { makeRemoteExecutableSchema, introspectSchema, mergeSchemas } from 'graphql-tools';\nimport { SchemaLink } from 'apollo-link-schema';\nimport ApolloClient from 'apollo-client';\n\nconst uri1 = 'https://server1.com/graphql';\nconst uri2 = 'https://server2.com/graphql';\n\nconst getRemoteExecutableSchema = async (uri) =\u003e {\n  const httpLink = new HttpLink({ uri });\n  const remoteSchema = await introspectSchema(httpLink);\n  return makeRemoteExecutableSchema({ schema: remoteSchema, link: httpLink });\n}\n\nconst executableSchema1 = await getRemoteExecutableSchema(uri1);\nconst executableSchema2 = await getRemoteExecutableSchema(uri2);\n\nconst newSchema = mergeSchemas({\n  schemas: [\n    executableSchema1,\n    executableSchema2\n  ]\n});\n\nconst client = new ApolloClient({\n  link: new SchemaLink({ schema: newSchema }),\n  cache: new InMemoryCache()\n});\n\n// You can use this client in your app and it will work like any other GraphQL server\n```\n\nYou can also have custom resolvers if you want to link your schemas in some way. You just have to add them to the resolvers field in the `mergeSchemas` function.\n\n```js\n\nconst resolvers = {\n  Query: {\n    ...\n  },\n  Mutation: {\n    ...\n  }\n}\n\nconst newSchema = mergeSchemas({\n  schemas: [\n    executableSchema1,\n    executableSchema2\n  ],\n  resolvers: resolvers\n});\n```\n\nCheck out [this example](https://github.com/hasura/client-side-graphql/tree/master/examples/schema-stitching) where we stitch a remote GraphQL schema with a local GraphQL schema.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhasura%2Fclient-side-graphql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhasura%2Fclient-side-graphql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhasura%2Fclient-side-graphql/lists"}