Development Notes
This guide covers setting up and working with the vuer-rtc-workspace monorepo.
The reference server implementation uses MongoDB's change streams to provide real-time updates to connected clients. This feature requires setting up a replica set (the minimum requirement is 1 node a.k.a. zero replica).
I have automated this with mprocs for the orchestration, and docker compose
for the database.
Packages
| Package | Description |
|---|---|
@vuer-ai/vuer-rtc | Core CRDT operations and client state management |
@vuer-ai/vuer-rtc-server | MongoDB + Fastify server |
@vuer-ai/rtc-docs | Documentation site |
Quick Start
Get up and running in three simple steps. The dev environment spins up a MongoDB replica set (single node) and Redis via Docker, so you don't have to configure anything.
-
Clone and install dependencies:
-
Start the full dev environment (Docker, server, and docs):
-
Run tests in a separate terminal:
Development Commands
Docker Makefile
More granular control via make -C docker <target>:
Database Schema
MongoDB with replica set (required for Change Streams):
- Connection:
mongodb://localhost:27017/vuer-rtc?replicaSet=rs0 - Schema managed by Prisma (
packages/vuer-rtc-server/prisma/schema.prisma)
Redis for pub/sub and caching:
- Connection:
redis://localhost:6379
Collections
| Collection | Purpose |
|---|---|
| Document | Scene metadata + currentState (schema-free JSON snapshot) |
| Operation | Individual CRDT operations with vector clocks for replay |
| JournalBatch | Batched write-ahead log (33ms Figma-style batching) |
| Session | Client connections, presence, and clock state |
Key design choices:
Document.currentStateis schema-free JSON - no fixed transform/properties fields- Operations specify their own merge behavior via
ot(e.g.,number.add,vector3.set) - JournalBatch enables 33ms batching for write reliability (Figma's approach)