About
About
ECHO (The Eventually Consistent Hierarchical Object store) is a peer-to-peer graph database written in TypeScript.
- Secure, P2P data replication based on CRDTs.
- No servers or central authority, all the data is with the clients.
- Connectivity with peers via WebRTC.
- Support for multiple concurrent writers.
- Collaboration on key-value objects and text.
- Support for offline writes and conflict resolution when peers rejoin the network.
Tell us what you think
Join our Discord and talk to us about the kind of database you are looking for.
Spaces
Spaces are units of sharing and access control in ECHO. They are equivalent to "collections" in a document store.
A space
is an instance of an ECHO database which can be replicated by a number of peers.
A given peer is typically a part of many spaces at any given time.
There are several steps to establishing a space between peers:
- Peer A listens on the peer network for peers intereseted in a specific invite code it generated.
- Peer B obtains the invite code and locates the listening Peer A via the signaling network.
- Peer A and Peer B establish a secure connection via Diffie Hellmann key exchange.
- Peer A generates an authorization code and sends it to Peer B via another safe channel (i.e.: shows a QR code).
- Finally, Peer B provides the authorization code back to Peer A over the new connection.
This verifies that the connection is secure, and the identities of peers are mutually confirmed.
Tip
If you're using react
, DXOS provides a simple UI flow that implements generating and accepting invitations to spaces.
Next steps:
- Create or join a space in TypeScript
- Create or join a space in React
Objects
Units of data are referred to as objects
(like documents or rows in other databases). Objects
always belong to a space. Objects
can have fields with values, and weak references to other objects to form trees or graphs.
Values
Values within an object
are JS strings, numbers, booleans, and null, as well as objects and arrays of the same.
The top-level of a DXOS object
is always a JS object, never a number, string, etc. Its fields starting with @
are reserved, for example @id
and @meta
.
How to use ECHO
- Install the appropriate npm package
@dxos/client
or@dxos/react-client
- Create a Client (or a ClientProvider in react)
- Set up an identity with HALO
- Create or Join a Space
- Query objects (in react)
- Create objects (in react)
- Mutate objects (in react)
ECHO and HALO
ECHO is designed to allow users to retain control over their data. ECHO is a secure storage mechanism, responsible for holding end-user data and identity information (keys, credentials, metadata, ..., etc.) in persistent browser or filesystem storage. Specific devices can be revoked from accessing user data at any time.
In order to allow multiple applications to access the same ECHO database, the user must initiate a device invitation, which synchronizes ECHO across both applications, giving them both read and write access to all of the user's data stored in their ECHO. See Device Invitations for more information.
For Node.js applications, the ECHO database is implemented as an in-process storage engine that persists to files on disk.
Next steps
- If using
react
see the React guide - Otherwise, follow the TypeScript guide