If you want to update this page or add new content, please submit a pull request to the Homepage.

CLI

CLI is a command-line interface for Yorkie. You can use the CLI to manage your projects, documents, or start the server.

Getting started

There are two ways to install the CLI: pre-built binaries and Homebrew.

Install pre-built binaries

The easiest way to install Yorkie is from pre-built binaries:

  1. Download the compressed archive file for your platform from Releases.
  2. Unpack the archive file. This results in a directory containing the binaries.
  3. Add the executable binaries to your PATH. For example, rename and/or move the binaries to a directory in your PATH (like /usr/local/bin), or add the directory created from the previous step to your PATH.
  4. Test if Yorkie is in your PATH in shell:
$ yorkie version --client
Yorkie Client: 0.7.26
Go: ...
Build Date: ...

Install via Homebrew

Homebrew is a free and open-source package management system for Mac OS X. Install the official Yorkie formula in Terminal.

To update Yorkie to the latest version, update Homebrew first.

$ brew update

Now, install Yorkie.

$ brew install yorkie

Verify that the installation worked by opening a new Terminal session and trying Yorkie's available subcommands.

$ yorkie version --client
Yorkie Client: 0.7.26
Go: ...
Build Date: ...

Commands

Yorkie is a single command-line application yorkie that takes a subcommand such as server.

The Yorkie CLI is a well-behaved command-line application. In erroneous cases, a non-zero exit status is returned. It also responds to -h and --help as you would expect.

To get help for any specific command, pass the -h flag to the relevant subcommand. For example, to see help about the server subcommand:

