@orbitdb/liftoff
v1.1.0
Published
A preconfigured instance which allows developers to "test drive" OrbitDB.
Downloads
150
Readme
OrbitDB Liftoff
A preconfigured OrbitDB instance which allows users to quickly "test drive" OrbitDB.
This repository provides convenience functions and IPFS and Libp2p configurations to deploy OrbitDB quickly and with minimal knowledge of Helia/Libp2p.
Install
This project uses npm and nodejs.
npm i @orbitdb/liftoff
Usage
To launch a OrbitDB instance and open a database, run startOrbitDB
:
import { startOrbitDB, stopOrbitDB } from '@orbitdb/liftoff'
const orbitdb = await startOrbitDB()
const db1 = await orbitdb.open('db1')
await db1.add('hello world!')
console.log(await db1.all())
await stopOrbitDB(orbitdb)
OrbitDB Liftoff also includes default Libp2p configurations for Node.js and browser for basic connections between multiple peers:
import { createOrbitDB } from '@orbitdb/core'
import { DefaultLibp2pOptions } from '@orbitdb/liftoff'
const libp2p = createLibp2p({ ...DefaultLibp2pOptions })
const ipfs = await createHelia({ libp2p })
const orbitdb = await createOrbitDB({ ipfs })
const db1 = await orbitdb.open('db1')
await db1.add('hello world!')
console.log(await db1.all())
License
MIT © 2024 OrbitDB Community