{"id":17750640,"url":"https://github.com/steelbrain/apollo-link-firestore","last_synced_at":"2025-07-05T09:35:06.012Z","repository":{"id":39847827,"uuid":"344061906","full_name":"steelbrain/apollo-link-firestore","owner":"steelbrain","description":"Query Google Firebase Firestore with GraphQL in Apollo","archived":false,"fork":false,"pushed_at":"2022-05-25T00:18:02.000Z","size":153,"stargazers_count":5,"open_issues_count":5,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T06:47:03.557Z","etag":null,"topics":["apollo","firebase","firestore","gql","graphql"],"latest_commit_sha":null,"homepage":"","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/steelbrain.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-03T08:55:50.000Z","updated_at":"2023-05-06T22:09:00.000Z","dependencies_parsed_at":"2022-09-05T09:41:14.193Z","dependency_job_id":null,"html_url":"https://github.com/steelbrain/apollo-link-firestore","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steelbrain%2Fapollo-link-firestore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steelbrain%2Fapollo-link-firestore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steelbrain%2Fapollo-link-firestore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steelbrain%2Fapollo-link-firestore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steelbrain","download_url":"https://codeload.github.com/steelbrain/apollo-link-firestore/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246334428,"owners_count":20760644,"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","firebase","firestore","gql","graphql"],"created_at":"2024-10-26T12:23:02.917Z","updated_at":"2025-04-01T16:31:00.064Z","avatar_url":"https://github.com/steelbrain.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Apollo Link Firestore\n\nQuery Google Firebase Firestore with GraphQL in Apollo. Allows doing joins in Firebase via GQL syntax.\n\n#### Installation\n\n```\nyarn add @apollo/client @steelbrain/apollo-link-firestore\n# or\nnpm install @apollo/client @steelbrain/apollo-link-firestore\n```\n\nTo use this Apollo Link adapter, modify your Apollo client creation like so\n\n```js\nimport { ApolloClient, InMemoryCache, from } from '@apollo/client'\nimport createFirestoreLink from '@steelbrain/apollo-link-firestore'\n\nconst client = new ApolloClient({\n  link: from([\n    createFirestoreLink({\n      firestore: firebase.firestore(),\n    }),\n  ]),\n  cache: new InMemoryCache(),\n})\n```\n\n#### Usage\n\nTo activate Firestore link on a GraphQL node, simply add the @firestore directive with the relevant arguments.\nThis package supports both `Query` and `Subscription` in GQL.\n\nHere is an example query that showcases the API\n\n```js\nconst query = gql`\n  subscription Test {\n    conversation @firestore(collection: \"conversations\", where: [[\"$id\", \"==\", \"NMI01qpXobQwd4HtKhgU\"]]) {\n      title\n    }\n    conversations2 @firestore(collection: \"conversations\", where: [[\"id\", \"\u003e\", 0]]) {\n      title\n    }\n    conversations @firestore(collection: \"conversations\") {\n      title\n      type\n      fancyMembers {\n        user: id @firestore(collection: \"users\") {\n          id\n          display_name\n          z\n        }\n      }\n      members @firestore(collection: \"users\") {\n        id\n        user: id @firestore(collection: \"users\") {\n          id\n          display_name\n        }\n        display_name\n        y\n      }\n      messages @firestore(subcollection: \"messages\", limit: 20, order: [\"id\", \"desc\"]) {\n        id\n        user: userId @firestore(collection: \"users\") {\n          id\n          display_name\n          x\n        }\n      }\n    }\n  }\n`,\n```\n\n\u003cdetails\u003e\n\n\u003csummary\u003eHere's the output of the query (outdated)\u003c/summary\u003e\n\n```json\n{\n  \"conversations2\": [],\n  \"conversations\": {\n    \"__type\": \"collection\",\n    \"NMI01qpXobQwd4HtKhgU\": {\n      \"fancyMessages\": [{\"id\": 1}, {\"id\": 2}],\n      \"members\": [1,2],\n      \"title\": \"Joe \u0026 Jane\",\n      \"type\": \"group\",\n      \"messages\": {\n        \"__type\": \"collection\",\n        \"uFBuo6CJu1knYqlzjzWl\": {\n          \"userId\": 3\n        },\n        \"3PUKrbtpEGe14cmanKVy\": {\n          \"userId\": 2\n        }\n      }\n    }\n  },\n  \"users\": {\n    \"2\": {\n      \"display_name\": \"John Doe\"\n    }\n  }\n}\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003eHere is the database state used\u003c/summary\u003e\n\n```json\n[\n  {\n    \"title\": \"Drew \u0026 Anees\",\n    \"type\": \"group\",\n    \"__typename\": \"conversations\",\n    \"members\": [\n      {\n        \"id\": \"2\",\n        \"display_name\": \"Anees B\",\n        \"y\": null,\n        \"__typename\": \"users\",\n        \"user\": {\n          \"id\": \"2\",\n          \"display_name\": \"Anees B\",\n          \"__typename\": \"users\"\n        }\n      },\n      null\n    ],\n    \"fancyMembers\": [\n      {\n        \"__typename\": null,\n        \"user\": {\n          \"id\": \"2\",\n          \"display_name\": \"Anees B\",\n          \"z\": null,\n          \"__typename\": \"users\"\n        }\n      },\n      {\n        \"__typename\": null,\n        \"user\": null\n      }\n    ],\n    \"messages\": [\n      {\n        \"id\": \"3PUKrbtpEGe14cmanKVy\",\n        \"__typename\": \"messages\",\n        \"user\": {\n          \"id\": \"2\",\n          \"display_name\": \"Anees B\",\n          \"x\": null,\n          \"__typename\": \"users\"\n        }\n      },\n      {\n        \"id\": \"uFBuo6CJu1knYqlzjzWl\",\n        \"__typename\": \"messages\",\n        \"user\": null\n      }\n    ]\n  }\n]\n```\n\u003c/details\u003e\n\n\u003c/details\u003e\n\n\n#### License\n\nThis project is licensed under the terms of MIT License. See the License file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteelbrain%2Fapollo-link-firestore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteelbrain%2Fapollo-link-firestore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteelbrain%2Fapollo-link-firestore/lists"}