$ yorkie server --help
Start Yorkie server
Usage:
yorkie server [options] [flags]
Flags:
--auth-github-auth-url string GitHub OAuth2 authorization URL (default "https://github.com/login/oauth/authorize")
--auth-github-callback-redirect-url string GitHub OAuth callback redirect URL (default "http://localhost:5173/dashboard")
--auth-github-client-id string GitHub OAuth Client ID
--auth-github-client-secret string GitHub OAuth Client Secret. If empty, it is read from YORKIE_AUTH_GITHUB_CLIENT_SECRET, which keeps it off the command line.
--auth-github-device-auth-url string GitHub OAuth2 device authorization URL (default "https://github.com/login/device/code")
--auth-github-redirect-url string GitHub OAuth callback URL (default "http://localhost:8080/auth/github/callback")
--auth-github-token-url string GitHub OAuth2 token URL (default "https://github.com/login/oauth/access_token")
--auth-github-user-url string GitHub User API URL (default "https://api.github.com/user")
--auth-webhook-cache-auth-ttl duration TTL value to set when caching authorization webhook response. Must be at least 100ms. (default 10s)
--auth-webhook-cache-disabled Disable the authorization webhook response cache server-wide. Every protected RPC then calls the webhook.
--auth-webhook-cache-size int The cache size of the authorization webhook. (default 5000)
--backend-admin-password string The password of the default admin. (default "admin")
--backend-admin-token-duration duration The duration of the admin authentication token. (default 168h0m0s)
--backend-admin-user string The name of the default admin user, who has full permissions. (default "admin")
--backend-enable-webhook-validation Whether to enable webhook URL validation to prevent SSRF attacks.
--backend-gateway-addr string Gateway address (default "localhost:8080")
--backend-rpc-addr string Backend RPC address (default "localhost:8080")
--backend-secret-key string The secret key for signing authentication tokens for admin users. If empty, it is read from YORKIE_BACKEND_SECRET_KEY, which keeps it off the command line; if that is unset too, a random key is generated at startup, so tokens do not survive a restart. Set the same key on every node of a cluster, at least 32 characters. Given but blank, it is an error; a blank SecretKey in a config file means unset.
--backend-snapshot-disable-gc Whether to disable garbage collection of snapshots.
--backend-use-default-project Whether to use the default project. Even if public key is not provided from the client, the default project will be used for the request. (default true)
--backend-watch-heartbeat-interval-max duration The longest heartbeat interval the server will serve on an idle Watch stream. 0 turns the heartbeat off server-wide, whatever clients ask for. (default 1m0s)
--backend-watch-heartbeat-interval-min duration The shortest heartbeat interval the server will serve on an idle Watch stream. A client asking for less is clamped up to this. (default 5s)
--channel-session-cleanup-interval duration The interval for running cleanup of expired channel sessions. (default 10s)
--channel-session-count-cache-size int The cache size of the channel session count. (default 10000)
--channel-session-count-cache-ttl duration The TTL value for channel session count cache. Must be at least 100ms. (default 30s)
--channel-session-ttl duration The TTL value for channel sessions. (default 15s)
--cluster-client-pool-size int The number of connections per host in the cluster client pool. (default 1)
--cluster-client-timeout duration The hard limit for the entire HTTP request lifecycle of cluster communication. (default 30s)
--cluster-rpc-timeout duration The timeout for individual cluster RPC calls. (default 10s)
--cluster-secret string The shared secret for authenticating cluster RPC calls. If empty, it is read from YORKIE_CLUSTER_SECRET, which keeps it off the command line; if that is unset too, all requests are allowed, so set one in production.
-c, --config string Config path
-h, --help help for server
--hostname string Yorkie Server Hostname
--housekeeping-candidates-limit int candidates limit for a single housekeeping run (default 2000)
--housekeeping-compaction-min-changes int minimum number of changes to compact a document for housekeeping run (default 1000)
--housekeeping-deactivate-concurrency int max concurrent client deactivations within a single housekeeping cycle (0 or 1 = sequential) (default 8)
--housekeeping-interval duration housekeeping interval between housekeeping runs (default 30s)
--housekeeping-project-stats-refresh-interval duration Project-stats refresh interval. Set to "0s" to disable the project-stats refresh task. (default 5m0s)
--kafka-addresses string Comma-separated list of Kafka addresses (e.g., localhost:9092,localhost:9093)
--kafka-channel-events-topic string Kafka topic name to publish channel events (default "channel-events")
--kafka-client-events-topic string Kafka topic name to publish client events (default "client-events")
--kafka-document-events-topic string Kafka topic name to publish document events (default "document-events")
--kafka-session-events-topic string Kafka topic name to publish session events (default "session-events")
--kafka-user-events-topic string Kafka topic name to publish user events (default "user-events")
--kafka-write-timeout duration Timeout for writing messages to Kafka (default 5s)
-l, --log-level string Log level: debug, info, warn, error, panic, fatal (default "info")
--max-concurrent-cluster-rpcs int The maximum number of concurrent cluster RPC calls across the server. (default 5000)
--mongo-cache-stats-enabled Enable MongoDB cache statistics logging
--mongo-cache-stats-interval duration Interval for logging MongoDB cache statistics (e.g. '30s', '1m') (default 30s)
--mongo-change-cache-size int MongoDB change cache size (default 10000)
--mongo-client-cache-size int MongoDB client cache size (default 10000)
--mongo-connection-timeout duration Mongo DB's connection timeout (default 5s)
--mongo-connection-uri string MongoDB's connection URI. If empty, it is read from YORKIE_MONGO_CONNECTION_URI, which keeps the database password off the command line.
--mongo-doc-cache-size int MongoDB document cache size (default 10000)
--mongo-monitoring-enabled Enable MongoDB query monitoring
--mongo-monitoring-slow-query-threshold string Threshold for logging slow MongoDB queries (e.g. '100ms', '1s') (default "100ms")
--mongo-ping-timeout duration Mongo DB's ping timeout (default 5s)
--mongo-project-cache-size int MongoDB project cache size (default 256)
--mongo-project-cache-ttl duration TTL for MongoDB project cache (e.g. '5m', '60s'). Must be at least 100ms. (default 10m0s)
--mongo-vector-cache-size int MongoDB version vector cache size (default 10000)
--mongo-yorkie-database string Yorkie's database name in MongoDB (default "yorkie-meta")
--pprof-enabled Enable runtime profiling data via HTTP server.
--presence-base-cache-size int The number of (document, client) presences kept to fold presence patches. (default 10000)
--profiling-port int Profiling port (default 8081)
--rpc-cert-file string RPC certification file's path
--rpc-idle-timeout duration Maximum duration to wait for the next request on idle keep-alive connections. Should exceed the idle timeout of any fronting load balancer. (default 2m0s)
--rpc-key-file string RPC key file's path
--rpc-port int RPC port (default 8080)
--rpc-read-header-timeout duration Maximum duration for reading request headers (Slowloris protection) (default 5s)
--snapshot-cache-size int The cache size of the snapshots. (default 1000)
--starrocks-dsn string StarRocks DSN for the analytics
--starrocks-summary-enabled Serve project-stats history from the decoupled daily HLL summary tables (dual read). Enable only after the summary tables are backfilled and validated.
Global Flags:
-o, --output string One of 'yaml' or 'json'.
--rpc-addr string Address of the rpc server (default "localhost:8080")

