mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-06-27 16:32:30 +00:00
Merge pull request #96 from orbitdb/docs
docs: Use new exports and locations for orbitdb.
This commit is contained in:
commit
a77ca8b92e
98
README.md
98
README.md
@ -4,30 +4,25 @@
|
|||||||
<img src="images/orbit_db_logo_color.png" width="256" />
|
<img src="images/orbit_db_logo_color.png" width="256" />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
[](https://app.element.io/#/room/#orbit-db:matrix.org) [](https://www.npmjs.com/package/orbit-db) [](https://www.npmjs.com/package/orbit-db)
|
[](https://app.element.io/#/room/#orbit-db:matrix.org) [](https://www.npmjs.com/package/@orbitdb/core) [](https://www.npmjs.com/package/@orbitdb/core)
|
||||||
|
|
||||||
OrbitDB is a **serverless, distributed, peer-to-peer database**. OrbitDB uses [IPFS](https://ipfs.tech) as its data storage and [Libp2p Pubsub](https://docs.libp2p.io/concepts/pubsub/overview/) to automatically sync databases with peers. It's an eventually consistent database that uses [Merkle-CRDTs](https://arxiv.org/abs/2004.00107) for conflict-free database writes and merges making OrbitDB an excellent choice for p2p and decentralized apps, blockchain applications and [local-first](https://www.inkandswitch.com/local-first/) web applications.
|
OrbitDB is a **serverless, distributed, peer-to-peer database**. OrbitDB uses [IPFS](https://ipfs.tech) as its data storage and [Libp2p Pubsub](https://docs.libp2p.io/concepts/pubsub/overview/) to automatically sync databases with peers. It's an eventually consistent database that uses [Merkle-CRDTs](https://arxiv.org/abs/2004.00107) for conflict-free database writes and merges making OrbitDB an excellent choice for p2p and decentralized apps, blockchain applications and [local-first](https://www.inkandswitch.com/local-first/) web applications.
|
||||||
|
|
||||||
**Test it live at [Live demo 1](https://ipfs.io/ipfs/QmUsoSkGzUQnCgzfjL549KKf29m5EMYky3Y6gQp5HptLTG/), [Live demo 2](https://ipfs.io/ipfs/QmasHFRj6unJ3nSmtPn97tWDaQWEZw3W9Eh3gUgZktuZDZ/), or [P2P TodoMVC app](https://ipfs.io/ipfs/QmVWQMLUM3o4ZFbLtLMS1PMLfodeEeBkBPR2a2R3hqQ337/)**!
|
|
||||||
|
|
||||||
|
|
||||||
OrbitDB provides various types of databases for different data models and use cases:
|
OrbitDB provides various types of databases for different data models and use cases:
|
||||||
|
|
||||||
- **[events](https://github.com/orbitdb/orbit-db/blob/master/API.md#orbitdblognameaddress)**: an immutable (append-only) log with traversable history. Useful for *"latest N"* use cases or as a message queue.
|
- **[events](https://github.com/orbitdb/orbitdb/blob/master/API.md#orbitdblognameaddress)**: an immutable (append-only) log with traversable history. Useful for *"latest N"* use cases or as a message queue.
|
||||||
- **[documents](https://github.com/orbitdb/orbit-db/blob/master/API.md#orbitdbdocsnameaddress-options)**: a document database to which JSON documents can be stored and indexed by a specified key. Useful for building search indices or version controlling documents and data.
|
- **[documents](https://github.com/orbitdb/orbitdb/blob/master/API.md#orbitdbdocsnameaddress-options)**: a document database to which JSON documents can be stored and indexed by a specified key. Useful for building search indices or version controlling documents and data.
|
||||||
- **[keyvalue](https://github.com/orbitdb/orbit-db/blob/master/API.md#orbitdbkeyvaluenameaddress)**: a key-value database just like your favourite key-value database.
|
- **[keyvalue](https://github.com/orbitdb/orbitdb/blob/master/API.md#orbitdbkeyvaluenameaddress)**: a key-value database just like your favourite key-value database.
|
||||||
- **[keyvalue-indexed](https://github.com/orbitdb/orbit-db/blob/master/API.md#orbitdbkeyvaluenameaddress)**: key-value data indexed in a Level key-value database.
|
- **[keyvalue-indexed](https://github.com/orbitdb/orbitdb/blob/master/API.md#orbitdbkeyvaluenameaddress)**: key-value data indexed in a Level key-value database.
|
||||||
|
|
||||||
All databases are [implemented](https://github.com/orbitdb/orbit-db-store) on top of [ipfs-log](https://github.com/orbitdb/ipfs-log), an immutable, cryptographically verifiable, operation-based conflict-free replicated data structure ([CRDT](https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type)) for distributed systems. ipfs-log is formalized in the paper [Merkle-CRDTs](https://arxiv.org/abs/2004.00107). You can also easily extend OrbitDB by [implementing and using a custom data model](https://github.com/orbitdb/orbit-db/blob/master/GUIDE.md#custom-stores) benefitting from the same properties as the default data models provided by the underlying Merkle-CRDTs.
|
All databases are [implemented](https://github.com/orbitdb/orbitdb/tree/main/src/storage/) on top of OrbitDB's [OpLog](https://github.com/orbitdb/orbitdb/tree/amin/src/oplog/), an immutable, cryptographically verifiable, operation-based conflict-free replicated data structure ([CRDT](https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type)) for distributed systems. OpLog is formalized in the paper [Merkle-CRDTs](https://arxiv.org/abs/2004.00107). You can also easily extend OrbitDB by [implementing and using a custom data model](https://github.com/orbitdb/orbitdb/blob/main/docs/DATABASES.md#building-a-custom-database) benefitting from the same properties as the default data models provided by the underlying Merkle-CRDTs.
|
||||||
|
|
||||||
#### Project status & support
|
#### Project status & support
|
||||||
|
|
||||||
* Status: **in active development**
|
* Status: **in active development**
|
||||||
* Compatible with **ipfs-core versions >= 0.18.0**
|
* Compatible with **ipfs-core versions >= 0.18.0**
|
||||||
|
|
||||||
***NOTE!*** *js-ipfs and related packages are now superseded by IPFS's Helia project and are no longer being maintained. As part of this migration, OrbitDB will be [switching to Helia](./tree/helia).*
|
***NOTE!*** *js-ipfs and related packages are now superseded by IPFS's Helia project and are no longer being maintained. As part of this migration, OrbitDB will be [switching to Helia](https://github.com/orbitdb/orbitdb/tree/helia).*
|
||||||
|
|
||||||
***NOTE!*** *OrbitDB is **alpha-stage** software. It means OrbitDB hasn't been security audited and programming APIs and data formats can still change. We encourage you to [reach out to the maintainers](https://app.element.io/#/room/#orbit-db:matrix.org) if you plan to use OrbitDB in mission critical systems.*
|
|
||||||
|
|
||||||
This is the Javascript implementation and it works both in **Browsers** and **Node.js** with support for Linux, OS X, and Windows. Node version 16 is supported.
|
This is the Javascript implementation and it works both in **Browsers** and **Node.js** with support for Linux, OS X, and Windows. Node version 16 is supported.
|
||||||
|
|
||||||
@ -41,15 +36,10 @@ A Go implementation is developed and maintained by the [Berty](https://github.co
|
|||||||
* [Browser <script> tag](#browser-script-tag)
|
* [Browser <script> tag](#browser-script-tag)
|
||||||
- [Usage](#usage)
|
- [Usage](#usage)
|
||||||
- [API](#api)
|
- [API](#api)
|
||||||
- [Examples](#examples)
|
|
||||||
* [Install dependencies](#install-dependencies)
|
|
||||||
* [Browser example](#browser-example)
|
|
||||||
* [Node.js example](#nodejs-example)
|
|
||||||
- [Development](#development)
|
- [Development](#development)
|
||||||
* [Run Tests](#run-tests)
|
* [Run Tests](#run-tests)
|
||||||
* [Build](#build)
|
* [Build](#build)
|
||||||
* [Benchmark](#benchmark)
|
* [Benchmark](#benchmark)
|
||||||
* [Logging](#logging)
|
|
||||||
* [API](#api)
|
* [API](#api)
|
||||||
- [Frequently Asked Questions](#frequently-asked-questions)
|
- [Frequently Asked Questions](#frequently-asked-questions)
|
||||||
* [Are there implementations in other languages?](#are-there-implementations-in-other-languages)
|
* [Are there implementations in other languages?](#are-there-implementations-in-other-languages)
|
||||||
@ -62,7 +52,7 @@ A Go implementation is developed and maintained by the [Berty](https://github.co
|
|||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```
|
```
|
||||||
npm install orbit-db
|
npm install @orbitdb/core
|
||||||
```
|
```
|
||||||
|
|
||||||
### Browser <script> tag
|
### Browser <script> tag
|
||||||
@ -73,15 +63,15 @@ OrbitDB can be loaded in the browser using the distributed js file with the `<sc
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
If you're using `orbit-db` to develop **browser** or **Node.js** applications, use it as a module with the javascript instance of IPFS.
|
If you're using `@orbitdb/core` to develop **browser** or **Node.js** applications, use it as a module with the javascript instance of IPFS.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import IPFS from 'ipfs-core'
|
import IPFS from 'ipfs-core'
|
||||||
import OrbitDB from 'orbit-db'
|
import { createOrbitDB } from '@orbitdb/core'
|
||||||
|
|
||||||
;(async function () {
|
;(async function () {
|
||||||
const ipfs = await IPFS.create()
|
const ipfs = await IPFS.create()
|
||||||
const orbitdb = await OrbitDB({ ipfs })
|
const orbitdb = await createOrbitDB({ ipfs })
|
||||||
|
|
||||||
// Create / Open a database. Defaults to db type "events".
|
// Create / Open a database. Defaults to db type "events".
|
||||||
const db = await orbitdb.open("hello")
|
const db = await orbitdb.open("hello")
|
||||||
@ -112,61 +102,11 @@ import OrbitDB from 'orbit-db'
|
|||||||
})()
|
})()
|
||||||
```
|
```
|
||||||
|
|
||||||
Use the **[Getting Started](./docs/GETTING_STARTED.md)** guide for an initial introduction to OrbitDB and you can find more advanced topics covered in our [docs](./docs).
|
Use the **[Getting Started](https://github.com/orbitdb/orbitdb/docs/GETTING_STARTED.md)** guide for an initial introduction to OrbitDB and you can find more advanced topics covered in our [docs](https://github.com/orbitdb/orbitdb/docs).
|
||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
See [API.md](https://github.com/orbitdb/orbit-db/blob/master/API.md) for the full documentation.
|
See [API.md](https://github.com/orbitdb/orbitdb/blob/master/API.md) for the full documentation.
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
### Install dependencies
|
|
||||||
```sh
|
|
||||||
git clone https://github.com/orbitdb/orbit-db.git
|
|
||||||
cd orbit-db
|
|
||||||
npm install
|
|
||||||
```
|
|
||||||
Some dependencies depend on native addon modules, so you'll also need to meet [node-gyp's](https://github.com/nodejs/node-gyp#installation) installation prerequisites. Therefore, Linux users may need to
|
|
||||||
```sh
|
|
||||||
make clean-dependencies && make deps
|
|
||||||
```
|
|
||||||
to redo the local package-lock.json with working native dependencies.
|
|
||||||
|
|
||||||
### Browser example
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm install # if not yet installed
|
|
||||||
make build
|
|
||||||
npm run examples:browser # if browser isn't opening, open examples/browser/browser.html in your browser
|
|
||||||
```
|
|
||||||
|
|
||||||
Using Webpack:
|
|
||||||
```sh
|
|
||||||
npm install # if not yet installed
|
|
||||||
make build
|
|
||||||
npm run examples:browser-webpack # if browser isn't opening, open examples/browser/browser-webpack-example/index.html in your browser
|
|
||||||
```
|
|
||||||
|
|
||||||
<p align="left">
|
|
||||||
<img src="https://raw.githubusercontent.com/orbitdb/orbit-db/master/images/example1.png" width="33%">
|
|
||||||
</p>
|
|
||||||
|
|
||||||
Check the code in [examples/browser/browser.html](https://github.com/orbitdb/orbit-db/blob/master/examples/browser/browser.html) and try the [live example](https://ipfs.io/ipfs/QmRosp97r8GGUEdj5Wvivrn5nBkuyajhRXFUcWCp5Zubbo/).
|
|
||||||
|
|
||||||
### Node.js example
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm run examples:node
|
|
||||||
```
|
|
||||||
|
|
||||||
<img src="https://raw.githubusercontent.com/orbitdb/orbit-db/master/images/orbit-db-demo3.gif" width="66%">
|
|
||||||
|
|
||||||
**Eventlog**
|
|
||||||
|
|
||||||
See the code in [examples/eventlog.js](https://github.com/orbitdb/orbit-db/blob/master/examples/eventlog.js) and run it with:
|
|
||||||
```sh
|
|
||||||
node examples/eventlog.js
|
|
||||||
```
|
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
@ -185,15 +125,7 @@ npm run build
|
|||||||
node benchmarks/benchmark-add.js
|
node benchmarks/benchmark-add.js
|
||||||
```
|
```
|
||||||
|
|
||||||
See [benchmarks/](https://github.com/orbitdb/orbit-db/tree/master/benchmarks) for more benchmarks.
|
See [benchmarks/](https://github.com/orbitdb/orbitdb/tree/master/benchmarks) for more benchmarks.
|
||||||
|
|
||||||
### Logging
|
|
||||||
|
|
||||||
To enable OrbitDB's logging output, set a global ENV variable called `LOG` to `debug`,`warn` or `error`:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
LOG=debug node <file>
|
|
||||||
```
|
|
||||||
|
|
||||||
### API
|
### API
|
||||||
|
|
||||||
@ -222,7 +154,7 @@ The best place to find out what is out there and what is being actively worked o
|
|||||||
|
|
||||||
**Take a look at our organization-wide [Contributing Guide](https://github.com/orbitdb/welcome/blob/master/contributing.md).** You'll find most of your questions answered there. Some questions may be answered in the [FAQ](FAQ.md), as well.
|
**Take a look at our organization-wide [Contributing Guide](https://github.com/orbitdb/welcome/blob/master/contributing.md).** You'll find most of your questions answered there. Some questions may be answered in the [FAQ](FAQ.md), as well.
|
||||||
|
|
||||||
If you want to code but don't know where to start, check out the issues labelled ["help wanted"](https://github.com/orbitdb/orbit-db/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+sort%3Areactions-%2B1-desc).
|
If you want to code but don't know where to start, check out the issues labelled ["help wanted"](https://github.com/orbitdb/orbitdb/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+sort%3Areactions-%2B1-desc).
|
||||||
|
|
||||||
## Sponsors
|
## Sponsors
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user