{"id":16057780,"url":"https://github.com/shadowwalker/firestore-tools","last_synced_at":"2025-03-18T04:31:15.381Z","repository":{"id":38786271,"uuid":"239396970","full_name":"shadowwalker/firestore-tools","owner":"shadowwalker","description":"firestore CLI tools for data management 🛠","archived":false,"fork":false,"pushed_at":"2023-01-05T06:50:56.000Z","size":1599,"stargazers_count":6,"open_issues_count":14,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-04T17:40:44.439Z","etag":null,"topics":["firebase","firestore","gcp"],"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/shadowwalker.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-02-10T00:29:04.000Z","updated_at":"2025-03-03T18:46:36.000Z","dependencies_parsed_at":"2023-02-03T16:45:43.608Z","dependency_job_id":null,"html_url":"https://github.com/shadowwalker/firestore-tools","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/shadowwalker%2Ffirestore-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadowwalker%2Ffirestore-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadowwalker%2Ffirestore-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadowwalker%2Ffirestore-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shadowwalker","download_url":"https://codeload.github.com/shadowwalker/firestore-tools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243724772,"owners_count":20337650,"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":["firebase","firestore","gcp"],"created_at":"2024-10-09T03:04:43.546Z","updated_at":"2025-03-18T04:31:14.867Z","avatar_url":"https://github.com/shadowwalker.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [firestore](https://firebase.google.com/docs/firestore)-tools CLI\n\nA CLI for [firestore](https://firebase.google.com/docs/firestore) data management.\n\n![size](https://img.shields.io/bundlephobia/minzip/firestore-tools.svg) ![dependencies](https://img.shields.io/david/shadowwalker/firestore-tools.svg) ![downloads](https://img.shields.io/npm/dw/firestore-tools.svg) ![license](https://img.shields.io/npm/l/firestore-tools.svg)\n\n**Features**\n\n- export data from firestore into json\n- import data into firestore from json\n\n**Must Read Before Use**\n\n`firestore-tools` CLI is not suitable to use directly on production database or large datasets. It's recommended to use during concept validation, test, data mock of project development.\n\n## Getting Started\n\n## Install\n\nInstall `firestore-tools` globally\n\n```bash\nyarn global add firestore-tools\n# or\nnpm install --global firestore-tools\n```\n\nAlternatively, you can run it using `npx` without install, for example\n\n```bash\nnpx firestore-tools ...\n```\n\n## Get Firebase Service Account Private Key JSON file\n\nGo to [GCP IAM \u0026 Identity Console](https://console.cloud.google.com/iam-admin/serviceaccounts), select your firebase project on the top. Then select the `firebase adminsdk` service account, create a private key and download the JSON file. This file will be used to authenticate the CLI to access firestore database with admin access.\n\n![firebase-service-account](https://github.com/shadowwalker/firestore-tools/blob/master/res/img/service-account.png?raw=true)\n\n## Export\n\n``` bash\n# if arguments supplied from command line, you will be prompt to give that information\nfirestore-tools export\n\n# you can also supply arguments from command line\nfirestore-tools export --key project-id-36257f6a2dcc.json --json data.json -spaces 2 --collections Users,Posts\n```\n\n- export - command name, could also use alias `e`\n- key - required service account private key json file\n- json - output JSON file\n- spaces - indentation in JSON file\n- collections - comma separated top level collections to export\n\n## Import\n\n``` bash\n# if arguments supplied from command line, you will be prompt to give that information\nfirestore-tools import\n\n# you can also supply arguments from command line\nfirestore-tools import --key project-id-36257f6a2dcc.json --json data.json\n```\n\n- import - command name, could also use alias `i`\n- key - required service account private key json file\n\n## JSON\n\n`firestore-tools` use JSON data schema to map the data in firestore database, below is an example.\n\nAny key prefixed with lower dash `_` has special meaning of indicating data type and structure.\n\n``` json\n{\n  \"collection-id\": {\n    \"document-id\": {\n      \"_data\": {\n        \"geopoint\": {\n          \"_latitude\": 47.7558843,\n          \"_longitude\": 122.2646634\n        },\n        \"null\": null,\n        \"number\": 123456,\n        \"array\": [\n          \"hello\",\n          \"world\"\n        ],\n        \"reference\": {\n          \"_segments\": [\n            \"Test\",\n            \"referred\"\n          ]\n        },\n        \"map\": {\n          \"field\": \"hellofield\"\n        },\n        \"timestamp\": {\n          \"_seconds\": 1580848496,\n          \"_nanoseconds\": 0\n        },\n        \"boolean\": true,\n        \"string\": \"helloworld\"\n      },\n      \"_collections\": {\n        \"subcollection-id\": {\n          \"document-id\": {\n            \"_data\": {\n              \"text\": \"hello\"\n            },\n            \"_collections\": {}\n          }\n        }\n      }\n    }\n  }\n}\n\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshadowwalker%2Ffirestore-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshadowwalker%2Ffirestore-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshadowwalker%2Ffirestore-tools/lists"}