You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
A lightweight WebRTC SFU (Selective Forwarding Unit) server built with Go 1.22+ and Pion WebRTC. It provides real-time live streaming capabilities through WHIP/WHEP protocols with room-based relay, optional recording, authentication, rate limiting, and observability features.
Key Features
WHIP Publishing: Browser or OBS can push streams via HTTP POST
WHEP Playback: Viewers subscribe to rooms via HTTP POST
Room-based SFU: Single publisher per room, multiple subscribers
Recording: VP8/VP9 → IVF, Opus → OGG with optional S3/MinIO upload
Auth: Token (global/room-level) or JWT with role-based access
Observability: Prometheus metrics, OpenTelemetry tracing, health checks
OpenSpec Workflow
This project uses OpenSpec for spec-driven development. All specifications are in openspec/specs/ as the source of truth.
Commands
Command
Purpose
/opsx:propose <change>
Start a new change proposal
/opsx:explore
Investigate problems and clarify requirements
/opsx:apply
Implement tasks from the proposal
/opsx:archive
Archive completed change and merge specs
Workflow
Review specs - Check openspec/specs/ for existing requirements
Propose change - Use /opsx:propose to create:
proposal.md - Why and what changes
specs/ - Delta specs (ADDED/MODIFIED/REMOVED)
design.md - Technical approach
tasks.md - Implementation checklist
Implement - Use /opsx:apply to work through tasks
Archive - Use /opsx:archive to merge delta specs and preserve history
# Build
go build -o bin/live-webrtc-go ./cmd/server
# Run directly
go run ./cmd/server
# Development helper (loads .env.local, sets cache dirs)
./scripts/start.sh
# With module tidy
RUN_TIDY=1 ./scripts/start.sh
Test Commands
make test# Unit + integration + security (default)
make test-all # Adds e2e + performance (longer timeout)
make test-unit # go test -v -race ./internal/...
make test-integration # Requires -tags=integration
make test-e2e # Requires -tags=e2e, 10m timeout
make coverage # HTML + XML coverage reports
Lint & Security
make lint # gofmt -s + go vet + golangci-lint
make fmt # gofmt -s -w .
make security # gosec ./...