About Yorkie

Yorkie is an open-source document store that provides a suite of tools for building real-time collaborative applications like Google Docs and Figma. It includes a JSON-like Document based on Conflict-free Replicated Data Types(CRDTs), Presence, and auth webhook features to enable synchronous co-editing.

Unlike other libraries like AutoMerge and Yjs, Yorkie includes a full-stack solution with SDKs, Cloud or Self-Hosted Server, making it easier to implement co-editing capabilities in your application.

In the following sections, we will explore the structure and workings of Yorkie in more detail.

Components

Yorkie consists of three main components: Clients, Documents, and Server.

  • Clients are the entities that communicate with the server. Changes made by documents can be synchronized with the server, allowing for real-time collaboration.
  • Documents are the core data structures of Yorkie, and are based on Conflict-free Replicated Data Types(CRDTs). This allows for seamless collaboration on a document, even when clients are offline.
  • Server is the central hub of the Yorkie, receiving changes from clients, storing them in the database, and propagating them to other clients who are subscribed to the same documents.

In addition, Projects in Yorkie represent separate services or applications within the system. This allows for multiple independent projects to coexist within a single Yorkie installation.

Server can be used either in Cloud or Self-Hosted Server.

When using Yorkie in the cloud, you can access the API directly through the SDK without the need for server installation. For security reason, you can also build and operate a self-hosted Yorkie server.

How it works

A high-level overview of Yorkie is as follows:

Client "A" (Go) Cloud or Self-Hosted Server MemDB or MongoDB
┌───────────────────┐ ┌────────────────────────┐ ┌───────────┐
│ Document "D-1" │◄─Changes─►│ Project "p-1" │ │ Changes │
│ { a: 1, b: {} } │ │ ┌───────────────────┐ │◄────►│ Snapshots │
└───────────────────┘ │ │ Document "D-1" │ │ └───────────┘
Client "B" (JS) │ │ { a: 2, b: {} } │ │
┌───────────────────┐ │ │ │ │
│ Document "D-1" │◄─Changes─►│ │ Document "D-2" │ │
│ { a: 2, b: {} } │ │ │ { a: 3, b: {} } │ │
└───────────────────┘ │ └───────────────────┘ │
Dashboard or CLI │ │
┌───────────────────┐ └────────────────────────┘
│ Query "Q-1" │ ▲
│ P-1.find({a:2}) ├─────── Query────┘
└───────────────────┘

The Yorkie system allows clients to have replicas of a document, representing an application model, on multiple devices. Each client can edit the document independently on their local devices, even when offline. When a network connection is available, Yorkie determines which changes need to be synced between clients and brings their replicas into the same state. In the event that the document is being edited concurrently on different devices, Yorkie automatically syncs the changes and resolves any conflicts, ensuring that all replicas end up in the same state.

To get started with Yorkie, please refer to the Getting Started.