mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-06-05 13:46:36 +00:00
Update README and getting started guide
This commit is contained in:
parent
77bd2734a6
commit
d4918e750a
30
README.md
30
README.md
@ -35,14 +35,14 @@ A Go implementation is developed and maintained by the [Berty](https://github.co
|
||||
- [Installation](#installation)
|
||||
* [Browser <script> tag](#browser-script-tag)
|
||||
- [Usage](#usage)
|
||||
- [API](#api)
|
||||
- [Documentation](#documentation)
|
||||
* [API](#api)
|
||||
- [Development](#development)
|
||||
* [Run Tests](#run-tests)
|
||||
* [Build](#build)
|
||||
* [Benchmark](#benchmark)
|
||||
* [API](#api)
|
||||
- [Frequently Asked Questions](#frequently-asked-questions)
|
||||
* [Are there implementations in other languages?](#are-there-implementations-in-other-languages)
|
||||
- [Are there implementations in other languages?](#other-implementations)
|
||||
- [Contributing](#contributing)
|
||||
- [Sponsors](#sponsors)
|
||||
- [License](#license)
|
||||
@ -51,8 +51,10 @@ A Go implementation is developed and maintained by the [Berty](https://github.co
|
||||
|
||||
## Installation
|
||||
|
||||
Note! The upcoming version 1.0.0 is currently in testing and needs to be installed as version "next" as described below.
|
||||
|
||||
```
|
||||
npm install @orbitdb/core
|
||||
npm install @orbitdb/core@next
|
||||
```
|
||||
|
||||
### Browser <script> tag
|
||||
@ -102,11 +104,13 @@ import { createOrbitDB } from '@orbitdb/core'
|
||||
})()
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
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/orbitdb/blob/master/API.md) for the full documentation.
|
||||
See [api.orbitdb.org](https://api.orbitdb.org) for the full API documentation.
|
||||
|
||||
## Development
|
||||
|
||||
@ -137,18 +141,12 @@ npm run build:docs
|
||||
|
||||
Documentation is output to ./docs/api.
|
||||
|
||||
## Frequently Asked Questions
|
||||
## Other implementations
|
||||
|
||||
We have an FAQ! [Go take a look at it](FAQ.md). If a question isn't there, open an issue and suggest adding it. We can work on the best answer together.
|
||||
- Golang: [berty/go-orbit-db](https://github.com/berty/go-orbit-db)
|
||||
- Python: [orbitdb/py-orbit-db-http-client](https://github.com/orbitdb/py-orbit-db-http-client)
|
||||
|
||||
### Are there implementations in other languages?
|
||||
|
||||
Yes! Take a look at these implementations:
|
||||
|
||||
- Golang: [berty/go-orbit-db](https://github.com/berty/go-orbit-db)
|
||||
- Python: [orbitdb/py-orbit-db-http-client](https://github.com/orbitdb/py-orbit-db-http-client)
|
||||
|
||||
The best place to find out what is out there and what is being actively worked on is likely by asking in the [Matrix](https://app.element.io/#/room/#orbit-db:matrix.org). If you know of any other repos that ought to be included in this section, please open a PR and add them.
|
||||
If you know of any other repos that ought to be included in this section, please open a PR and add them.
|
||||
|
||||
## Contributing
|
||||
|
||||
|
@ -7,7 +7,7 @@ This guide will help you get up and running with a simple OrbitDB database that
|
||||
Install OrbitDB:
|
||||
|
||||
```sh
|
||||
npm i orbit-db
|
||||
npm i @orbitdb/core@next
|
||||
```
|
||||
|
||||
You will also need IPFS for replication:
|
||||
@ -122,7 +122,7 @@ import { create } from 'ipfs-core'
|
||||
|
||||
const main = async () => {
|
||||
// create a random directory to avoid IPFS and OrbitDB conflicts.
|
||||
let randDir = (Math.random() + 1).toString(36).substring(2);
|
||||
let randDir = (Math.random() + 1).toString(36).substring(2)
|
||||
|
||||
const config = {
|
||||
Addresses: {
|
||||
@ -138,7 +138,7 @@ const main = async () => {
|
||||
// This will create all OrbitDB-related databases (keystore, my-db, etc) in
|
||||
// ./[randDir]/ipfs.
|
||||
const orbitdb = await createOrbitDB({ ipfs, directory: './' + randDir + '/orbitdb' })
|
||||
|
||||
|
||||
// Get the IPFS AccessController function. We will need it to ensure everyone
|
||||
// can write to the database.
|
||||
const AccessController = getAccessController('ipfs')
|
||||
@ -146,7 +146,7 @@ const main = async () => {
|
||||
let db
|
||||
|
||||
if (process.argv[2]) {
|
||||
db = await orbitdb.open(process.argv[2])
|
||||
db = await orbitdb.open(process.argv[2])
|
||||
} else {
|
||||
// When we open a new database, write access is only available to the
|
||||
// db creator. When replicating a database on a remote peer, the remote
|
||||
@ -156,16 +156,16 @@ const main = async () => {
|
||||
// revoke.
|
||||
db = await orbitdb.open('my-db', { AccessController: AccessController({ write: ['*']})})
|
||||
}
|
||||
|
||||
|
||||
// Copy this output if you want to connect a peer to another.
|
||||
console.log('my-db address', db.address)
|
||||
|
||||
|
||||
// Add some records to the db when another peers joins.
|
||||
db.events.on('join', async (peerId, heads) => {
|
||||
await db.add('hello world 1')
|
||||
await db.add('hello world 2')
|
||||
await db.add('hello world 2')
|
||||
})
|
||||
|
||||
|
||||
db.events.on('update', async (entry) => {
|
||||
console.log('entry', entry)
|
||||
|
||||
@ -179,8 +179,8 @@ const main = async () => {
|
||||
await db.close()
|
||||
await orbitdb.stop()
|
||||
await ipfs.stop()
|
||||
|
||||
process.exit()
|
||||
|
||||
process.exit()
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user