{"id":23745163,"url":"https://github.com/tchoupinax/graphql-friendly","last_synced_at":"2026-03-07T16:30:22.788Z","repository":{"id":37707856,"uuid":"312338209","full_name":"Tchoupinax/graphql-friendly","owner":"Tchoupinax","description":"An easy and friendly graphql client, alternative to apollo-client","archived":false,"fork":false,"pushed_at":"2023-12-21T10:39:28.000Z","size":702,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-31T20:41:41.471Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/Tchoupinax.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-11-12T16:46:58.000Z","updated_at":"2023-12-21T08:59:45.000Z","dependencies_parsed_at":"2022-08-31T22:11:59.363Z","dependency_job_id":null,"html_url":"https://github.com/Tchoupinax/graphql-friendly","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tchoupinax%2Fgraphql-friendly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tchoupinax%2Fgraphql-friendly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tchoupinax%2Fgraphql-friendly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tchoupinax%2Fgraphql-friendly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tchoupinax","download_url":"https://codeload.github.com/Tchoupinax/graphql-friendly/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239898457,"owners_count":19715212,"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":"2024-12-31T12:54:52.537Z","updated_at":"2026-03-07T16:30:22.728Z","avatar_url":"https://github.com/Tchoupinax.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# graphql-friendly\n\n**graphql-friendly** is an easy and friendly alternative to `apollo-client`.\n\n## Motivations\n\nI have never found another graph client that `apollo-client`. Graphql queries can be performed with standard http client (like [axios](https://github.com/axios/axios)) but these client does not support graphql `subscriptions`. `apollo-client` was the only one however it is not quiet simple as i would like.\n\nMorever, `apollo-client` has been originally made for `react` and I love `vue`. There is a good [plugin](https://apollo.vuejs.org/guide/) for `vue`. I remember that configure apollo for Nuxt.js was such a pain and I had a lot of issue about the cache. I searched all Github to find a solution and i lost a lot of time. Now i have others projects with `vue` and graphql and I need a more simple tool for that.\n\n## Features\n\n- :zap: Send `query` and `mutation` request to your favorite graphql API\n- :tada: Supports `subscription` request \n- :rainbow: Supports [variables](https://graphql.org/learn/queries/#variables) with your queries\n- :octopus: Accept graphql query as string or as object (parsed with `graphl-tag`)\n- :cyclone: Vue 3 plugin\n  \n## Get started\n\n```\nnpm install graphql-friendly\n```\n\n### Node.js \u0026\u0026 Browser\n\nTo declare your client, your just need the following line\n\n```js\nimport { GraphqlClient } from 'graphql-friendly';\n\nconst myGraphqlClient = new GraphqlClient('http://localhost:10000/v1/graphql');\n```\n\nThen, you just have to call the method you want :\n\n#### query\n\n```js\nimport gql from 'graphql-tag';\n\nconst createUser = gql`\n  mutation createUser($email: String!) {\n    insert_users(objects: {\n      email: $email,\n      nickname: \"fefe\",\n      password: \"zefe\"\n    }) {\n      returning {\n        id\n      }\n    }\n  }\n`;\n\nconst answer = await myGraphqlClient.query({\n  query: CreateUser,\n  variables: { email: 'toto2@toto.com' },\n});\n\nconsole.log(answer) // { insert_users: { ... }}\n```\n\n#### mutation\n\nFor the moment, `.mutation` is exactly the same as `.query`.\n\n#### subscription\n\nGraphql allows you to make subscription. To do this, you juste have to call the `subscribe` method and subscribe the answer\n\n```js\nconst myObserver = myGraphqlClient.subscribe({ query: 'subscription { users { id } }' })\n\nfor await (const event of myObserver) {\n  console.log(event);\n\n  break; // If you want to cut the subscription\n}\n```\n\n### With Vue 3\n\n```js\nimport { createApp } from 'vue';\nimport GraphqlFriendly from 'graphql-friendly';\n\nconst app = createApp(App);\n\napp.use(GraphqlFriendly, {\n  url: 'http://localhost:10000/v1/graphql',\n});\n```\n\nAfter installing the plugin, the client is accessible in your components as `this.$graphqlClient`.\n\n## Documentation\n\n### `query({ query, variables })`\n\n- `query`: string | object - The query can be a graphql string or parsed query with [graphql-tag](https://github.com/apollographql/graphql-tag).\n- `variables`: object - Variables provided to your query\n\n`returns` the graphql answer\n\n### `mutation({ query, variables })`\n\n- `query`: string | object - The query can be a graphql string or parsed query with [graphql-tag](https://github.com/apollographql/graphql-tag).\n- `variables`: object - Variables provided to your query\n\n`returns` the graphql answer\n\n### `subscribe({ query, variables })`\n\n- `query`: string | object - The query can be a graphql string or parsed query with [graphql-tag](https://github.com/apollographql/graphql-tag).\n- `variables`: object - Variables provided to your query\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftchoupinax%2Fgraphql-friendly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftchoupinax%2Fgraphql-friendly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftchoupinax%2Fgraphql-friendly/lists"}