Deploying MiroTalk P2P
Introduction
MiroTalk P2P is a free, open-source WebRTC video conferencing platform that enables peer-to-peer group video calls directly in the browser. Unlike traditional video conferencing that routes all traffic through central servers, MiroTalk P2P establishes direct mesh connections between participants, reducing latency and enhancing privacy for small to medium-sized meetings.
Built with Node.js and Socket.IO, MiroTalk P2P offers a full-featured video conferencing experience without requiring accounts, downloads, or plugins. Participants simply share a room link and connect instantly through any modern web browser.
Key highlights of MiroTalk P2P:
- Mesh P2P Architecture: Direct connections between all participants for low latency
- No Registration Required: Create and join meetings instantly without accounts
- Full HD Video: Support for high-quality video up to 4K resolution
- Screen Sharing: Share entire screen, application windows, or browser tabs
- Recording: Record meetings locally or to cloud storage
- Whiteboard: Collaborative drawing and annotation during calls
- File Sharing: Transfer files directly between participants
- Text Chat: Persistent chat with emoji support
- Breakout Rooms: Split meetings into smaller discussion groups
- Virtual Backgrounds: Blur or replace backgrounds for privacy
- Transcription: Real-time speech-to-text (with external service)
- REST API: Programmatic meeting management and integration
- Self-Hosted: Complete control over your video conferencing infrastructure
This guide covers deploying MiroTalk P2P on Klutch.sh, configuring TURN servers for network compatibility, and customizing the platform for your organization.
Why Deploy MiroTalk P2P on Klutch.sh
Deploying MiroTalk P2P on Klutch.sh provides numerous advantages:
Simplified Deployment: Klutch.sh automatically detects your Dockerfile and builds MiroTalk P2P without complex configuration. Push to GitHub, and your conferencing platform deploys automatically.
HTTPS by Default: WebRTC requires HTTPS. Klutch.sh provides automatic SSL certificates, ensuring compatibility with all browsers.
GitHub Integration: Connect your configuration repository directly. Updates trigger automatic redeployments, keeping your platform current.
Scalable Resources: Allocate resources based on expected meeting sizes. The signaling server is lightweight, scaling easily for more concurrent rooms.
Environment Variable Management: Securely configure TURN servers, API keys, and other sensitive settings through Klutch.sh’s environment system.
Custom Domains: Use your own domain for a branded, professional conferencing experience.
Always-On Availability: Your conferencing platform stays accessible 24/7 without infrastructure management.
Prerequisites
Before deploying MiroTalk P2P on Klutch.sh, ensure you have:
- A Klutch.sh account
- A GitHub account with a repository for your configuration
- Basic familiarity with Docker and containerization concepts
- (Recommended) TURN server credentials for reliable NAT traversal
- (Optional) A custom domain for your conferencing platform
Understanding P2P Mesh Architecture
MiroTalk P2P uses a mesh topology where each participant connects directly to every other participant:
Advantages:
- Lower latency (no server relay)
- Enhanced privacy (media doesn’t pass through servers)
- Reduced server bandwidth costs
Limitations:
- Best suited for smaller groups (2-8 participants)
- Bandwidth requirements grow with participant count
- Each participant uploads to all others
For larger meetings, consider MiroTalk SFU which uses a selective forwarding architecture.
Preparing Your Repository
Repository Structure
mirotalk-p2p-deploy/├── Dockerfile├── README.md└── .dockerignoreCreating the Dockerfile
Create a Dockerfile in the root of your repository:
FROM mirotalk/p2p:latest
# Server configurationENV HTTPS=falseENV HOST=0.0.0.0ENV PORT=3000
# API configurationENV API_KEY_SECRET=${API_KEY_SECRET}
# TURN server configurationENV TURN_ENABLED=${TURN_ENABLED:-true}ENV TURN_URLS=${TURN_URLS}ENV TURN_USERNAME=${TURN_USERNAME}ENV TURN_CREDENTIAL=${TURN_CREDENTIAL}
# Optional featuresENV SURVEY_ENABLED=${SURVEY_ENABLED:-false}ENV REDIRECT_ENABLED=${REDIRECT_ENABLED:-false}
# Expose the application portEXPOSE 3000
# Health checkHEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \ CMD curl -f http://localhost:3000/ || exit 1Environment Variables Reference
| Variable | Required | Default | Description |
|---|---|---|---|
API_KEY_SECRET | Recommended | - | Secret key for API authentication |
TURN_ENABLED | No | true | Enable TURN server support |
TURN_URLS | Recommended | - | TURN server URLs |
TURN_USERNAME | Recommended | - | TURN server username |
TURN_CREDENTIAL | Recommended | - | TURN server password |
SURVEY_ENABLED | No | false | Show survey after meetings |
REDIRECT_ENABLED | No | false | Redirect to custom URL after meetings |
SENTRY_DSN | No | - | Sentry error tracking DSN |
Deploying MiroTalk P2P on Klutch.sh
- Select HTTP as the traffic type
- Set the internal port to 3000
Generate API Key Secret
Create a secure API key:
openssl rand -hex 32Save this for environment configuration.
Push Your Repository to GitHub
git initgit add Dockerfile .dockerignore README.mdgit commit -m "Initial MiroTalk P2P deployment"git remote add origin https://github.com/yourusername/mirotalk-p2p-deploy.gitgit push -u origin mainCreate a New Project on Klutch.sh
Navigate to the Klutch.sh dashboard and create a project named “mirotalk-p2p” or “video-conference”.
Create a New App
Create a new app and connect your GitHub repository.
Configure HTTP Traffic
In deployment settings:
Set Environment Variables
Configure your environment:
| Variable | Value |
|---|---|
API_KEY_SECRET | Your generated API key |
TURN_ENABLED | true |
TURN_URLS | Your TURN server URL |
TURN_USERNAME | Your TURN username |
TURN_CREDENTIAL | Your TURN password |
Deploy Your Application
Click Deploy to build and launch. Klutch.sh provisions HTTPS automatically.
Access MiroTalk P2P
Once deployed, access your platform at https://your-app-name.klutch.sh.
Using MiroTalk P2P
Creating a Meeting
- Navigate to your MiroTalk P2P URL
- Enter a room name or generate a random one
- Click Join Room to enter
- Share the URL with participants
Meeting Controls
The control bar provides access to:
- Microphone: Mute/unmute audio
- Camera: Enable/disable video
- Screen Share: Share screen, window, or tab
- Chat: Open text chat panel
- Whiteboard: Collaborative drawing canvas
- Recording: Start/stop local recording
- Hand Raise: Signal to speak
- Participants: View and manage attendees
- Settings: Audio/video device configuration
Advanced Features
File Sharing: Click the file icon to send files directly to participants.
Whiteboard: Launch an interactive canvas for diagrams and notes.
Virtual Backgrounds: Access through settings to blur or replace your background.
Recording: Save meetings locally in WebM format.
API Integration
Creating Meetings Programmatically
// Create a meeting via APIconst response = await fetch('https://your-p2p.klutch.sh/api/v1/meeting', { method: 'POST', headers: { 'Authorization': 'your-api-key-secret', 'Content-Type': 'application/json' }, body: JSON.stringify({ name: 'Team Standup' })});
const { meeting } = await response.json();console.log(meeting.url);API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/api/v1/meeting | POST | Create new meeting |
/api/v1/meeting/:id | GET | Get meeting info |
/api/v1/meetings | GET | List active meetings |
TURN Server Setup
TURN servers are essential for reliable connectivity:
Recommended TURN Providers
- Metered TURN - Free tier available
- Twilio TURN - Pay-as-you-go pricing
- Xirsys - Global TURN network
Configuration Example
TURN_ENABLED=trueTURN_URLS=turn:global.relay.metered.ca:80,turn:global.relay.metered.ca:443TURN_USERNAME=your-usernameTURN_CREDENTIAL=your-api-keyTroubleshooting
Participants Can’t Connect
- Verify TURN servers are configured correctly
- Check browser permissions for media devices
- Ensure HTTPS is working properly
Video Quality Issues
- Reduce participant count for mesh limitations
- Check network bandwidth
- Lower video resolution in settings
Audio Echo
- Use headphones
- Enable echo cancellation in settings
- Mute when not speaking
Screen Share Not Working
- Grant screen sharing permissions
- Try sharing a specific window vs. entire screen
- Check browser compatibility
Additional Resources
- MiroTalk P2P GitHub Repository
- MiroTalk P2P Demo
- MiroTalk Documentation
- MiroTalk SFU for Larger Meetings
- Klutch.sh Deployments
Conclusion
MiroTalk P2P on Klutch.sh delivers a complete video conferencing solution with the privacy and performance benefits of peer-to-peer connections. With automatic HTTPS, simple deployment, and rich features like screen sharing, whiteboard, and recording, you can host professional meetings without depending on third-party services. For small teams, consultations, or educational sessions, MiroTalk P2P provides everything needed for effective video collaboration.