{"id":27655174,"url":"https://github.com/orbitdb/orbit-db-cli","last_synced_at":"2025-04-24T06:01:47.241Z","repository":{"id":40747944,"uuid":"100950688","full_name":"orbitdb-archive/orbit-db-cli","owner":"orbitdb-archive","description":"CLI for orbit-db","archived":true,"fork":false,"pushed_at":"2023-07-27T15:45:06.000Z","size":1565,"stargazers_count":61,"open_issues_count":23,"forks_count":15,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-04-15T05:34:37.840Z","etag":null,"topics":["cli","database","distributed","ipfs","orbit-db","orbitdb","p2p","peer-to-peer"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/orbitdb-archive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"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}},"created_at":"2017-08-21T12:35:51.000Z","updated_at":"2024-12-19T16:44:48.000Z","dependencies_parsed_at":"2024-01-14T22:05:21.014Z","dependency_job_id":null,"html_url":"https://github.com/orbitdb-archive/orbit-db-cli","commit_stats":null,"previous_names":["orbitdb-archive/orbit-db-cli","orbitdb/orbit-db-cli"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orbitdb-archive%2Forbit-db-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orbitdb-archive%2Forbit-db-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orbitdb-archive%2Forbit-db-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orbitdb-archive%2Forbit-db-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orbitdb-archive","download_url":"https://codeload.github.com/orbitdb-archive/orbit-db-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250573330,"owners_count":21452347,"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":["cli","database","distributed","ipfs","orbit-db","orbitdb","p2p","peer-to-peer"],"created_at":"2025-04-24T06:01:03.946Z","updated_at":"2025-04-24T06:01:47.191Z","avatar_url":"https://github.com/orbitdb-archive.png","language":"JavaScript","funding_links":[],"categories":["Tools"],"sub_categories":[],"readme":"# orbitdb - CLI for orbit-db\n\n[![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/orbitdb/Lobby) [![Matrix](https://img.shields.io/badge/matrix-%23orbitdb%3Apermaweb.io-blue.svg)](https://riot.permaweb.io/#/room/#orbitdb:permaweb.io) \n[![CircleCI](https://circleci.com/gh/orbitdb/orbit-db-cli.svg?style=shield)](https://circleci.com/gh/orbitdb/orbit-db-cli)\n[![npm version](https://badge.fury.io/js/orbit-db-cli.svg)](https://www.npmjs.com/package/orbit-db-cli)\n[![node](https://img.shields.io/node/v/orbit-db-cli.svg)](https://www.npmjs.com/package/orbit-db-cli)\n\n\u003e CLI for orbit-db\n\nA CLI tool to manage [orbit-db](https://github.com/orbitdb/orbit-db) databases.\n\n\u003ca href=\"https://asciinema.org/a/JdTmmdBCZarkBkPqbueicwMrG\" target=\"_blank\"\u003e\u003cimg src=\"https://asciinema.org/a/JdTmmdBCZarkBkPqbueicwMrG.png\" width=\"50%\"/\u003e\u003c/a\u003e\n\n## Table of Contents\n\n- [Quick Start](#quick-start)\n- [Requirements](#requirements)\n- [Install](#install)\n- [Run](#run)\n\t- [Data Directories and Paths](#data-directories-and-paths)\n- [Demo](#demo)\n- [Replicate](#replicate)\n\t- [For `eventlog` or `feed` type databases](#for-eventlog-or-feed-type-databases)\n\t- [For `docstore` type databases](#for-docstore-type-databases)\n- [Dev](#dev)\n- [License](#license)\n\n## Quick Start\n\n```\n$ orbitdb create hello feed\n/orbitdb/QmfSUsdr34iGio68eMezDzZLCKZTnbsxNJgiNipimZtpi1/hello\n\n$ orbitdb add /orbitdb/QmfSUsdr34iGio68eMezDzZLCKZTnbsxNJgiNipimZtpi1/hello \"world\"\nAdded QmSwYZheHVa3eWf83XwnWNJtjGG7EWjiWTaTKLeFozVRnz\n\n$ orbitdb get /orbitdb/QmfSUsdr34iGio68eMezDzZLCKZTnbsxNJgiNipimZtpi1/hello\n\"world\"\n\n$ orbitdb del /orbitdb/QmfSUsdr34iGio68eMezDzZLCKZTnbsxNJgiNipimZtpi1/hello QmSwYZheHVa3eWf83XwnWNJtjGG7EWjiWTaTKLeFozVRnz\nDeleted QmSwYZheHVa3eWf83XwnWNJtjGG7EWjiWTaTKLeFozVRnz\n\n$ orbitdb get /orbitdb/QmfSUsdr34iGio68eMezDzZLCKZTnbsxNJgiNipimZtpi1/hello\nDatabase '/orbitdb/QmfSUsdr34iGio68eMezDzZLCKZTnbsxNJgiNipimZtpi1/hello' is empty!\n\n$ orbitdb info /orbitdb/QmfSUsdr34iGio68eMezDzZLCKZTnbsxNJgiNipimZtpi1/hello\n/orbitdb/QmfSUsdr34iGio68eMezDzZLCKZTnbsxNJgiNipimZtpi1/hello\n\u003e Type: feed\n\u003e Owner: QmfSUsdr34iGio68eMezDzZLCKZTnbsxNJgiNipimZtpi1\n\u003e Data file: ./orbitdb/QmfSUsdr34iGio68eMezDzZLCKZTnbsxNJgiNipimZtpi1/hello.orbitdb\n\u003e Entries: 0\n\u003e Oplog length: 2 / 2\n\u003e Write-access:\n\u003e 04986b1db63cdbe0798699da5054477cfda4ec32dc62563b0c77a94ec8ed8e1946c1cfad0e8c2a681ded54f66dc1614cb0dcfac5b04f1fab3d09ca368f0ff0097f\n```\n\n## Requirements\n\n* [Node.js](https://nodejs.org) \u003e= [**v10.0.0**](https://nodejs.org/en/download/current/)\n* npm\n\n## Install\nFrom npm:\n\n```\nnpm install -g orbit-db-cli\n```\n\nFrom Git:\n\n```\ngit clone https://github.com/orbitdb/orbit-db-cli.git\ncd orbit-db-cli/\nnpm install\n```\n\n## Run\n\n```\norbitdb\n```\n\n*When installed from Git, the CLI can be run with `node ./src/bin`*\n\nFor complete guide on usage, see the CLI help:\n\n```\norbitdb help\n```\n\nOutput:\n\n```\n                 _     _ _         _ _\n                | |   (_) |       | | |\n       ___  _ __| |__  _| |_    __| | |__\n      / _ \\| '__| '_ \\| | __|  / _` | '_ \\\n     | (_) | |  | |_) | | |_  | (_| | |_) |\n      \\___/|_|  |_.__/|_|\\__|  \\__,_|_.__/\n\n             Peer-to-Peer Database\n       https://github.com/orbitdb/orbit-db\n\n\nUsage: orbitdb \u003ccommand\u003e \u003cdatabase\u003e\n\nCommands:\n  add \u003cdatabase\u003e [\u003cdata\u003e]            Add an entry to an eventlog or feed\n                                     database. Can be only used on:\n                                     eventlog|feed\n  create \u003cdatabase\u003e \u003ctype\u003e           Create a new database. Type can be one of:\n                                     eventlog|feed|docstore|keyvalue|counter\n                                                                  [aliases: new]\n  del \u003cdatabase\u003e \u003ckey\u003e               Delete an entry from a database. Only valid\n                                     for data types of: docstore|keyvalue|feed\n                                                       [aliases: delete, remove]\n  demo \u003cname\u003e                        Runs a sequence of commands as an example\n                                                                 [aliases: tour]\n  drop \u003cdatabase\u003e yes                Remove a database locally. This doesn't\n                                     remove data on other nodes that have the\n                                     removed database replicated.\n                                                              [aliases: destroy]\n  get \u003cdatabase\u003e [\u003csearch\u003e]          Query the database.\n                                                        [aliases: query, search]\n  id                                 Show information about current orbit-db id\n  import \u003cfile\u003e \u003cdatabase\u003e \u003cschema\u003e  Import a CSV file to a document database\n                                                                  [aliases: csv]\n  inc \u003cdatabase\u003e [\u003cincrement\u003e]       Increase the value of a counter database.\n                                     Default increment is 1. [aliases: increase]\n  info \u003cdatabase\u003e                    Show information about a database\n                                                               [aliases: status]\n  put \u003cdatabase\u003e \u003cdocument\u003e          Add a document to a document database\n  replicate \u003cdatabase\u003e               Replicate a database with peers.\n  set \u003cdatabase\u003e \u003ckey\u003e \u003cvalue\u003e       Set a value of a key in KeyValue database\n  version                            Show information about current orbit-db\n\nOptions:\n  -h, --help  Show help                                                [boolean]\n```\n\n### Data Directories and Paths\n\nBy default, `orbit-db` creates a data directory `./orbitdb` under which metadata of databases is stored along with the actual data blocks saved in IPFS. The metadata can be found under `./orbitdb/QmFoo/database.orbitdb` for each database. The data blocks saved in IPFS are in `./orbitdb/ipfs`.\n\nTo use another `orbit-db` data directory (as opposed to the default `./orbitdb`), set `ORBITDB_PATH` environment variable to point to the desired data directory. Eg. run the CLI with `ORBITDB_PATH=/path/orbitdb orbitdb ...`\n\n To use `orbit-db` with an existing IPFS data repository, set the `IPFS_PATH` environment variable to the desired IPFS repository path. Eg. run the CLI with `IPFS_PATH=/path/to/ipfs orbitdb ...`\n\n## Demo\n\n```\nnode ./src/cli/bin demo FRANK!\n```\n\nOutput:\n\n```\n                 _     _ _         _ _\n                | |   (_) |       | | |\n       ___  _ __| |__  _| |_    __| | |__\n      / _ \\| '__| '_ \\| | __|  / _` | '_ \\\n     | (_) | |  | |_) | | |_  | (_| | |_) |\n      \\___/|_|  |_.__/|_|\\__|  \\__,_|_.__/\n\n             Peer-to-Peer Database\n       https://github.com/orbitdb/orbit-db\n\n\u003e node \"src/bin.js\" create /orbitdb/demo docstore\n/orbitdb/QmcE2HMrDTL3SFV1rcB5GaJVSJFfpFsnfTM4qK8SRScjyj/demo\n\n\u003e node \"src/bin.js\" put /orbitdb/QmcE2HMrDTL3SFV1rcB5GaJVSJFfpFsnfTM4qK8SRScjyj/demo \"{\\\"_id\\\":1,\\\"name\\\":\\\"FRANK!\\\"}\" --indexBy name\nAdded document 'FRANK!'\n\n\u003e node \"src/bin.js\" get /orbitdb/QmcE2HMrDTL3SFV1rcB5GaJVSJFfpFsnfTM4qK8SRScjyj/demo \"FRANK!\" --progress\nLoading '/orbitdb/QmcE2HMrDTL3SFV1rcB5GaJVSJFfpFsnfTM4qK8SRScjyj/demo'\n██████████████████████████████████████████ 1/1 | 100.0% | 00:00:00\nSearching for 'FRANK!' from '/orbitdb/QmcE2HMrDTL3SFV1rcB5GaJVSJFfpFsnfTM4qK8SRScjyj/demo'\n┌────────────────────────────────────────────────────────────────┬───┐\n│name                                                            │_id│\n├────────────────────────────────────────────────────────────────┼───┤\n│FRANK!                                                          │1  │\n└────────────────────────────────────────────────────────────────┴───┘\nFound 1 matches (0 ms)\n\n\u003e node \"src/bin.js\" drop /orbitdb/QmcE2HMrDTL3SFV1rcB5GaJVSJFfpFsnfTM4qK8SRScjyj/demo yes\nDropped database '/orbitdb/QmcE2HMrDTL3SFV1rcB5GaJVSJFfpFsnfTM4qK8SRScjyj/demo'\n\nDemo finished!\n```\n\n## Replicate\n\n### For `eventlog` or `feed` type databases\n\nDemo:\n\n\u003ca href=\"https://asciinema.org/a/h6JaCcm3TnlMQox9pE7kRKtoR\"\u003e\u003cimg src=\"https://asciinema.org/a/h6JaCcm3TnlMQox9pE7kRKtoR.png\" width=\"50%\"/\u003e\u003c/a\u003e\n\nRun in the terminal:\n\n```\norbitdb create a eventlog\n```\n\nCopy the address the above command output. Eg. `/orbitdb/QmQxfgdjo3EQZiqBgt4uDiJNoLNedRNCZTHCquohxScsXc/a`.\n\nIn a second terminal, run:\n\n```\nmkdir tmp/ \u0026\u0026 cd tmp/\norbitdb replicate \u003caddress\u003e --progress\n```\n\n*Eg. `orbitdb replicate /orbitdb/QmQxfgdjo3EQZiqBgt4uDiJNoLNedRNCZTHCquohxScsXc/a --progress --dashboard`*\n\nOutput:\n```\nReplicating '/orbitdb/QmQxfgdjo3EQZiqBgt4uDiJNoLNedRNCZTHCquohxScsXc/a'\n░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 0/0 |   0.0% | 00:00:00\n```\n\nIn the first terminal, run:\n```\norbitdb add \u003caddress\u003e hi! -r --sync --interval 1000\n```\n\nObserve the database replicating to the second instance.\n\nOutput:\n```\nReplicating ██████████████████████████░░░░░░░░░░░░░░ 2/3 |  66.7% | 00:00:21\n```\n\n```\nReplicating ████████████████████████████████████████ 77/77 |  100.0% | 00:02:31\n```\n### For `docstore` type databases\n\nFirst, create a database and add an item to it:\n\n```\n$ node src/bin.js create /orbitdb/mydocstore docstore                         ~\n/orbitdb/QmapaF6FmS3JgTQBKSpSZUdqgf2t8VUUvXcUCdPd5MaeQB/orbitdb/mydocstore\n$ node src/bin.js put /orbitdb/QmapaF6FmS3JgTQBKSpSZUdqgf2t8VUUvXcUCdPd5MaeQB/orbitdb/mydocstore '{\"name\": \"foo\", \"_id\": 1}' --indexBy name\nAdded document 'foo'\n```\n\nYou may now syncrhonise it with another. To do that, run `replicate` on the current directory as well as in the directory you want to synchronise with. Both should result in the same output:\n\n```\n$ node src/bin.js replicate /orbitdb/QmapaF6FmS3JgTQBKSpSZUdqgf2t8VUUvXcUCdPd5MaeQB/orbitdb/mydocstore --progress\nSwarm listening on /ip4/127.0.0.1/tcp/38795/ipfs/QmRvDCjRzBB9PjkcCRJQFBDS8V8hsfivpQGFUh85ERxQeM\nSwarm listening on /ip4/1.2.3.4/tcp/38795/ipfs/QmRvDCjRzBB9PjkcCRJQFBDS8V8hsfivpQGFUh85ERxQeM\nLoading '/orbitdb/QmapaF6FmS3JgTQBKSpSZUdqgf2t8VUUvXcUCdPd5MaeQB/orbitdb/mydocstore' (docstore)\nLoading '/orbitdb/QmapaF6FmS3JgTQBKSpSZUdqgf2t8VUUvXcUCdPd5MaeQB/orbitdb/mydocstore' ░░░ 0/1 |   0.0% | 00:00:00\n████████████████████████████████████████████████████████████████████████████████████████ 1/1 | 100.0% | 00:00:00\nReplicating '/orbitdb/QmapaF6FmS3JgTQBKSpSZUdqgf2t8VUUvXcUCdPd5MaeQB/orbitdb/mydocstore'\n████████████████████████████████████████████████████████████████████████████████████████ 1/1 | 100.0% | 00:00:00\n```\n\n## Dev\n\n*Random notes*\n\n```\nnode src/bin.js import 2017.csv /t9 src/schemas/csv-schema1.js --progress --limit 5000 --indexBy name\n```\n## Contribute\n\nWe would be happy to accept PRs! If you want to work on something, it'd be good to talk beforehand to make sure nobody else is working on it. You can reach us [on Gitter](https://gitter.im/orbitdb/Lobby), or in the [issues section](https://github.com/orbitdb/orbit-db-cli/issues).\n\nWe also have **regular community calls**, which we announce in the issues in [the @orbitdb welcome repository](https://github.com/orbitdb/welcome/issues). Join us!\n\nFor specific guidelines for contributing to this repository, check out the [Contributing guide](CONTRIBUTING.md). For more on contributing to OrbitDB in general, take a look at the [@OrbitDB welcome repository](https://github.com/orbitdb/welcome). Please note that all interactions in [@OrbitDB](https://github.com/orbitdb) fall under our [Code of Conduct](CODE_OF_CONDUCT.md).\n\n## License\n\n[MIT](LICENSE) ©️ 2017-2018 Haja Networks Oy\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forbitdb%2Forbit-db-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forbitdb%2Forbit-db-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forbitdb%2Forbit-db-cli/lists"}