$ show miroslavpejic85/mirotalk
MiroTalk P2P is a self-hosted, open-source WebRTC video conferencing application that enables real-time peer-to-peer video calls, audio calls, screen sharing, chat, whiteboard collaboration, file sharing, and recording. The architecture consists of a Node.js/Express server with Socket.IO for signaling and a REST API (v1) for programmatic meeting management, token generation, and statistics. The client is a single-page application with modular JavaScript files handling UI components, media processing, accessibility, and integrations. Key features include end-to-end encrypted media (SRTP/DTLS), noise suppression via RNNoise AudioWorklet, live captions (Web Speech API and server-side Whisper transcription), ChatGPT integration, OIDC authentication, JWT-based API security, and an embeddable support widget. The system is designed for privacy: no persistent storage of signaling data, chat, or media; recordings stay in the browser as Blobs. Deployment options include Docker, Kubernetes, and bare-metal, with support for CoTURN TURN servers, ngrok tunneling, and email alerts via Nodemailer. The codebase is well-structured with separate modules for security (XSS sanitization, input validation, host protection), logging, and integration helpers, though the main server.js is monolithic (~2000 lines) and the client-side CSS is large (~5000 lines combined).
The LLM identified 6 files worth highlighting for reuse:
Provides DOMPurify-based XSS sanitization for user input. Exposes a `checkXSS` function that sanitizes strings and objects recursively. Isolated and reusable for any Node.js application needing input sanitization.
Validates room names, file names, URLs, and detects private IP addresses to prevent path traversal and SSRF. Exports a `Validate` class with static methods. Self-contained and reusable for server-side input validation.
Implements an AudioWorkletProcessor that applies RNNoise-based noise suppression to microphone audio. Self-contained, uses Web Audio API, and can be extracted for any WebRTC application needing real-time noise reduction.
Aggregates WebRTC statistics (RTT, jitter, packet loss, bitrate) from RTCPeerConnection. Exposes a `NetworkStats` class that polls stats periodically. Reusable for any WebRTC application requiring network quality monitoring.
Provides a `MiroTalkWidget` class for embedding a support widget on third-party websites. Features draggable UI, online status polling, state management (minimize/close/reopen), and action buttons for audio/video calls and chat. Self-contained and configurable via data attributes.
Helper module for server-side Whisper transcription. Decodes base64 audio payloads, filters low-confidence transcripts to reduce hallucinations, and validates transcription payloads. Isolated and reusable for integrating OpenAI-compatible Whisper APIs.