--backend-secret-key has no default. The key is taken from the flag or the config file, then from the YORKIE_BACKEND_SECRET_KEY environment variable. If neither is set, the server generates a random key for the process and logs an error: admin login tokens then stop working after a restart, and other server instances reject them. The server refuses to start if the flag or the environment variable is set but blank, or if the key is the old default yorkie-secret or shorter than 32 characters. An empty SecretKey in a config file counts as unset. When you run more than one server instance, set the same key on all of them, for example one generated with openssl rand -base64 32.

Signup

Sign up for a new account using the signup command.

$ yorkie signup -u <username> --rpc-addr api.yorkie.dev:443
Enter Password:

Login

To use admin commands, you must log in to the server. Log in using the login subcommand:

$ yorkie login -u <username> --rpc-addr api.yorkie.dev:443
Enter Password:

The account is the same as the account you use to log in to the Dashboard. If you don't have an account, you can create one by signing up at Dashboard.

If you are using the self-hosted server, default username and password are admin and admin. You can log in to the server using $ yorkie login -u admin -p admin --insecure. Or: $ yorkie login -u admin --insecure.

Once you log in to the server, the CLI stores the access token in the ~/.yorkie/config.json file. Check the context of the CLI using the context subcommand:

$ yorkie context ls
CURRENT RPC ADDR INSECURE TOKEN
api.yorkie.dev:443 false eyJhbGciOi...DuhaUgofYg
* localhost:8080 true eyJhbGciOi...FUT3js73Mw

Logout

To log out from the server, use the logout subcommand:

$ yorkie logout
$ yorkie context ls
CURRENT RPC ADDR INSECURE TOKEN
* api.yorkie.dev:443 false eyJhbGciOi...DuhaUgofYg

Change Password

To change your password, use the passwd command.

$ yorkie passwd -u <username> --rpc-addr api.yorkie.dev:443
Enter Password:
Enter New Password:

Delete Account

To delete your account, use the delete-account command.

$ yorkie delete-account -u <username> --rpc-addr api.yorkie.dev:443
Enter Password:
Warning: This action cannot be undone. Type 'DELETE' to confirm:

This command deletes your account and all data associated with it. Use this command with caution.

Project

A Project represents your service or application in Yorkie. Multiple projects can exist within a single application. You can add more projects as needed, for example, to manage auth webhooks and documents for specific purposes.

To manage projects, use the project subcommand:

$ yorkie project
Manage projects
Usage:
yorkie project [command]
Available Commands:
create Create a new project
ls List all projects
update Update a project
Flags:
-h, --help help for project
Global Flags:
-o, --output string One of 'yaml' or 'json'.
--rpc-addr string Address of the rpc server (default "localhost:8080")
Use "yorkie project [command] --help" for more information about a command.

Listing Projects

List projects on the server using ls.

$ yorkie project ls
NAME PUBLIC KEY SECRET KEY CREATED AT
default fUYWjA2SmLrpxvt9hvix62 Qxp5jZeuH45bDmjYLDfZJb 15 minutes

Use the --verbose (-v) flag to show more project settings, such as the auth webhook, event webhook, snapshot and attachment settings. The table does not include every setting (allowed origins, for example); use --output json or --output yaml to see all of them.

The server creates a default project automatically. If you create a Client without an apiKey, the Client is created in the default project.

Creating a Project

Create a new project with a name using create.

