Skip to content

waterbustech/waterbus-rs

Repository files navigation

Waterbus SFU

Waterbus

   

WebsiteWikiLicense

Waterbus is an open-source platform for building scalable, real-time conferencing systems using WebRTC. It enables low-latency streaming of video, audio, and data for applications like video chat, collaborative tools, and multiplayer experiences.

The server is written in Rust, using the native WebRTC.rs implementation to maximize performance, safety, and control over media flow.

Waterbus SFU Simulcast

✨ Features

  • 📚 Publish/Subscribe Media Tracks

    Flexible pub/sub model to let users publish and subscribe to video/audio streams dynamically.

  • 🎥 Simulcast with Bandwidth Awareness

    Uses simulcast to send multiple video layers per publisher. Waterbus leverages REMB (Receiver Estimated Maximum Bitrate) feedback to monitor subscriber bandwidth and forwards only the most suitable video quality for each participant.

  • 📈 Scalable by Design

    Optimized to scale horizontally, Waterbus supports thousands of concurrent users with efficient SFU architecture and Redis-based signaling.

  • 💬 Built-in Chat Messaging

    Integrated text messaging alongside media streams — perfect for chat, reactions, or control messages.

  • 🌍 Cross-Platform Compatibility

    Works across browsers, native apps using WebRTC standards.

📦 Requirements

This project uses the following technologies:

⚡️ Quick Start

Get up and running with Waterbus in just a few steps.

🗂️ Create db schema

  • Connect to your PostgreSQL database and run the schema file:
psql -h <postgres-host> -U <postgres-user> -d <database-name> -f schema.sql

🛠 Local Build

  • Start by cloning the Waterbus server repository:
git clone https://github.com/waterbustech/waterbus-rs.git 
cd waterbus-rs
  • Rename the example .env file to configure your local environment:
mv example.env .env
  • Build & Run the Server
cargo run --release

🐳 Run with Docker

If you prefer to use Docker:

  • Build the Docker image:
sudo docker build --platform=linux/amd64 -t <image-name> .
  • Run the container with necessary ports exposed:
sudo docker run --env-file .env -p 5998:5998 -p 5998:5998/udp -p 19200-19250:19200-19250/udp <image-name>

❓ Why We Migrated from NestJS to Rust

While NestJS served us well in the early stages, we encountered limitations when scaling up real-time media workloads:

  • Performance: Rust provides native-level speed, predictable memory management, and zero-cost abstractions — ideal for a real-time system.
  • Control: Media routing, simulcast, congestion control, and fine-grained memory management are all more accessible and performant in a systems language.
  • Safety: Rust’s ownership model ensures memory safety and eliminates entire classes of bugs (nulls, races, leaks).
  • Concurrency: Rust's async ecosystem (Tokio, etc.) is well-suited to handling thousands of concurrent connections with minimal overhead.

This migration enables us to build a high-performance WebRTC SFU, tailored exactly to our needs.

📡 How Does Waterbus SFU Simulcast Work?

Simulcast allows a publisher to send multiple versions of the same video stream at different resolutions and bitrates (e.g., 1080p, 720p, 360p).

Waterbus uses the following approach:

  1. Client Encodes Multiple Layers → Sender sends low, mid, and high-quality streams.
  2. REMB Feedback from Receiver → Each subscriber sends Receiver Estimated Maximum Bitrate (REMB) reports.
  3. Adaptive Stream Forwarding → The server uses REMB to dynamically forward the most suitable layer for each subscriber, ensuring the best quality without overloading their connection.

This provides a responsive, bandwidth-efficient experience, especially in group calls with diverse devices and network conditions.

💙 Show Your Support

If you like what we're building, consider showing your love by giving us a ⭐ on Github!

Also, follow maintainers on GitHub for our next creations!

🤝 Contribute to Waterbus

We welcome all contributions — big or small!

Whether it’s fixing a bug, suggesting a feature, or improving documentation, your input helps Waterbus grow.

Let’s build the future of real-time communication together 🚀

🔗 Useful Links

📜 License

Waterbus is open source under the Apache 2.0 License. Use it freely, fork it, build amazing things.

📬 Get in Touch

Got questions, feedback, or ideas? Reach out anytime at [email protected]

Made with 💙 by the Waterbus Team.

Languages