Public
Remixed
Starter template with client-side React & Hono server
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.

📹 Web-Native Video Chat

Peer-to-peer video calls with zero npm dependencies on the client. Just native browser APIs:

  • WebRTC — peer-to-peer video/audio streaming
  • Server-Sent Events (SSE) — real-time signaling
  • getUserMedia — camera/mic access

Val Town acts as a lightweight signaling server to help browsers find each other. Once connected, all video flows directly between peers.

Architecture

Rendering mermaid diagram...

How it works

  1. Lobby — enter a room name (or get a random one) and click Join
  2. Signaling — the server brokers WebRTC offers/answers/ICE candidates via SSE
  3. P2P connection — once established, video streams directly between browsers
  4. Share the link — copy the invite URL for others to join the same room

Files

  • index.ts — Hono server with SSE signaling endpoints + static file serving
  • frontend/webrtc.ts — WebRTC + SSE signaling client (plain TypeScript, no framework)
  • frontend/components/App.tsx — React UI for lobby + video grid + controls