Skip to content

Commit 03f4944

Browse files
committed
feat: add ceramic one, orbis db updates
1 parent 0a92347 commit 03f4944

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+41580
-16807
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
title: Overview
3+
description: Open-source relational database built on top of Ceramic.
4+
---
5+
6+
OrbisDB is a fully open-source relational database built on top of Ceramic, a decentralized event
7+
store. It inherits data ownership, composability and decentralized properties of Ceramic, while
8+
providing a highly scalable way of querying data via SQL, GraphQL and a built-in Dashboard.
9+
10+
## Features
11+
12+
- Easy setup
13+
- Scalability
14+
- Decentralized
15+
- Composable
16+
- Contextualized
17+
- Data ownership
18+
- Customizable
19+
- PostgreSQL
20+
- GraphQL
21+
22+
## Motivation
23+
24+
OrbisDB is a successor of Orbis, an open social protocol. The experience of building a user and
25+
developer friendly open social protocol gave us insights into existing solutions and their
26+
limitations.
27+
28+
Most web3 database solutions today come with trade-offs such as high gas costs, scalability issues
29+
or a completely new architecture and developer experience.
30+
31+
OrbisDB, on other hand, builds on top of existing
32+
[solutions and protocols](/docs/orbisdb/managing-data). This allows us to focus on the core product,
33+
without reinventing existing foundations. It also benefits from the existing vast ecosystems.
34+
35+
Since nobody can predict all the use cases, OrbisDB comes with plugins, allowing anyone to build and
36+
extend core functionality, expose new API routes or customize the way data is being validated and
37+
stored.
38+
39+
## Use cases
40+
41+
- Social platform
42+
- Forum
43+
- Web apps
44+
- DeSci
45+
- DePin
46+
- Data pipelines
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
title: Architecture
3+
description:
4+
OrbisDB builds on top of proven foundations, utilizing open-source projects, standards and
5+
protocols.
6+
---
7+
8+
OrbisDB builds on top of proven foundations, utilizing open-source projects, standards and
9+
protocols.
10+
11+
## Ceramic (write)
12+
13+
Ceramic is a decentralized event store with composability and data ownership at its core. It can be
14+
compared to Kafka in the Web2 stack. The protocol is purpose-built for data, allowing for higher
15+
scalability and lower costs.
16+
17+
To find out more about Ceramic, check out the docs.
18+
19+
### Streams
20+
21+
Each Ceramic stream represents a row in OrbisDB. It contains all commits (modifications) done to the
22+
data since the initial creation. This is done in the form of Events.
23+
24+
### Models
25+
26+
Ceramic Models dictate the way data needs to be structured, providing composability out of the box.
27+
Any application can consume the data based on the Model definition, knowing it will be valid. Each
28+
Model is treated as a subscription topic and represented as a unique Table in OrbisDB.
29+
30+
Read more about Models [here](/docs/orbisdb/managing-data/models).
31+
32+
### IPFS
33+
34+
IPFS (and IPLD) are powering Ceramic's data storage, providing a universal data model and P2P cold
35+
storage.
36+
37+
### DID
38+
39+
Ceramic utilizes [DIDs](/docs/orbisdb/managing-data/accounts) - decentralized identifiers. Any data
40+
coming through Ceramic needs to be signed by the end user. Creators have the sole ownership over
41+
their data.
42+
43+
## PostgreSQL (read)
44+
45+
The most famous open-source database sits at the core of OrbisDB. Choosing PostgreSQL allows OrbisDB
46+
to expose a familiar query interface. It also brings an existing ecosystem, bundled with thousands
47+
of extensions and services.
48+
49+
## OrbisDB Node (orchestrate)
50+
51+
OrbisDB Node runs on top of Ceramic and PostgreSQL, indexing data and exposing an API to query it.
52+
It subscribes to Ceramic's events via SSE, ingesting, filtering and storing data based on the rules
53+
defined by the OrbisDB Node owner.
54+
55+
### Dashboard
56+
57+
OrbisDB Dashboard is a hosted UI that allows anyone to configure and manage their node with no
58+
server or infrastructure knowledge required.
59+
60+
### Plugins (customize)
61+
62+
Nobody can predict all the use cases, so we made sure to include a robust plugin framework. This
63+
allows anyone to tap into the existing ecosystem of plugins or build new ones to make OrbisDB truly
64+
theirs. Plugins are used to validate and enrich data, do post-processing (such as webhooks,
65+
notifications, and emails) and expose API routes.
66+
67+
### Writing data
68+
69+
1. End user creates and signs the data (SDK)
70+
2. The data is sent to Ceramic by the end user directly (SDK)
71+
3. OrbisDB picks up and processes Ceramic events
72+
4. Plugins are used to validate and enrich the data
73+
5. If the data passes all the checks, its then organized and stored in PostgreSQL
74+
6. Plugins get the final state of data, allowing them to do post-processing operations
75+
76+
### Reading data
77+
78+
1. User interacts with the OrbisDB directly (SDK)
79+
2. OrbisDB handles permissions and locates the data
80+
3. Data gets loaded from the database and returned to the user
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
title: Quickstart
3+
description: A list of resources to get you started with decentralized data today.
4+
---
5+
6+
A list of resources to get you started with decentralized data today.
7+
8+
## OrbisDB `Studio`
9+
10+
OrbisDB Studio is a shared node managed by the team behind OrbisDB. You can start exploring OrbisDB
11+
with no downloads, setup or a single line of code. Check out our
12+
[Managed section](/docs/orbisdb/setting-up/managed-studio) or
13+
[visit the Studio](https://studio.useorbis.com/).
14+
15+
## OrbisDB `Node`
16+
17+
You can find the source code of OrbisDB nodes [in our Github](https://github.com/OrbisWeb3/orbisdb).
18+
It's MIT licensed. Learn how to set up your node for local development or in the cloud in our
19+
[Setting up section](/docs/orbisdb/setting-up).
20+
21+
## OrbisDB `Dashboard`
22+
23+
A Data dashboard for node management.
24+
25+
## OrbisDB `SDK`
26+
27+
To read and write data programmatically, you need an SDK. Check out the
28+
[source code](https://github.com/OrbisWeb3/db-sdk) or the
29+
[package](https://www.npmjs.com/package/@useorbis/db-sdk) and install it using your favorite package
30+
manager. Quickstart your decentralized data journey with our
31+
[SDK Reference](/docs/orbisdb/sdk-reference).
32+
33+
### Installing the SDK
34+
35+
You can use your package manager of choice, in this case we'll be using NPM.
36+
37+
```bash
38+
npm install @useorbis/db-sdk
39+
```
40+
41+
## Resources
42+
43+
Learn more about OrbisDB's [Architecture](/docs/orbisdb/introduction/architecture) or check out
44+
[how reading and writing data works](/docs/orbisdb/managing-data).
45+
46+
## Docker **`Coming soon`**
47+
48+
We are working on Docker images to simplify the setup process with prebuilt binaries and bundled
49+
options.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
title: Managing data
3+
description: Learn how to manage data in OrbisDB.
4+
---
5+
6+
OrbisDB is built on top of decentralized components such as DIDs and Models. Despite being new,
7+
these concepts have been made easy to use thanks to OrbisDB abstractions and a Web2-like DX.
8+
9+
## Accounts (DIDs)
10+
11+
OrbisDB utilizes decentralized identifiers (DIDs) for account management. Each entry in the OrbisDB
12+
is verifiably owned by its original author - a trait inherited from Ceramic. DIDs bring this to
13+
another level, allowing users to own their identity in full. They are self-verifiable, so you can
14+
prove your identity (and data ownership) with no 3rd parties involved.
15+
16+
Learn more in the [Accounts section](/docs/orbisdb/managing-data/accounts).
17+
18+
## Models (Tables)
19+
20+
Composable data requires rules. Applications and users need to understand the data to consume it.
21+
Models are a way for you to define your OrbisDB tables using standard JSON Schema. This helps
22+
OrbisDB build out the tables, indexes and relations required. It also allows you to control the data
23+
format, structure and rules - making it easy for anyone to consume.
24+
25+
Find out how to create your first Table in our [Models section](/docs/orbisdb/managing-data/models).
26+
27+
## Contexts (Spaces)
28+
29+
Data in today's world is already complex enough. However, bringing data to an open and composable
30+
network is a challenge in itself. Contexts and Sub-Contexts are an OrbisDB (and Ceramic) native way
31+
of organizing data. Think of them as separate "Spaces" in your OrbisDB. They help OrbisDB sift
32+
through data to index, but also allow isolation for things such as plugins.
33+
34+
Learn how data organization works in our [Contexts section](/docs/orbisdb/managing-data/contexts).
35+
36+
## Queries
37+
38+
We were determined to bring a familiar developer experience to the web3. This is one of the reasons
39+
our indexing is backed by PostgreSQL. However, there's more to it than just the choice of
40+
technologies. Our SDK methods should feel just as familiar, whether you're interacting with our
41+
underlying data network (Ceramic) or OrbisDB directly.
42+
43+
### INSERT & UPDATE
44+
45+
Writing data to a decentralized data network is one function call away - literally. Learn how
46+
`INSERTs` and `UPDATEs` work in OrbisDB in our [Writing](/docs/orbisdb/managing-data/insert) and
47+
[Updating](/docs/orbisdb/managing-data/update) data sections.
48+
49+
### SELECT
50+
51+
When querying already-indexed data, you're interfacing with OrbisDB directly. Whether you prefer a
52+
query builder, raw SQL or GraphQL - OrbisDB got you covered.
53+
54+
Check out the full [SELECT guide here](/docs/orbisdb/managing-data/select).
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
---
2+
title: Accounts (DIDs)
3+
description: Understand how OrbisDB uses DIDs to manage data ownership.
4+
---
5+
6+
One of OrbisDB's main features is data ownership - each entry in OrbisDB is verifiably owned by the
7+
end user, the original author.
8+
9+
## Decentralized Identifiers
10+
11+
OrbisDB inherits its data ownership properties from Ceramic, a decentralized event store. Ceramic
12+
and OrbisDB share the same account model - Decentralized Identifiers, DID for short.
13+
14+
DIDs have unique properties, they are self-verifiable which allows users to own their data without
15+
relying on 3rd parties for verification. No matter which app you use in our ecosystem, you can bring
16+
your identity with you - it's yours.
17+
18+
You can recognize DIDs by their simple format
19+
20+
```bash
21+
did:<method>:<data>
22+
```
23+
24+
## DIDs in OrbisDB
25+
26+
DIDs are one of the foundational concepts at OrbisDB. They allow users to fully own their identity,
27+
as well as their data. Each OrbisDB session is based on a DID. Every OrbisDB row entry is signed and
28+
owned by the original author's DID. You can verify this by checking the `controller` field.
29+
30+
However, you don't _need_ to understand everything about DIDs or how they work. We made sure to
31+
simplify the process and abstract all the complexities using our SDK and UI.
32+
33+
### Code example (EVM)
34+
35+
With OrbisDB, everything DID-related is handled by a single method - `connectUser`. Learn how to
36+
[initialize OrbisDB](/docs/orbisdb/sdk-reference) and
37+
[authenticate users](/docs/orbisdb/sdk-reference/auth).
38+
39+
```tsx
40+
import { OrbisDB } from "@useorbis/db-sdk";
41+
import { OrbisEVMAuth } from "@useorbis/db-sdk/auth";
42+
43+
// Browser provider (ie. Metamask)
44+
const provider = window.ethereum;
45+
46+
// Orbis Authenticator
47+
const auth = new OrbisEVMAuth(provider);
48+
49+
// Authenticate the user and persist the session in localStorage
50+
const authResult: OrbisConnectResult = await orbis.connectUser({ auth });
51+
52+
// Log the result
53+
console.log({ authResult });
54+
```
55+
56+
## DID types
57+
58+
DIDs have multiple methods by which they can be created. The ones used by Ceramic and OrbisDB are
59+
`did:pkh` and `did:key`.
60+
61+
### did:pkh
62+
63+
`did:pkh` is the most commonly used method because it's simple to derive. It's based on the public
64+
key of the end user, so it's native to all the web3 EOA wallets. The DID is derived from an end
65+
user's personal signature, allowing users to authorize apps for specific operations. This helps with
66+
the UX as users need to sign once for the duration of the session (3 months is the OrbisDB default).
67+
68+
#### Format
69+
70+
```bash
71+
did:pkh:<network>:<chain>:<address>
72+
```
73+
74+
#### When to use `did:pkh`
75+
76+
`did:pkh` is a web3 wallet friendly format as it relies on the already-existing private/public key
77+
pair. It's used by the OrbisDB Dashboard and we recommend it as the default format for your
78+
applications. It allows users to use their existing wallets without the need of remembering or
79+
saving another seed.
80+
81+
> `did:pkh` format can be used with EOA wallets only, **Smart Contract wallets are not supported**
82+
> as they do not have a private key.
83+
84+
#### Example - Ethereum (EVM)
85+
86+
An example of a `did:pkh` for an EVM wallet is
87+
88+
```bash
89+
did:pkh:eip155:1:0x0c63b64022edf1860a3ee5137c2bacb31aff1379
90+
```
91+
92+
If you're interested in the full specification, check out the
93+
[did:pkh draft](https://github.com/w3c-ccg/did-pkh/blob/main/did-pkh-method-draft.md).
94+
95+
### did:key
96+
97+
`did:key` method is based on a randomly generated key pair. Unlike `did:pkh`, it's not derived from
98+
a signature or an existing key pair. Instead, a new key pair is generated using `Ed25519` and the
99+
value needs to be securely stored by the end user.
100+
101+
#### Format
102+
103+
```bash
104+
did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK
105+
```
106+
107+
#### When to use `did:key`
108+
109+
`did:key` is best used when an EOA wallet is not available or isn't pre-existing. We often use it on
110+
the server-side, as storing a new seed is just another secret. Using `did:key` for your end users is
111+
not recommended as they need to store a new seed and if they were to lose it - they'd lose all
112+
access to their data.
113+
114+
#### Example - Ed25519
115+
116+
```bash
117+
did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK
118+
```
119+
120+
The above example comes from the official
121+
[did:key method specification](https://w3c-ccg.github.io/did-method-key/#format).

0 commit comments

Comments
 (0)