Introduction
AxonKit is a distributed real-time communication server built on mediasoup and NATS JetStream. It combines SFU media processing with intelligent cross-node stream routing, providing a scalable foundation for video conferencing, live streaming, and multi-modal AI applications.
Why AxonKit
Section titled “Why AxonKit”Traditional SFUs handle media well within a single node, but scaling beyond one machine — across regions or clusters — usually means either a bespoke mesh of forwarders or a full rewrite of the routing layer. AxonKit provides that routing layer out of the box:
- Single-node simplicity, multi-node scale. Run one node for local development, or a fleet of nodes that discover each other automatically.
- Smart media placement. Streams are routed where subscribers actually are, minimizing cross-region hops.
- A familiar client surface. The TypeScript SDK mirrors the LiveKit API, so teams can adopt it with minimal learning curve.
Core capabilities
Section titled “Core capabilities”Media & Signaling
Section titled “Media & Signaling”- mediasoup-based SFU — WebRTC media processing via mediasoup workers, with
WebRtcServerfor efficient port multiplexing. - DataChannel RPC — a custom text-based protocol (
AXON/1.0) over DataChannel for low-latency bidirectional signaling, inspired by the NATS wire protocol. - Auto-Subscribe — consumers are created paused, delivered to the client, then resumed, avoiding media loss.
- Dynacast — dynamically pauses video encodings with no subscribers, saving publisher CPU and bandwidth.
- AdaptiveStream — client-driven subscription optimization based on UI visibility and element size.
Distributed System
Section titled “Distributed System”- Intelligent Routing — RIB/FIB provide dynamic, low-latency stream routing across clusters and regions.
- Cluster & Region Aware — prioritizes local-cluster traffic and uses real-time RTT probing for cross-region path selection.
- Self-Healing — automatic failover with make-before-break path switching.
- Loop Detection — path-vector validation prevents routing loops.
- Node Discovery — nodes register and discover each other via NATS KV with no static configuration.
Client Management
Section titled “Client Management”- Reconnection — clients reconnect with
SyncStateto reconcile track differences seamlessly. - Node Forwarding — join/connect requests support
nodeIdfor cross-node proxying via NATS. - Heartbeat — DataChannel ping/pong for accurate participant liveness.
- Token Refresh — token renewal over DataChannel avoids reconnection on expiry.
Where to go next
Section titled “Where to go next”- Quick Start — run the server and connect a client.
- Architecture — understand the routing model.
- Protocol — dig into the wire format.