2016-10-04 19:07:33 +02:00
2016-10-04 19:07:33 +02:00
2016-10-04 19:07:32 +02:00
2016-10-04 19:07:31 +02:00
2016-10-04 19:07:33 +02:00
2016-10-04 19:07:32 +02:00
2016-10-04 19:07:33 +02:00
2016-10-04 19:07:31 +02:00
2016-03-10 17:00:45 +01:00
2016-10-04 19:07:33 +02:00
2016-10-04 19:07:33 +02:00
WIP
2016-10-04 19:07:31 +02:00
WIP
2016-10-04 19:07:31 +02:00
2016-10-04 19:07:32 +02:00

OrbitDB

Distributed, peer-to-peer database on IPFS.

CircleCI Status Project Status

Introduction

orbit-db is a distributed, peer-to-peer database for applications. You can use orbit-db for different data models: Key-Value Store, Eventlog (append-only log), Feed (add and remove log) and Counters. The database gets replicated automatically with peers who are connected to the same database.

This is the Javascript implementation and it works both in Node.js and Browsers.

  • Client-side database to be embedded in Javascript applications
  • Stores all data in IPFS
  • Aggregation happens on client side and data is eventually consistent
  • Designed to work offline first

Node.js

Browser

Data stores

Currently available data stores:

Install

From npm:

npm install orbit-db

From git:

git clone https://github.com/haadcode/orbit-db.git
cd orbit-db
npm install

Usage

'use strict'

const IpfsApi = require('ipfs-api')
const OrbitDB = require('orbit-db')

const ipfs = IpfsApi('localhost', '5001')
const orbitdb = new OrbitDB(ipfs)

const db = orbitdb.eventlog("feed name")

db.add("hello world")
  .then(() => {
    const latest = db.iterator({ limit: 5 }).collect()
    console.log(latest.join("\n"))
  })

Examples

Browser example

npm install
npm run build:examples
npm run examples:browser

Node.js example

npm install
npm run examples:node

See detailed example and run it with:

node examples/eventlog.js
'use strict'

const IpfsDaemon = require('ipfs-daemon')
const OrbitDB = require('orbit-db')

IpfsDaemon()
  .then((res) => {
    const orbitdb = new OrbitDB(res.ipfs)
    const db = orbitdb.eventlog("|orbit-db|examples|eventlog-example")

    const creatures = ['🐙', '🐷', '🐬', '🐞', '🐈', '🙉', '🐸', '🐓']

    const query = () => {
      const index = Math.floor(Math.random() * creatures.length)
      db.add(creatures[index])
        .then(() => {
          const latest = db.iterator({ limit: 5 }).collect()
          let output = ``
          output += `---------------------------------------------------\n`
          output += `Latest Visitors\n`
          output += `---------------------------------------------------\n`
          output += latest.reverse().map((e) => e.payload.value).join('\n') + `\n`
          console.log(output)          
        })
        .catch((e) => {
          console.error(e.stack)
        })
    }

    setInterval(query, 1000)
  })
  .catch((err) => console.error(err))

API

TODO

Development

Run Tests

npm test

Build distributables

npm run build

Background

TODO

Check out a visualization of the data flow at https://github.com/haadcode/proto2

Live demo: http://celebdil.benet.ai:8080/ipfs/Qmezm7g8mBpWyuPk6D84CNcfLKJwU6mpXuEN5GJZNkX3XK/

Screenshot

TODO: list of modules used, orbit-db-pubsub, etc.

Contributing

TODO

License

MIT ©️ 2016, Haadcode

Description
No description provided
Readme 11 MiB
Languages
JavaScript 94.2%
HTML 5.4%
Makefile 0.3%
Dockerfile 0.1%