Conflux is a modular, actor-based real-time collaboration engine written in Rust. It provides room-based CRDT synchronization, presence/awareness broadcasting, and text chat — all over WebSockets with JWT authentication.
It’s designed as the backend core for collaborative editors, shared boards, or multiplayer apps where multiple users edit or interact in real time.
room, room_manager, auth, and server ┌────────────────────────────────────────┐
│ Client A │
│ WebSocket → send text / CRDT / cursor │
└────────────────────────────────────────┘
▲
│ ws://127.0.0.1:8080/ws/:room?token=<JWT>
▼
┌────────────────────────────────────────┐
│ Conflux │
│ Axum server + Room Manager + CRDT Core │
│ ├── auth.rs → JWT validation │
│ ├── room.rs → per-room actor │
│ ├── room_manager.rs → cleanup, metrics │
│ ├── server.rs → WebSocket routing │
│ └── crdt.rs → Yrs document API │
└────────────────────────────────────────┘
conflux-workspace/
├── conflux/ # Core backend library
│ ├── src/
│ │ ├── auth.rs
│ │ ├── crdt.rs
│ │ ├── errors.rs
│ │ ├── room.rs
│ │ ├── room_manager.rs
│ │ ├── server.rs
│ │ └── lib.rs
│ └── Cargo.toml
│
├── confluxd/ # Binary executable
│ ├── src/main.rs
│ └── Cargo.toml
│
├── frontend/ # Optional Y.js client (future)
│ └── index.html
│
└── README.md
POST /loginAuthenticate and receive a JWT token.
Request
{ "username": "kaylee" }
Response
{ "token": "<JWT_TOKEN>" }
Each login creates a new session with a unique session ID (sid).
GET /dashboardReturns all active rooms and their current state.
Response
[
{
"document_id": "testroom",
"clients": 2,
"updates": 14,
"awareness_events": 5
}
]
GET /ws/:document_id?token=<JWT>Connect to a collaborative room via WebSocket.
Example:
websocat "ws://127.0.0.1:8080/ws/testroom?token=<JWT>"
You can send three kinds of messages to the server:
{ "type": "chat", "message": "Hello everyone" }
→ Broadcasts to all clients in the same room:
{
"Chat": {
"document_id": "testroom",
"from": "kaylee",
"message": "Hello everyone"
}
}
{ "type": "awareness", "data": { "cursor": 42 } }
→ Notifies all connected clients about your cursor or user state.
{ "type": "update", "data": "<base64_encoded_update>" }
→ The CRDT engine merges the update into the shared document using Yrs.
{ "type": "sync_request" }
→ Requests the latest document state from the server if the client missed updates.
cargo run -p confluxd
Usage: confluxd [OPTIONS]
Options:
-p, --port <PORT> Port to listen on [default: 8080]
--host <HOST> Host address to bind to [default: 127.0.0.1]
--anonymous Enable anonymous authentication (no signature verification)
--idle-timeout <IDLE_TIMEOUT> Room idle timeout in seconds [default: 60]
-h, --help Print help
# Default (localhost:8080)
cargo run -p confluxd
# Custom port and host
cargo run -p confluxd -- --port 3000 --host 0.0.0.0
# Anonymous mode (clients can generate their own JWTs)
cargo run -p confluxd -- --anonymous
# Production with custom settings
CONFLUX_JWT_SECRET=your-secret-here cargo run -p confluxd --release -- --port 8080 --host 0.0.0.0
Output:
INFO confluxd: Conflux server running at ws://127.0.0.1:8080
bash
cargo run -p confluxd
bash
curl -X POST http://127.0.0.1:8080/login \
-H "Content-Type: application/json" \
-d '{"username":"kaylee"}'
bash
websocat "ws://127.0.0.1:8080/ws/testroom?token=<JWT>"
{"type": "chat", "message": "hi from client 1"}
{"type": "awareness", "data": {"cursor": 101}}
{"type": "sync_request"}
| Variable | Required | Description |
|---|---|---|
CONFLUX_JWT_SECRET |
Yes (production) | Secret key for signing/verifying JWTs. Required in release builds. |
In debug builds, a default development secret is used if CONFLUX_JWT_SECRET is not set (with a warning).
sid)CONFLUX_JWT_SECRETCONFLUX_JWT_SECRET is not set--anonymous) skips signature verification - use only for development/demosMIT License Copyright (c) 2025 Kaylee
$ claude mcp add conflux \
-- python -m otcore.mcp_server <graph>