Skip to content

Commit fa00e0d

Browse files
authored
Enhance About Yorkie (#278)
1 parent 6587181 commit fa00e0d

File tree

6 files changed

+143
-62
lines changed

6 files changed

+143
-62
lines changed

components/Layout/MobileGnbDropdown.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,6 @@ export function MobileGnbDropdown({ isLoggedIn }: { isLoggedIn: boolean }) {
137137
Self-Hosted Server
138138
</Link>
139139
</li>
140-
<li className="navigator_group">
141-
<Link
142-
href="/docs/internals"
143-
className={classNames('navigator_item', 'add_icon', {
144-
is_active: asPath.startsWith(`/docs/internals`),
145-
})}
146-
>
147-
Internals
148-
</Link>
149-
</li>
150140
</ul>
151141
</nav>
152142
</li>

components/Mermaid.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ let mermaidInitialized = false;
99

1010
function MermaidComponent({ chart }: MermaidProps) {
1111
const ref = useRef<HTMLDivElement>(null);
12-
const idRef = useRef<string>(`mermaid-${Math.random().toString(36).substr(2, 9)}-${Date.now()}`);
1312

1413
useEffect(() => {
1514
if (!mermaidInitialized) {
@@ -25,7 +24,9 @@ function MermaidComponent({ chart }: MermaidProps) {
2524
const renderDiagram = async () => {
2625
if (ref.current && chart) {
2726
try {
28-
const { svg } = await mermaid.render(idRef.current, chart);
27+
// Generate a unique ID for each render to avoid conflicts
28+
const id = `mermaid-${Math.random().toString(36).substr(2, 9)}-${Date.now()}`;
29+
const { svg } = await mermaid.render(id, chart);
2930
ref.current.innerHTML = svg;
3031
} catch (error) {
3132
console.error('Failed to render mermaid diagram:', error);
@@ -35,6 +36,13 @@ function MermaidComponent({ chart }: MermaidProps) {
3536
};
3637

3738
renderDiagram();
39+
40+
return () => {
41+
// Cleanup on unmount
42+
if (ref.current) {
43+
ref.current.innerHTML = '';
44+
}
45+
};
3846
}, [chart]);
3947

4048
return <div ref={ref} className="mermaid" />;

docs/architecture-patterns.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ In this pattern, Yorkie serves as the primary Source of Truth for your document
259259
- All changes are automatically persisted in real-time
260260
- Simplified architecture with single source of truth
261261

262-
> **How It Works:** Yorkie uses [CRDT (Conflict-free Replicated Data Types)](/docs/internals) to ensure automatic conflict resolution, enabling seamless real-time collaboration without manual conflict handling.
262+
> **How It Works:** Yorkie uses CRDT (Conflict-free Replicated Data Types) to ensure automatic conflict resolution, enabling seamless real-time collaboration without manual conflict handling.
263263
264264
**Document Editing Flow:**
265265

@@ -349,4 +349,3 @@ For more information about Yorkie's API and features:
349349
- [Security Configuration](/docs/security) - Auth Webhook and access control
350350
- [CLI](/docs/cli) - Command-line tools for project management
351351
- [Glossary](/docs/glossary) - Key terminology and concepts
352-
- [Internals](/docs/internals) - CRDT algorithms and design documents

docs/index.mdx

Lines changed: 94 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,47 +5,111 @@ order: 10
55

66
## About Yorkie
77

8-
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.
8+
Yorkie is an open-source document store for building real-time collaborative applications. Think Google Docs, Figma, or any application where multiple users work together simultaneously - Yorkie provides the infrastructure to make that happen.
99

10-
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.
10+
### What is Yorkie?
1111

12-
In the following sections, we will explore the structure and workings of Yorkie in more detail.
12+
Yorkie is a comprehensive collaboration platform that handles the complex challenges of building real-time collaborative applications. It provides:
1313

14-
### Components
14+
- [JSON-like Document](/docs/js-sdk#document) based on [Conflict-free Replicated Data Types (CRDTs)](/docs/glossary) for automatic conflict resolution
15+
- [Presence](/docs/js-sdk#presence) tracking to show who's online and what they're doing
16+
- [Channel](/docs/js-sdk#channel) for lightweight, real-time communication without data persistence
17+
- Offline support with automatic synchronization when network is restored
1518

16-
Yorkie consists of four main components: Clients, Documents, Channels, and Server.
19+
### Why Yorkie?
1720

18-
- [Client](/docs/js-sdk#client)s are the entities that communicate with the server. Changes made by documents can be synchronized with the server, allowing for real-time collaboration.
19-
- [Document](/docs/js-sdk#document)s are the core data structures of Yorkie, based on Conflict-free Replicated Data Types(CRDTs). Documents are persisted in the database and support offline editing, making them ideal for collaborative applications that require data persistence.
20-
- [Channel](/docs/js-sdk#channel)s provide lightweight, real-time communication for ephemeral data like presence tracking and message broadcasting. Unlike Documents, Channels are memory-only and do not persist data to the database.
21-
- [Server](/docs/self-hosted-server) is the central hub of Yorkie, receiving changes from clients, storing them in the database, and propagating them to other clients who are subscribed to the same documents or channels.
21+
Unlike other CRDT libraries like AutoMerge and Yjs that only provide data structures, Yorkie delivers a complete full-stack solution:
2222

23-
In addition, [Project](/docs/cli#project)s in Yorkie represent separate services or applications within the system. This allows for multiple independent projects to coexist within a single Yorkie installation.
23+
- Client SDKs for [JavaScript](/docs/js-sdk), [React](/docs/getting-started/with-react), [Android](/docs/android-sdk), and [iOS](/docs/ios-sdk)
24+
- Managed Cloud Service or [Self-Hosted Server](/docs/self-hosted-server) options
25+
- Built-in Infrastructure for data persistence, synchronization, and scaling
26+
- [Admin APIs](/docs/web-api) for server-side document management
27+
- [Dashboard](https://yorkie.dev/dashboard) and [CLI](/docs/cli) for project management and monitoring
2428

25-
> Server can be used either in Cloud or Self-Hosted Server. <br/><br/> 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.
29+
This means you can focus on building your application's features instead of managing collaboration infrastructure.
30+
31+
### Core Components
32+
33+
Yorkie consists of four main components that work together to enable real-time collaboration:
34+
35+
- [Client](/docs/js-sdk#client) : The entry point for your application. Clients connect to the server, manage documents and channels, and handle synchronization automatically.
36+
- [Document](/docs/js-sdk#document) : Persistent, collaborative data structures based on CRDTs. Documents are stored in the database, support offline editing, and automatically resolve conflicts when users edit simultaneously.
37+
- [Channel](/docs/js-sdk#channel) : Lightweight, memory-only communication layer for ephemeral data. Perfect for presence tracking (who's online, cursor positions) and real-time message broadcasting.
38+
- [Server](/docs/self-hosted-server) : The central hub that receives changes from clients, persists them to the database, and broadcasts updates to subscribed clients. Available as a managed cloud service or self-hosted.
39+
40+
Additionally, **[Projects](/docs/cli#project)** allow you to organize multiple independent applications within a single Yorkie installation, each with its own documents, channels, and clients. Learn more about key concepts in the [Glossary](/docs/glossary).
41+
42+
Yorkie offers flexibility in how you deploy:
43+
- **Cloud**: Get started instantly with our managed service - no infrastructure setup required
44+
- **Self-Hosted**: Full control over your data and infrastructure for security and compliance needs
2645

2746
### How it works
2847

29-
A high-level overview of Yorkie is as follows:
48+
Here's a high-level overview of Yorkie's architecture:
3049

50+
```mermaid
51+
graph LR
52+
subgraph ClientA["Client A (Go)"]
53+
DocA["Document D-1<br/>{ a: 1, b: {} }"]
54+
end
55+
56+
subgraph ClientB["Client B (JS)"]
57+
DocB["Document D-1<br/>{ a: 2, b: {} }"]
58+
end
59+
60+
subgraph Dashboard["Dashboard or CLI"]
61+
Query["Query Q-1<br/>P-1.find({a:2})"]
62+
end
63+
64+
subgraph Server["Cloud or Self-Hosted Server"]
65+
subgraph Project["Project p-1"]
66+
DocServer["Document D-1<br/>{ a: 2, b: {} }"]
67+
Channel["Channel C-1<br/>{ A, B }"]
68+
end
69+
end
70+
71+
subgraph DB["Database"]
72+
DBChanges["Changes"]
73+
DBSnapshots["Snapshots"]
74+
end
75+
76+
DocA <-->|Changes| DocServer
77+
DocB <-->|Changes| DocServer
78+
Query <--->|Query| Project
79+
Project <--> DBChanges
80+
Project <--> DBSnapshots
3181
```
32-
Client "A" (Go) Cloud or Self-Hosted Server Database
33-
┌───────────────────┐ ┌────────────────────────┐ ┌───────────┐
34-
│ Document "D-1" │◄─Changes─►│ Project "p-1" │ │ Changes │
35-
│ { a: 1, b: {} } │ │ ┌───────────────────┐ │◄────►│ Snapshots │
36-
└───────────────────┘ │ │ Document "D-1" │ │ └───────────┘
37-
Client "B" (JS) │ │ { a: 2, b: {} } │ │
38-
┌───────────────────┐ │ │ │ │
39-
│ Document "D-1" │◄─Changes─►│ │ Channel "C-1" │ │
40-
│ { a: 2, b: {} } │ │ │ { A, B } │ │
41-
└───────────────────┘ │ └───────────────────┘ │
42-
Dashboard or CLI │ │
43-
┌───────────────────┐ └────────────────────────┘
44-
│ Query "Q-1" │ ▲
45-
│ P-1.find({a:2}) ├─────── Query────┘
46-
└───────────────────┘
47-
```
4882

49-
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.
83+
**The Collaboration Flow:**
84+
85+
1. Multiple Replicas: Each client maintains its own replica of a document, representing your application's data model
86+
2. Offline Editing: Clients can edit documents independently, even without network connectivity
87+
3. Automatic Sync: When connected, Yorkie determines which changes need synchronization and updates all clients
88+
4. Conflict Resolution: If multiple users edit simultaneously, Yorkie's CRDTs automatically resolve conflicts, ensuring all replicas converge to the same state
89+
90+
This architecture enables seamless real-time collaboration while supporting offline work, making it ideal for modern collaborative applications.
91+
92+
### Use Cases
93+
94+
Yorkie is perfect for building various types of collaborative applications:
95+
96+
- Collaborative Editors Build the next Google Docs or Notion with [rich text editing examples](/examples/quill)
97+
- Real-time Whiteboards Create Figma-like experiences with [drawing applications](/examples/tldraw)
98+
- Project Management Tools Develop Trello-style boards with [kanban examples](/examples/kanban)
99+
- Code Collaboration Enable pair programming with [CodeMirror integration](/examples/codemirror)
100+
- Presence & Cursors Show who's online with [simultaneous cursors](/examples/simultaneous-cursors)
101+
102+
Explore more [examples](/examples) to see what you can build with Yorkie.
103+
104+
### Next Steps
105+
106+
**Get Started Quickly:**
107+
- Follow the [Getting Started guide](/docs/getting-started) for step-by-step integration
108+
- Choose your platform: [JavaScript](/docs/js-sdk), [React](/docs/getting-started/with-react), [Android](/docs/android-sdk), or [iOS](/docs/ios-sdk)
109+
- Try our [live examples](/examples) to see Yorkie in action
50110

51-
To get started with Yorkie, please refer to the [Getting Started](/docs/getting-started).
111+
**Dive Deeper:**
112+
- Understand [Architecture Patterns](/docs/architecture-patterns) to design your collaboration system
113+
- Learn about [security best practices](/docs/security) for production deployments
114+
- Explore [CLI commands](/docs/cli) for managing your projects
115+
- Check the [Glossary](/docs/glossary) for terminology reference

docs/self-hosted-server.mdx

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -93,24 +93,35 @@ Yorkie provides a sharded cluster in Kubernetes environments to support producti
9393

9494
This page describes how to set up sharded cluster. An example of the sharded cluster is as follows:
9595

96-
```
97-
Sharded Cluster
98-
┌────────────┐
99-
│ │
100-
│ ┌──────┐ │
101-
┌───┼─►│Server│ │
102-
│ │ └──────┘ │
103-
│ │ │
104-
┌──────┐ ┌────────┐ │ │ ┌──────┐ │ ┌───────┐
105-
│Client├──────┤L7 Load ├───┼───┼─►│Server│ ├───►│MongoDB│
106-
└──────┘ │Balancer│ │ │ └──────┘ │ └───────┘
107-
└────────┘ │ │ │
108-
▲ │ │ ┌──────┐ │
109-
│ └───┼─►│Server│ │
110-
┌────┴───┐ │ └──────┘ │
111-
│Service │◄──────┤ │
112-
│Registry│ └────────────┘
113-
└────────┘
96+
```mermaid
97+
graph LR
98+
Client[Client]
99+
LB[L7 Load<br/>Balancer]
100+
Registry[Service<br/>Registry]
101+
Server1[Server]
102+
Server2[Server]
103+
Server3[Server]
104+
MongoDB[(MongoDB)]
105+
106+
Client --> LB
107+
LB --> Server1
108+
LB --> Server2
109+
LB --> Server3
110+
Server1 --> MongoDB
111+
Server2 --> MongoDB
112+
Server3 --> MongoDB
113+
Registry --> LB
114+
Registry -.-> Server1
115+
Registry -.-> Server2
116+
Registry -.-> Server3
117+
118+
style Client fill:#e1f5ff
119+
style LB fill:#fff4e1
120+
style Registry fill:#ffe1f5
121+
style Server1 fill:#e1ffe1
122+
style Server2 fill:#e1ffe1
123+
style Server3 fill:#e1ffe1
124+
style MongoDB fill:#f5e1ff
114125
```
115126

116127
- L7 Load Balancer: It is responsible for routing requests to servers based on the computed request’s hash key and consistent hashing algorithm.

styles/components/_mermaid.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,15 @@
7272

7373
.edgeLabel {
7474
background-color: var(--gray-800);
75+
76+
.labelBkg {
77+
color: var(--gray-100);
78+
}
79+
80+
p {
81+
color: var(--gray-100);
82+
margin: 0;
83+
}
7584
}
7685

7786
text {

0 commit comments

Comments
 (0)