Hi everyone! ![]()
I’ve been working on a NestJS integration module for mediasoup and just published the first stable release (v1.0.0). I’d love to get feedback from this community, especially around best practices, edge cases I might have missed, and ideas for further development.
What it does
@azversan/mediasoup wraps mediasoup’s core API (Workers, Routers, Transports, Producers, Consumers, Data Channels, RTP Observers) into a NestJS-friendly service layer, with:
- Type-safe resource creation and retrieval (with generic overloads for transport/observer subtypes)
- Round-robin worker load balancing for routers, with PID exclusion support
- A centralized resource store backed by typed Maps
- An
ObserverServicethat bridges all native mediasoup worker/router/transport/producer/consumer/RTP-observer events into NestJS’sEventEmitter2, with a@OnMediasoup()decorator for easy subscription - Automatic resource usage telemetry (cascading counts from consumers/producers → router → worker)
- Sync and async module registration (
register/registerAsync) following standard NestJS conventions
Why I built this
I wanted a way to use mediasoup in NestJS apps without writing repetitive boilerplate for tracking entities and wiring up observer events every time. This module handles that plumbing so application code can focus on signaling/business logic.
Links
- GitHub: GitHub - azversan/mediasoup-module: NestJS integration module for mediasoup WebRTC SFU — type-safe Workers, Routers, Transports, Producers, Consumers, and RTP Observers with built-in resource tracking and EventEmitter-based observability. · GitHub
- npm:
npm install @azversan/mediasoup
Looking for
- General code review — especially around worker/router lifecycle management and the resource store design
- Feedback on the event-bridging approach (any events I might be missing or handling incorrectly?)
- Thoughts on the API surface — anything that feels awkward or could be more idiomatic
- Anyone interested in contributing, especially around test coverage (currently quite minimal) and additional examples/docs
Open to any criticism, big or small. Thanks for taking a look! ![]()