$ yorkie project create test-project
{"id":"6ac32edca4736914b08f6be3","name":"test-project","owner":"","auth_webhook_url":"","auth_webhook_methods":null,"AuthWebhookMaxRetries":10,"AuthWebhookMinWaitInterval":"100ms","AuthWebhookMaxWaitInterval":"3s","AuthWebhookRequestTimeout":"3s","event_webhook_url":"","event_webhook_events":null,"EventWebhookMaxRetries":10,"EventWebhookMinWaitInterval":"100ms","EventWebhookMaxWaitInterval":"3s","EventWebhookRequestTimeout":"3s","ClientDeactivateThreshold":"24h0m0s","ChannelSessionTTL":"15s","SnapshotThreshold":500,"SnapshotInterval":500,"MaxSubscribersPerDocument":0,"MaxAttachmentsPerDocument":0,"MaxSizePerDocument":10485760,"remove_on_detach":false,"auto_revision_enabled":true,"allowed_origins":null,"public_key":"KMtw3F2MhLRQyYzHfryUpA","secret_key":"MmQRTFYFKckaeJBUkcUkpS","created_at":"2026-10-05T05:00:12.110212Z","updated_at":"2026-10-05T05:00:12.110212Z"}

If you create a Client with the project's public_key as the apiKey, you can manage the Client in the project.

1const client = new yorkie.Client({
2 rpcAddr: 'https://api.yorkie.dev',
3 apiKey: 'KMtw3F2MhLRQyYzHfryUpA', // public_key of the project
4});

Documents attached to the Client are then isolated and stored in the project.

Updating the Project

Update the project on the server using update.

Usage:
yorkie project update [name] [flags]
Examples:
yorkie project update name [options]
Flags:
--auth-webhook-max-retries uint Maximum number of retries for authorization webhook. (default 10)
--auth-webhook-max-wait-interval duration Maximum wait interval between retries(exponential backoff). (default 3s)
--auth-webhook-method-add stringArray authorization-webhook methods to add ('ALL' for all methods)
--auth-webhook-method-rm stringArray authorization-webhook methods to remove ('ALL' for all methods)
--auth-webhook-min-wait-interval duration Minimum wait interval between retries(exponential backoff). (default 100ms)
--auth-webhook-request-timeout duration Timeout for each authorization webhook request. (default 3s)
--auth-webhook-url string authorization-webhook update url
--channel-session-ttl duration Channel session TTL (must be between 1s and 5m) (default 15s)
--client-deactivate-threshold duration client deactivate threshold for housekeeping (default 24h0m0s)
--event-webhook-events-add stringArray event-webhook events to add ('ALL' for all events)
--event-webhook-events-rm stringArray event-webhook events to remove ('ALL' for all events)
--event-webhook-max-retries uint Maximum number of retries for event webhook. (default 10)
--event-webhook-max-wait-interval duration Maximum wait interval between retries(exponential backoff). (default 3s)
--event-webhook-min-wait-interval duration Minimum wait interval between retries(exponential backoff). (default 100ms)
--event-webhook-request-timeout duration Timeout for each event webhook request. (default 3s)
--event-webhook-url string event-webhook update url
-h, --help help for update
--max-attachments-per-document int max attachments per document
--max-subscribers-per-document int max subscribers per document
--name string new project name
--remove-on-detach remove on detach
--snapshot-interval int Interval of changes to create a snapshot. (default 500)
--snapshot-threshold int Threshold that determines if changes should be sent with snapshot when the number of changes is greater than this value. (default 500)
Global Flags:
-o, --output string One of 'yaml' or 'json'.
--rpc-addr string Address of the rpc server (default "localhost:8080")

Only the options you pass are changed; every other setting keeps its current value. Running update without any option fails with nothing to update: pass at least one option.

Update the name of the project with the --name flag.

