A powerful RTMP middleware solution with a modern web interface for managing streaming destinations and monitoring live streams.
- RTMP Server: Nginx-based RTMP server for receiving streams
- Stream Forwarding: Forward streams to multiple destinations (Twitch, YouTube, etc.)
- Web Interface: Modern React/Next.js dashboard for management
- Real-time Monitoring: Live stream statistics and viewer counts
- HLS Output: Automatic HLS transcoding for web playback
- Docker Ready: Fully containerized solution
- Clone this repository:
git clone <repository-url>
cd rtmp-middleware- Copy the environment file:
cp env.example .env- Start the services:
docker-compose up -d- Access the web interface via Nginx at
http://localhost:8081(configurable viaNGINX_PORT) - Optional: access Next.js directly at
http://localhost:3343and API directly athttp://localhost:8343
- Install dependencies:
bun install- Start the development server:
bun dev- In another terminal, start the API server:
node api-server.jsConfigure your streaming software (OBS, FFmpeg, etc.) with:
- RTMP URL:
rtmp://localhost:1935/live - Stream Key: Any unique identifier (e.g.,
mystream)
- Open the web interface at
http://localhost:8081 - Navigate to the "Destinations" tab
- Add streaming destinations (Twitch, YouTube, etc.)
- Toggle destinations on/off as needed
- Live Streams: View active streams and viewer counts
- Statistics: Monitor bandwidth usage and performance
- Real-time Updates: Dashboard updates every 5 seconds
rtmp://localhost:${RTMP_HOST_PORT:-1935}/live/YOUR_STREAM_KEY
# HLS Playback (via Nginx on host)
http://localhost:8081/hls/YOUR_STREAM_KEY.m3u8
# DASH Playback (via Nginx on host)
http://localhost:8081/dash/YOUR_STREAM_KEY.mpd
# Direct RTMP (for restreaming)
rtmp://localhost:${RTMP_HOST_PORT:-1935}/live/YOUR_STREAM_KEY
GET /api/destinations- List all destinationsPOST /api/destinations- Add new destinationPUT /api/destinations/:id- Update destinationDELETE /api/destinations/:id- Delete destinationGET /api/streams- List active streamsGET /api/stats- Get stream statisticsGET /api/health- Server health check
- rtmp-middleware: Main container with nginx-rtmp, Next.js app, and API server
- redis: Session storage and caching
1935(host 1935 -> container 1935): RTMP input port3343(host 3343 -> container 3000): Direct Next.js web interface (optional)8343(host 8343 -> container 8080): Direct API server (optional)8081(host 8081 -> container 80): Nginx HTTP (HLS/DASH and web proxy)6379(host 6379 -> container 6379): Redis
Edit nginx.conf to customize RTMP server settings:
- Chunk size
- Connection limits
- Recording settings
- Security restrictions
- Check if the RTMP URL and stream key are correct
- Verify firewall settings for port 1935
- Check container logs:
docker-compose logs rtmp-middleware
- Ensure port 8081 (Nginx) or 3343 (Next direct) is not in use
- Check if all services are running:
docker-compose ps - Verify API connectivity via Nginx:
curl http://localhost:8081/api/health(or direct:curl http://localhost:8343/api/health)
- Verify destination RTMP URLs are correct
- Check if stream keys are properly configured
- Monitor nginx logs for push errors
- API changes: Edit
api-server.js - UI changes: Edit files in
src/ - RTMP config: Edit
nginx.conf
# Build Next.js app
bun run build
# Build Docker image
docker build -t rtmp-middleware .
# Run with docker-compose
docker-compose up -dMIT License - see LICENSE file for details.