Skip to content

Commit 9efc894

Browse files
hackerwinsclaude
andauthored
Reorganize docs into Tools & APIs, Configuration, and Internals groups (#288)
Split the navigation into clearer groups: - Tools & APIs (order 60): Devtools, CLI, Admin API, MCP - Configuration (order 110): Architecture Patterns, Security, Event Webhook, Revisions, Resources, Projects - Internals (order 120): CRDT Concepts, Synchronization, Document Lifecycle, YSON, Cluster Mode Also adds new pages (Projects, CRDT Concepts, Synchronization, Document Lifecycle, Cluster Mode) and enriches the Glossary with additional terms and cross-links. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 98a15c6 commit 9efc894

26 files changed

+1227
-211
lines changed

docs/advanced.mdx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
---
2-
title: 'Advanced'
2+
title: 'Configuration'
33
order: 110
44
---
55

6-
## Advanced
6+
## Configuration
77

8-
This section covers advanced topics for building production-ready applications with Yorkie. These guides are designed for users who are already familiar with basic Yorkie concepts and want to dive deeper into data formats, security configurations, and architectural patterns.
8+
This section covers configuration and integration topics for building production-ready applications with Yorkie. These guides help you design your architecture, secure your application, and configure project-level settings.
99

1010
### Topics
1111

1212
- **[Architecture Patterns](/docs/advanced/architecture-patterns)**: Explore recommended architectural patterns for integrating Yorkie with your existing systems
1313
- **[Security](/docs/advanced/security)**: Configure allowed origins and Auth Webhooks to secure your Yorkie applications
14-
- **[YSON](/docs/advanced/yson)**: Learn about Yorkie Structured Object Notation, the data format used to represent documents with specialized types for collaborative editing
14+
- **[Event Webhook](/docs/advanced/event-webhook)**: Receive notifications when specific events occur in your Yorkie documents
1515
- **[Revisions](/docs/advanced/revisions)**: Implement version control with snapshots, history browsing, and restore functionality
1616
- **[Resources](/docs/advanced/resources)**: Configure project-level settings for document limits, snapshots, and lifecycle behavior
17+
- **[Projects](/docs/advanced/projects)**: Organize multiple applications with project-based isolation, API keys, and per-project configuration
1718

1819
### Prerequisites
1920

20-
Before exploring these advanced topics, ensure you have:
21+
Before exploring these topics, ensure you have:
2122
1. Completed the [Getting Started guide](/docs/getting-started)
2223
2. Built at least one application using Yorkie SDKs
2324
3. Understood basic concepts like [Client](/docs/js-sdk#client), [Document](/docs/js-sdk#document), and [Channel](/docs/js-sdk#channel)

docs/advanced/architecture-patterns.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ If you're new to Yorkie, we recommend:
2222
In this pattern, your existing database serves as the Source of Truth, while your server manages the document lifecycle through Yorkie's Admin API. This approach provides centralized control over document creation and deletion, making it suitable for applications that require strict server-side governance.
2323

2424
**Key Characteristics:**
25-
- Server creates and deletes documents via [Admin API](/docs/admin-api#documents-management)
25+
- Server creates and deletes documents via [Admin API](/docs/tools/admin-api#documents-management)
2626
- Clients edit documents directly through Yorkie SDK during collaboration
2727
- Explicit "Save" action persists content to your database
2828
- Server maintains full control over document lifecycle
@@ -49,7 +49,7 @@ sequenceDiagram
4949
```
5050

5151
1. Client requests document creation from your server
52-
2. Server creates a new document through [Yorkie Admin API](/docs/admin-api#post-yorkiev1adminservicecreatedocument)
52+
2. Server creates a new document through [Yorkie Admin API](/docs/tools/admin-api#post-yorkiev1adminservicecreatedocument)
5353
3. Server stores document metadata in your database
5454
4. Server returns document key to client
5555
5. Client [attaches](/docs/js-sdk#attaching-the-document) to the document using the provided key
@@ -139,7 +139,7 @@ This pattern also uses your external database as the Source of Truth, but delega
139139
**Key Characteristics:**
140140
- Server only provides document keys and initial content
141141
- Clients create and manage documents independently
142-
- Automatic document cleanup via `RemoveOnDetach` project setting (configure via [CLI](/docs/cli#updating-the-project) or Dashboard)
142+
- Automatic document cleanup via `RemoveOnDetach` project setting (configure via [CLI](/docs/tools/cli#updating-the-project) or Dashboard)
143143
- Explicit "Save" action persists content to your database
144144

145145
**Document Creation Flow:**
@@ -306,7 +306,7 @@ sequenceDiagram
306306
S-->>C: Deletion confirmed
307307
```
308308

309-
1. Client or server removes document via [Yorkie Admin API](/docs/admin-api#post-yorkiev1adminserviceremovedocument)
309+
1. Client or server removes document via [Yorkie Admin API](/docs/tools/admin-api#post-yorkiev1adminserviceremovedocument)
310310
2. Server removes document metadata from your database
311311
3. Document content is automatically removed from Yorkie
312312

@@ -345,7 +345,7 @@ Explore real-world examples implementing these patterns:
345345

346346
For more information about Yorkie's API and features:
347347
- [JS SDK Documentation](/docs/js-sdk) - Client and Document API reference
348-
- [Admin API](/docs/admin-api) - Admin API for server-side management
348+
- [Admin API](/docs/tools/admin-api) - Admin API for server-side management
349349
- [Security Configuration](/docs/advanced/security) - Auth Webhook and access control
350-
- [CLI](/docs/cli) - Command-line tools for project management
350+
- [CLI](/docs/tools/cli) - Command-line tools for project management
351351
- [Glossary](/docs/glossary) - Key terminology and concepts

docs/advanced/event-webhook.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,5 +151,5 @@ app.listen(3000, () => {
151151
### Related Documentation
152152

153153
- [Auth Webhook](/docs/advanced/security#auth-webhook) - For authorization and access control
154-
- [CLI Reference](/docs/cli) - Complete CLI command reference
154+
- [CLI Reference](/docs/tools/cli) - Complete CLI command reference
155155
- [Architecture Patterns](/docs/advanced/architecture-patterns) - Document lifecycle patterns

docs/advanced/projects.mdx

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
---
2+
title: 'Projects'
3+
order: 119
4+
---
5+
6+
## Projects
7+
8+
A **Project** in Yorkie is a logical grouping that isolates documents, channels, and clients. Projects enable multi-tenancy, allowing you to run multiple independent applications or environments within a single Yorkie installation.
9+
10+
### Overview
11+
12+
Every Yorkie installation starts with a `default` project that is created automatically. When a [Client](/docs/js-sdk#client) connects without specifying an API key, it is placed in the default project. For production applications, you should create dedicated projects to isolate data and configure settings independently.
13+
14+
```mermaid
15+
graph TB
16+
subgraph Server["Yorkie Server"]
17+
subgraph P1["Project: my-app-prod"]
18+
D1["Documents"]
19+
C1["Channels"]
20+
CL1["Clients"]
21+
end
22+
subgraph P2["Project: my-app-staging"]
23+
D2["Documents"]
24+
C2["Channels"]
25+
CL2["Clients"]
26+
end
27+
subgraph P3["Project: another-app"]
28+
D3["Documents"]
29+
C3["Channels"]
30+
CL3["Clients"]
31+
end
32+
end
33+
```
34+
35+
### Project Isolation
36+
37+
Each project provides complete isolation:
38+
39+
- **Documents** in one project are invisible to clients in another project. A document key like `doc-1` can exist independently in multiple projects.
40+
- **Channels** are scoped to their project. Broadcast messages and presence updates only reach clients within the same project.
41+
- **Clients** belong to exactly one project, determined by the API key they use to connect.
42+
- **Configuration** (auth webhooks, event webhooks, resource limits, housekeeping thresholds) is set per project.
43+
44+
### API Keys
45+
46+
Each project has two keys:
47+
48+
| Key | Purpose | Usage |
49+
|-----|---------|-------|
50+
| **Public Key** | Identifies the project for client connections | Used as `apiKey` when creating a [Client](/docs/js-sdk#client) |
51+
| **Secret Key** | Authenticates server-side applications | Used in the `authorization` header for [Admin API](/docs/tools/admin-api) requests |
52+
53+
```javascript
54+
// Connect a client to a specific project using its public key
55+
const client = new yorkie.Client({
56+
rpcAddr: '{{API_ADDR}}',
57+
apiKey: 'your-project-public-key',
58+
});
59+
```
60+
61+
> Keep your **Secret Key** confidential. It grants full access to manage documents within the project via the [Admin API](/docs/tools/admin-api). Never expose it in client-side code.
62+
63+
### Managing Projects
64+
65+
Projects are managed through the [CLI](/docs/tools/cli#project) or the [Dashboard]({{DASHBOARD_PATH}}).
66+
67+
#### Creating a Project
68+
69+
```bash
70+
$ yorkie project create my-app-prod
71+
```
72+
73+
This returns the project details including both keys:
74+
75+
```json
76+
{
77+
"name": "my-app-prod",
78+
"public_key": "...",
79+
"secret_key": "...",
80+
"created_at": "..."
81+
}
82+
```
83+
84+
#### Listing Projects
85+
86+
```bash
87+
$ yorkie project ls
88+
```
89+
90+
#### Updating a Project
91+
92+
Configure project settings such as auth webhooks, event webhooks, and resource limits:
93+
94+
```bash
95+
# Set an auth webhook URL
96+
$ yorkie project update my-app-prod --auth-webhook-url https://my-server.com/auth
97+
98+
# Configure event webhooks
99+
$ yorkie project update my-app-prod \
100+
--event-webhook-url https://my-server.com/events \
101+
--event-webhook-events-add DocumentRootChanged
102+
103+
# Set resource limits
104+
$ yorkie project update my-app-prod \
105+
--max-attachments-per-document 50 \
106+
--max-subscribers-per-document 100
107+
108+
# Configure housekeeping
109+
$ yorkie project update my-app-prod \
110+
--client-deactivate-threshold 24h
111+
```
112+
113+
For the full set of update options, see [Updating the Project](/docs/tools/cli#updating-the-project).
114+
115+
### Per-Project Configuration
116+
117+
Each project can be independently configured with the following settings:
118+
119+
| Setting | Description | Reference |
120+
|---------|-------------|-----------|
121+
| **Auth Webhook** | External authentication endpoint for validating client requests | [Security: Auth Webhook](/docs/advanced/security#auth-webhook) |
122+
| **Event Webhook** | Notification endpoint for document events | [Event Webhook](/docs/advanced/event-webhook) |
123+
| **Allowed Origins** | CORS restrictions for client connections | [Security: Allowed Origins](/docs/advanced/security#allowed-origins) |
124+
| **Max Attachments** | Maximum clients that can attach to a single document | [Document Limits](/docs/js-sdk#document-limits) |
125+
| **Max Subscribers** | Maximum clients that can subscribe to a single document | [Document Limits](/docs/js-sdk#document-limits) |
126+
| **Client Deactivate Threshold** | Time after which inactive clients are automatically deactivated by [Housekeeping](/docs/glossary) | [CLI](/docs/tools/cli#updating-the-project) |
127+
128+
### Common Patterns
129+
130+
#### Separate Environments
131+
132+
Create distinct projects for development, staging, and production:
133+
134+
```bash
135+
$ yorkie project create my-app-dev
136+
$ yorkie project create my-app-staging
137+
$ yorkie project create my-app-prod
138+
```
139+
140+
Use environment variables in your application to select the appropriate API key:
141+
142+
```javascript
143+
const client = new yorkie.Client({
144+
rpcAddr: process.env.YORKIE_RPC_ADDR,
145+
apiKey: process.env.YORKIE_API_KEY,
146+
});
147+
```
148+
149+
#### Multiple Applications
150+
151+
If you host multiple collaborative applications on a single Yorkie server, create a project for each:
152+
153+
```bash
154+
$ yorkie project create docs-app
155+
$ yorkie project create whiteboard-app
156+
$ yorkie project create chat-app
157+
```
158+
159+
Each application's documents, channels, and client data remain fully isolated.
160+
161+
### Further Reading
162+
163+
- [CLI: Project Management](/docs/tools/cli#project) -- Full CLI reference for project commands
164+
- [Admin API](/docs/tools/admin-api) -- Server-side document management using the project's secret key
165+
- [Security](/docs/advanced/security) -- Configuring auth webhooks and allowed origins
166+
- [Resources](/docs/advanced/resources) -- Configuring project-level resource limits
167+
- [Glossary](/docs/glossary) -- Definitions of all key terms

docs/advanced/resources.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Resource settings can be configured through:
1313

1414
- **CLI**: Using `yorkie project update` command
1515
- **Dashboard**: Through the project settings page
16-
- **Admin API**: Using the [UpdateProject](/docs/admin-api#post-yorkiev1adminserviceupdateproject) endpoint
16+
- **Admin API**: Using the [UpdateProject](/docs/tools/admin-api#post-yorkiev1adminserviceupdateproject) endpoint
1717

1818
### Document Limits
1919

@@ -188,7 +188,7 @@ yorkie project update my-project \
188188

189189
### Related Documentation
190190

191-
- [CLI Reference](/docs/cli) - Complete CLI command reference
192-
- [Admin API](/docs/admin-api) - API for project management
191+
- [CLI Reference](/docs/tools/cli) - Complete CLI command reference
192+
- [Admin API](/docs/tools/admin-api) - API for project management
193193
- [Architecture Patterns](/docs/advanced/architecture-patterns) - Document lifecycle patterns
194194
- [JS SDK - Document Events](/docs/js-sdk#documentsubscribesnapshot) - Handling snapshot events

docs/advanced/revisions.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Revisions are immutable snapshots of a document's state stored on the server. Ea
1313

1414
- **Label**: A user-friendly identifier (e.g., "v1.0", "Draft", "Final")
1515
- **Description**: Optional detailed explanation of what changed
16-
- **Snapshot**: The complete document state in [YSON](/docs/advanced/yson) format
16+
- **Snapshot**: The complete document state in [YSON](/docs/internals/yson) format
1717
- **Timestamp**: When the revision was created
1818
- **Server Sequence**: The document's server sequence number at creation time
1919

@@ -29,7 +29,7 @@ Revisions are immutable snapshots of a document's state stored on the server. Ea
2929

3030
This guide assumes familiarity with:
3131
1. [Client](/docs/js-sdk#client) and [Document](/docs/js-sdk#document) basics
32-
2. [YSON format](/docs/advanced/yson) for understanding snapshots
32+
2. [YSON format](/docs/internals/yson) for understanding snapshots
3333

3434
### How Revisions Work
3535

@@ -298,7 +298,7 @@ When enabled:
298298
- Labels follow the format: `snapshot-{serverSeq}`
299299
- Descriptions: `Auto created revision of snapshot #{serverSeq}`
300300

301-
Configure via the Dashboard or [Admin API](/docs/admin-api#post-yorkiev1adminserviceupdateproject). See [Resources](/docs/advanced/resources#autorevisionenabled) for details.
301+
Configure via the Dashboard or [Admin API](/docs/tools/admin-api#post-yorkiev1adminserviceupdateproject). See [Resources](/docs/advanced/resources#autorevisionenabled) for details.
302302

303303
### Best Practices
304304

@@ -341,6 +341,6 @@ Revision operations require appropriate document permissions:
341341
### Related Documentation
342342

343343
- [JS SDK - Document Revisions](/docs/js-sdk#document-revisions) - Complete API reference
344-
- [YSON](/docs/advanced/yson) - Understanding snapshot format
344+
- [YSON](/docs/internals/yson) - Understanding snapshot format
345345
- [Resources](/docs/advanced/resources) - Project configuration including auto-revisions
346346
- [CodePair](https://github.com/yorkie-team/codepair) - Reference implementation

docs/advanced/security.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ You can set up the Auth Webhook via the [Dashboard]({{DASHBOARD_PATH}}):
5555

5656
<Image alt="setting auth-webhook" src="/assets/images/docs/auth-webhook-dashboard.png" width={1300} height={840} style={{ maxWidth: '1000px' }} />
5757

58-
Alternatively, configure the webhook using the Yorkie CLI. See [Updating the Project](/docs/cli#updating-the-project) for details.
58+
Alternatively, configure the webhook using the Yorkie CLI. See [Updating the Project](/docs/tools/cli#updating-the-project) for details.
5959

6060
##### 2. Client Configuration
6161

0 commit comments

Comments
 (0)