{"id":15654446,"url":"https://github.com/delucis/bgio-firebase","last_synced_at":"2025-04-30T23:40:59.456Z","repository":{"id":37032450,"uuid":"248109869","full_name":"delucis/bgio-firebase","owner":"delucis","description":"🔌 A Firebase Firestore connector for boardgame.io","archived":false,"fork":false,"pushed_at":"2023-11-08T18:26:19.000Z","size":4046,"stargazers_count":26,"open_issues_count":7,"forks_count":1,"subscribers_count":2,"default_branch":"latest","last_synced_at":"2025-04-09T21:23:24.027Z","etag":null,"topics":["boardgame-io","firebase","firestore"],"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/delucis.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"github":["boardgameio"],"open_collective":"boardgameio"}},"created_at":"2020-03-18T01:23:47.000Z","updated_at":"2024-07-30T23:56:21.000Z","dependencies_parsed_at":"2024-10-23T04:19:06.577Z","dependency_job_id":null,"html_url":"https://github.com/delucis/bgio-firebase","commit_stats":{"total_commits":739,"total_committers":4,"mean_commits":184.75,"dds":0.09336941813261168,"last_synced_commit":"f462468a446584dfb9fd850a6d7423b537074371"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delucis%2Fbgio-firebase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delucis%2Fbgio-firebase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delucis%2Fbgio-firebase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delucis%2Fbgio-firebase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/delucis","download_url":"https://codeload.github.com/delucis/bgio-firebase/tar.gz/refs/heads/latest","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251800996,"owners_count":21645967,"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":["boardgame-io","firebase","firestore"],"created_at":"2024-10-03T12:51:50.460Z","updated_at":"2025-04-30T23:40:59.420Z","avatar_url":"https://github.com/delucis.png","language":"TypeScript","funding_links":["https://github.com/sponsors/boardgameio","https://opencollective.com/boardgameio"],"categories":[],"sub_categories":[],"readme":"# bgio-firebase\n\n[![NPM Version](https://img.shields.io/npm/v/bgio-firebase?logo=firebase)](https://www.npmjs.com/package/bgio-firebase)\n[![Test CI Status](https://github.com/delucis/bgio-firebase/workflows/Test/badge.svg)](https://github.com/delucis/bgio-firebase/actions?query=workflow%3ATest)\n[![Coverage Status](https://coveralls.io/repos/github/delucis/bgio-firebase/badge.svg?branch=latest)](https://coveralls.io/github/delucis/bgio-firebase?branch=latest)\n\n\u003e  🔌 A Firestore database connector for [boardgame.io][bgio]\n\nThis package provides a database connector that allows you to use a Firebase Cloud Firestore instance to store boardgame.io metadata and game state.\n\n\n## Installation\n\n```sh\nnpm install --save bgio-firebase\n```\n\n\n## Usage\n\nThis example shows one way to use the database connector when running your server on most Google infrastructure. For more details on configuring Firebase on your server, [see the Firebase documentation][fbsetup].\n\n```js\nconst admin = require('firebase-admin');\nconst { Server } = require('boardgame.io/server');\nconst { Firestore } = require('bgio-firebase');\nconst { MyGame } = require('./game');\n\nconst database = new Firestore({\n  config: {\n    credential: admin.credential.applicationDefault(),\n    databaseURL: 'https://\u003cMY-PROJECT\u003e.firebaseio.com',\n  },\n});\n\nconst server = Server({\n  games: [MyGame],\n  db: database,\n});\n\nserver.run(8000);\n```\n\n\n## Options\n\nThe `Firestore` class can be configured with an options object with the following properties.\n\n### `app`\n\n- **type:** `string`\n\nIf you are using multiple Firebase apps on your server, pass in the name of the app the Firestore connector should use.\n\n### `config`\n\n- **type:** `admin.AppOptions`\n\nAn options object to pass to the Firebase Admin SDK's `initializeApp` method. This configures your connection with Firebase. [See the Firebase docs for details][appopts].\n\n### `dbPrefix`\n\n- **type:** `string`\n- **default:** `'bgio_'`\n\nPrefix for the boardgame.io collections within your Firebase project.\n\n### `ignoreUndefinedProperties`\n\n- **type:** `boolean`\n- **default:** `true`\n\nBy default, the Firestore instance’s [`settings` method][settings] is called\ninternally to avoid errors from `undefined` values in data from boardgame.io.\n`settings` can only be called once, so if you want to call it with your own\ncustom options, you can pass `false` here to disable the internal call.\n\n### `useCompositeIndexes`\n\n- **type:** `boolean`\n- **default:** `false`\n\nThis connector tries to be as efficient as possible with minimal set-up, but due to Firestore’s query limitations, it cannot combine a date range query with other queries when listing matches without a [composite index][compidx]. By default, it will fall back to less efficient server-side filtering in these cases, potentially resulting in more database reads than necessary. You may wish to enable composite indexes if you use the boardgame.io Lobby API’s `updatedAfter` or `updatedBefore` queries when listing matches. [See the Firestore docs for details on managing indexes.][idxmgmt]\n\n\n## Database structure\n\ncollection ID            | document ID | contents\n-------------------------|-------------|-------------------\n`{dbPrefix}metadata`     | `{matchID}` | match metadata\n`{dbPrefix}state`        | `{matchID}` | game state\n`{dbPrefix}initialState` | `{matchID}` | initial game state\n`{dbPrefix}log`          | `{matchID}` | game action logs\n\n\n## Contributing\n\nBug reports and pull requests are very welcome! I’m not a database expert or a Firebase expert or any kind of expert, so it’s very possible that there could be improvements to how the connector interfaces with Firebase. If you run into any problems or have questions, please [open an issue][newissue].\n\nPlease also note [the code of conduct][COC] and be kind to each other.\n\n\n## License\n\nThe code in this repository is provided under [the MIT License][license].\n\n\n[bgio]: https://boardgame.io/\n[fbsetup]: https://firebase.google.com/docs/admin/setup#node.js\n[appopts]: https://firebase.google.com/docs/reference/admin/node/admin.AppOptions\n[settings]: https://googleapis.dev/nodejs/firestore/latest/Firestore.html#settings\n[compidx]: https://firebase.google.com/docs/firestore/query-data/index-overview#composite_indexes\n[idxmgmt]: https://firebase.google.com/docs/firestore/query-data/indexing\n[newissue]: https://github.com/delucis/bgio-firebase/issues/new/choose\n[COC]: CODE_OF_CONDUCT.md\n[license]: LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdelucis%2Fbgio-firebase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdelucis%2Fbgio-firebase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdelucis%2Fbgio-firebase/lists"}