$ yorkie project update test-project --name new-test-project
{"id":"6ac32edca4736914b08f6be3","name":"new-test-project","owner":"","auth_webhook_url":"","auth_webhook_methods":null,"AuthWebhookMaxRetries":10,"AuthWebhookMinWaitInterval":"100ms","AuthWebhookMaxWaitInterval":"3s","AuthWebhookRequestTimeout":"3s","event_webhook_url":"","event_webhook_events":null,"EventWebhookMaxRetries":10,"EventWebhookMinWaitInterval":"100ms","EventWebhookMaxWaitInterval":"3s","EventWebhookRequestTimeout":"3s","ClientDeactivateThreshold":"24h0m0s","ChannelSessionTTL":"15s","SnapshotThreshold":500,"SnapshotInterval":500,"MaxSubscribersPerDocument":0,"MaxAttachmentsPerDocument":0,"MaxSizePerDocument":10485760,"remove_on_detach":false,"auto_revision_enabled":true,"allowed_origins":null,"public_key":"KMtw3F2MhLRQyYzHfryUpA","secret_key":"MmQRTFYFKckaeJBUkcUkpS","created_at":"2026-10-05T05:00:12.110212Z","updated_at":"2026-10-05T05:00:12.145846Z"}

Configure the project's Auth Webhook URL using the --auth-webhook-url flag.

$ yorkie project update [name] --auth-webhook-url http://localhost:3000/auth-webhook

Add or remove webhook methods using the --auth-webhook-method-add and --auth-webhook-method-rm flags. When updating methods, remove operations are processed before add operations. The ALL keyword stands for every method the server can authorize: ActivateClient, DeactivateClient, AttachDocument, DetachDocument, RemoveDocument, PushPull, Watch, CreateRevision, GetRevision, ListRevisions, RestoreRevision, AttachChannel, DetachChannel, RefreshChannel, PeekChannel and Broadcast. It leaves out the deprecated WatchDocument and WatchChannel, which Watch already covers. With --auth-webhook-method-rm, ALL removes every method, deprecated ones included.

Here are some examples of managing webhook methods:

# Add a single method
$ yorkie project update [name] --auth-webhook-method-add PushPull
# Remove a method
$ yorkie project update [name] --auth-webhook-method-rm PushPull
# Add all webhook methods using ALL keyword
$ yorkie project update [name] --auth-webhook-method-add ALL
# Remove all webhook methods using ALL keyword
$ yorkie project update [name] --auth-webhook-method-rm ALL
# Add multiple specific methods
$ yorkie project update [name] \
--auth-webhook-method-add ActivateClient \
--auth-webhook-method-add PushPull \
--auth-webhook-method-add Watch

For more details on how Auth Webhook works, please refer to the auth-webhook.

Document

A Document is a data structure that can be synchronized between multiple clients. Use document commands to manage documents in the project.

$ yorkie document
Manage documents
Usage:
yorkie document [command]
Available Commands:
create Create a new document
ls List all documents in the project
remove Remove documents in the project
update Update a document
Flags:
-h, --help help for document
Global Flags:
-o, --output string One of 'yaml' or 'json'.
--rpc-addr string Address of the rpc server (default "localhost:8080")
Use "yorkie document [command] --help" for more information about a command.

Listing Documents

List documents in the project using ls.

Usage:
yorkie document ls [project name] [flags]
Flags:
--forward Whether to search forward or backward
-h, --help help for ls
--previous-id string The previous document ID to start from
--size int32 The number of document to output per page (default 10)
$ yorkie document ls test-project
ID KEY CLIENTS CREATED AT ACCESSED AT UPDATED AT SNAPSHOT
6482cea1c38d5a06529bbaa7 test-document-5 0 ... ... ... ...
6482cea0c38d5a06529bba96 test-document-4 0 ... ... ... ...
6482ce9fc38d5a06529bba85 test-document-3 0 ... ... ... ...
6482ce9dc38d5a06529bba69 test-document-2 0 ... ... ... ...
6482ce97c38d5a06529bba1b test-document-1 0 ... ... ... ...

Several flags control the output of the command, allowing you to paginate the output.

Use the --size flag to limit the number of documents to output per page.

$ yorkie document ls default --size 1
ID KEY CLIENTS CREATED AT ACCESSED AT UPDATED AT SNAPSHOT
6482cea1c38d5a06529bbaa7 test-document-5 0 ... ... ... ...

Use the --previous-id flag to start after a specific document.

