Server setup
This guide shows how to runnodalmerge-server, choose durability/auth posture, and verify the instance is healthy before clients depend on it.
Before you start
Make sure you can provide:- A reachable bind address/port for WebSocket traffic
- A persistence path (for durable environments)
- Basic observability endpoint strategy (metrics/logs)
- Authentication/token strategy for locked rooms (if required)
Quick start (native)
From thenodalmerge repo root:
ws://127.0.0.1:7878/ws/<room> unless AS_BIND_ADDR is set.
Quick start (container)
Durability choice
In-memory mode
No--store flag means volatile in-memory operation.
Use for:
- Local dev
- Short-lived demos
- Ephemeral test runs
Durable mode
Set--store <path> to enable persistent server storage.
Durable mode enables:
- Room/node/blob recovery across restarts
- Safe idle-room eviction behavior
- Blob GC on persisted blob data
Recommended startup flags
Start with these explicit flags in non-trivial environments:--store <path>for durability--metrics-addr <ip:port>for Prometheus scraping--idle-timeout <seconds>to reclaim inactive rooms safely--broadcast-capacity <N>for room broadcast buffer sizing--peer-rate-nodes <N>and--peer-rate-bytes <MiB>for ingress abuse protection--blob-gc-interval <seconds>and--blob-gc-grace <seconds>for blob lifecycle automation
Bind and network configuration
Server bind address is controlled byAS_BIND_ADDR.
Example:
wss://.
Auth posture options
NodalMerge supports open and locked room patterns.- Open rooms: no room token required
- Locked rooms: token/capability validation required at handshake
Embedding the host as a library
The standalonenodalmerge-server binary above is one deployment shape. If you’re
embedding NodalMerge inside your own web application instead of running it as a
separate process, use one of the embeddable host libraries:
- .NET — the
NodalMerge.DotNetHostNuGet package exposesMapNodalMergeEndpoints(), an ASP.NET Core extension method you call on your ownWebApplication. You ownProgram.csand the full request pipeline. - Rust — the
nodalmerge-host-axumcrate exposesbuild_router(rooms), which returns anaxum::Routeryou compose into your own application, alongsidebuild_router_with_permissive_cors(rooms)as an explicit dev-only convenience.
Configuring CORS when embedding
.NET (NodalMerge.DotNetHost):
nodalmerge-host-axum):
build_router_with_permissive_cors() outside local development —
it allows any origin and should never front internet-exposed production traffic.
Health and verification checklist
After startup, verify:- Server logs show listening endpoint
- WebSocket upgrade succeeds at
/ws/<room> - Metrics endpoint responds when enabled (
/metrics) - A test client can connect, sync, and exchange packs
- Restart preserves expected state when
--storeis enabled
Common setup mistakes
- Running production traffic without
--store - Enabling lifecycle knobs in in-memory mode and expecting durability effects
- Shipping without ingress rate limits
- Treating direct blob I/O as required (it is an optimization path)
- Skipping startup verification after changing bind/auth settings
Minimal production baseline
Use this as a starting template:- Durable storage enabled (
--store) - Metrics enabled and scraped
- Rate limits set and monitored
- Idle-room eviction enabled with conservative timeout
- Blob GC enabled with non-zero grace
- Locked-room/token strategy documented and tested