Skip to content

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
└── .dockerignore

Creating the Dockerfile

Create a Dockerfile in the root of your repository:

FROM mirotalk/p2p:latest
# Server configuration
ENV HTTPS=false
ENV HOST=0.0.0.0
ENV PORT=3000
# API configuration
ENV API_KEY_SECRET=${API_KEY_SECRET}
# TURN server configuration
ENV TURN_ENABLED=${TURN_ENABLED:-true}
ENV TURN_URLS=${TURN_URLS}
ENV TURN_USERNAME=${TURN_USERNAME}
ENV TURN_CREDENTIAL=${TURN_CREDENTIAL}
# Optional features
ENV SURVEY_ENABLED=${SURVEY_ENABLED:-false}
ENV REDIRECT_ENABLED=${REDIRECT_ENABLED:-false}
# Expose the application port
EXPOSE 3000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD curl -f http://localhost:3000/ || exit 1

Environment Variables Reference

VariableRequiredDefaultDescription
API_KEY_SECRETRecommended-Secret key for API authentication
TURN_ENABLEDNotrueEnable TURN server support
TURN_URLSRecommended-TURN server URLs
TURN_USERNAMERecommended-TURN server username
TURN_CREDENTIALRecommended-TURN server password
SURVEY_ENABLEDNofalseShow survey after meetings
REDIRECT_ENABLEDNofalseRedirect to custom URL after meetings
SENTRY_DSNNo-Sentry error tracking DSN

Deploying MiroTalk P2P on Klutch.sh

    Generate API Key Secret

    Create a secure API key:

    Terminal window
    openssl rand -hex 32

    Save this for environment configuration.

    Push Your Repository to GitHub

    Terminal window
    git init
    git add Dockerfile .dockerignore README.md
    git commit -m "Initial MiroTalk P2P deployment"
    git remote add origin https://github.com/yourusername/mirotalk-p2p-deploy.git
    git push -u origin main

    Create 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:

    • Select HTTP as the traffic type
    • Set the internal port to 3000

    Set Environment Variables

    Configure your environment:

    VariableValue
    API_KEY_SECRETYour generated API key
    TURN_ENABLEDtrue
    TURN_URLSYour TURN server URL
    TURN_USERNAMEYour TURN username
    TURN_CREDENTIALYour 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

  1. Navigate to your MiroTalk P2P URL
  2. Enter a room name or generate a random one
  3. Click Join Room to enter
  4. 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 API
const 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

EndpointMethodDescription
/api/v1/meetingPOSTCreate new meeting
/api/v1/meeting/:idGETGet meeting info
/api/v1/meetingsGETList active meetings

TURN Server Setup

TURN servers are essential for reliable connectivity:

Configuration Example

TURN_ENABLED=true
TURN_URLS=turn:global.relay.metered.ca:80,turn:global.relay.metered.ca:443
TURN_USERNAME=your-username
TURN_CREDENTIAL=your-api-key

Troubleshooting

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

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.