Real-Time Collaboration
Google Docs-style multi-user editing, live presence avatars and cursors, server-enforced read-only roles, and live AI agent sync over WebSockets.
Multiple team members can open and edit the same entry or singleton at the same time in the OvertCMS Admin UI—with live avatars, named text cursors, and instant synchronization across rich text and structured fields.
Everything runs inside the single Go binary (overt-cms-core) over standard WebSockets with zero external collaboration servers required.
How It Works#
- Presence & live cursors: When you open an entry or singleton, the Admin UI opens a dedicated WebSocket room for that document. Every active teammate appears in the top presence bar with their name, avatar, role, and a color-coded cursor inside the rich text editor.
- Conflict-free concurrent edits (Yjs CRDT): Simultaneous edits in rich text (
rich_html) and structured fields merge cleanly in real time without clobbering each other's keystrokes. - Explicit save & publishing: Live collaboration syncs your in-progress draft session across open browsers, while database persistence, version snapshots, and publishing still happen explicitly when someone clicks Save Draft or Publish—preserving optimistic locking (
ETag/version) and clean version history. - Live sync when an AI agent or teammate saves: Whenever an entry is saved, published, unpublished, or restored from any source (another browser, an AI agent over REST, or an MCP tool), the server broadcasts an
entry.savedevent to every connected editor in that room so everyone stays in sync without stale conflicts.
Security & Role Enforcement#
Collaboration rooms enforce the exact same RBAC rules as the rest of the Admin Plane:
- Single-use WebSocket tickets: Before upgrading to WebSockets, the browser calls
POST .../collab-tokenusing its authenticated Admin session to receive a short-lived, single-use ticket scoped to that exact(siteId, entryId)pair. - Origin & CSRF protection: Cross-site WebSocket handshakes (
Sec-Fetch-Site: cross-site) and disallowedOriginheaders are rejected before the connection upgrades or consumes a ticket. - Server-enforced read-only mode: Users with the
viewerrole—orwriterusers viewing another author's entry—connect withcanEdit: false. They can see live presence and watch edits in real time, while the server drops any incoming document mutations from read-only sockets. - Instant ghost-cursor cleanup: When a user closes their tab or loses connection, the server immediately clears their awareness/cursor state so stale cursors never linger.
Collaboration Endpoints#
All collaboration endpoints live on the Admin Plane (/admin-api/v1/*) and require a human Admin session (API keys are never allowed).
Collection Entries#
| Method | Path | Purpose |
|---|---|---|
POST |
/admin-api/v1/sites/{siteSlug}/collections/{postType}/entries/{id}/collab-token |
Mint a single-use WebSocket ticket (ticket, expiresAt, canEdit, wsPath). |
GET |
/admin-api/v1/sites/{siteSlug}/collections/{postType}/entries/{id}/collab?ticket=... |
Upgrade to the Yjs binary + JSON presence WebSocket room. |
GET |
/admin-api/v1/sites/{siteSlug}/collections/{postType}/entries/{id}/presence |
List users currently connected to this entry (used by list views and editor headers). |
Singletons#
| Method | Path | Purpose |
|---|---|---|
POST |
/admin-api/v1/sites/{siteSlug}/singletons/{slug}/collab-token |
Mint a single-use WebSocket ticket for a singleton. |
GET |
/admin-api/v1/sites/{siteSlug}/singletons/{slug}/collab?ticket=... |
Upgrade to the singleton's real-time WebSocket room. |
GET |
/admin-api/v1/sites/{siteSlug}/singletons/{slug}/presence |
List users currently viewing or editing the singleton. |
Reverse Proxy Setup (Nginx / Caddy / Cloudflare)#
When running behind a reverse proxy in production, make sure WebSocket upgrades (Upgrade and Connection headers) are forwarded on /admin-api/v1/*:
location /admin-api/ {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 3600s;
}