$ yorkie document ls default --previous-id 6482ce9fc38d5a06529bba85
ID KEY CLIENTS CREATED AT ACCESSED AT UPDATED AT SNAPSHOT
6482ce9dc38d5a06529bba69 test-document-2 0 ... ... ... ...
6482ce97c38d5a06529bba1b test-document-1 0 ... ... ... ...

Use the --forward flag to search forward or backward.

$ yorkie document ls default --forward
ID KEY CLIENTS CREATED AT ACCESSED AT UPDATED AT SNAPSHOT
6482ce97c38d5a06529bba1b test-document-1 0 ... ... ... ...
6482ce9dc38d5a06529bba69 test-document-2 0 ... ... ... ...
6482ce9fc38d5a06529bba85 test-document-3 0 ... ... ... ...
6482cea0c38d5a06529bba96 test-document-4 0 ... ... ... ...
6482cea1c38d5a06529bbaa7 test-document-5 0 ... ... ... ...

Creating a Document

Create a new document using create.

Usage:
yorkie document create [project name] [document key] [flags]
Flags:
-h, --help help for create
--initial-root string (optional) YSON string representing the initial root of the document
$ yorkie document create test-project test-document
Document created: test-document (686e2aa9666f9626c2d62cb4)

Updating a Document

Update the root of an existing document using the update subcommand.

Usage:
yorkie document update [project name] [document key] [flags]
Flags:
-h, --help help for update
--root string (required) YSON string representing the new root of the document
$ yorkie document update test-project test-document --root '{"abs": true}'
Document updated: test-document (686e2aa9666f9626c2d62cb4)

Removing a Document

Remove a document from the project using remove.

Usage:
yorkie document remove [project name] [document key] [flags]
Examples:
yorkie document remove sample-project sample-document [options]
Flags:
--force force remove document even if it is attached to clients
-h, --help help for remove
$ yorkie document remove test-project test-document-1

Client Deactivate Threshold

Client Deactivate Threshold is a time duration that determines when clients are deactivated for documents in projects. Deactivating the client and detaching it from documents improves the efficiency of garbage collection removing CRDT tombstones. For more information about GC, see Garbage Collection.

Set the client deactivate threshold of the project with the --client-deactivate-threshold flag.

$ yorkie project update test-project --client-deactivate-threshold 1h30m20s
{"id":"6ac32edca4736914b08f6be3","name":"test-project","owner":"","auth_webhook_url":"","auth_webhook_methods":null,"AuthWebhookMaxRetries":10,"AuthWebhookMinWaitInterval":"100ms","AuthWebhookMaxWaitInterval":"3s","AuthWebhookRequestTimeout":"3s","event_webhook_url":"","event_webhook_events":null,"EventWebhookMaxRetries":10,"EventWebhookMinWaitInterval":"100ms","EventWebhookMaxWaitInterval":"3s","EventWebhookRequestTimeout":"3s","ClientDeactivateThreshold":"1h30m20s","ChannelSessionTTL":"15s","SnapshotThreshold":500,"SnapshotInterval":500,"MaxSubscribersPerDocument":0,"MaxAttachmentsPerDocument":0,"MaxSizePerDocument":10485760,"remove_on_detach":false,"auto_revision_enabled":true,"allowed_origins":null,"public_key":"KMtw3F2MhLRQyYzHfryUpA","secret_key":"MmQRTFYFKckaeJBUkcUkpS","created_at":"2026-10-05T05:00:12.110212Z","updated_at":"2026-10-05T05:00:12.199159Z"}

Setting the client deactivation threshold to 1h30m20s deactivates clients that have been inactive for 1 hour, 30 minutes, and 20 seconds but remained activated. This helps document GC by not counting the deactivated client's document sequence.

Channel Session TTL

Channel Session TTL is a per-project duration that controls how long a presence channel session is retained on the server after its last refresh. Raising the value keeps users counted in the live presence count longer after they leave — useful for small rooms where the live count would otherwise feel volatile. The value must be between 1s and 5m; the default is 15s.

Set the channel session TTL of the project with the --channel-session-ttl flag.

$ yorkie project update test-project --channel-session-ttl 1m

Values outside the [1s, 5m] range are rejected by the admin API. Lowering the TTL increases refresh traffic from active clients linearly (the SDK heartbeat targets TTL/3).