A modern WebRTC video chat application built as a pnpm monorepo with NestJS backend and React frontend. Supports group video calls via mediasoup SFU.
- Group Video Calls — mediasoup SFU for multi-participant rooms
- Secure Authentication — JWT with refresh token rotation and reuse detection
- Modern Stack — React 19, NestJS, TypeScript, Tailwind CSS
- Database — PostgreSQL with Prisma ORM
- Production-Ready — Docker Compose + Caddy (automatic HTTPS)
| Layer | Tech |
|---|---|
| Backend | NestJS v11, PostgreSQL 16, Prisma ORM, Passport.js (JWT), mediasoup |
| Frontend | React 19, Vite 7, Tailwind CSS v4, React Router v7, Radix UI, mediasoup-client |
| Signalling | Socket.io |
| Deployment | Docker Compose, Caddy (reverse proxy + HTTPS) |
- Node.js 22+
- pnpm (this project uses pnpm only — no npm/yarn)
- Docker and Docker Compose
pnpm installServer env is ready out of the box at apps/server/.env.development.
Client env is at apps/client/.env.local.
If missing, create from examples:
cp apps/server/.env.example apps/server/.env.development
cp apps/client/.env.example apps/client/.env.localEdit apps/client/.env.local:
VITE_API_BASE_URL="http://localhost:3000"
VITE_SOCKET_URL="http://localhost:3000"pnpm -C apps/server bd:devThis starts PostgreSQL (port 5432) and pgAdmin (port 5050) via Docker.
pnpm -C apps/server migrate:devpnpm dev- Server: http://localhost:3000 (Swagger: http://localhost:3000/swagger)
- Client: http://localhost:5173
In dev mode, mediasoup listens on 127.0.0.1 (default without env vars) — video/audio works only on the same machine.
See docs/deployment.md for the full production setup guide.
Quick version:
make setup # create .env from template
$EDITOR .env # edit with real secrets and your domain/IP
make deploy # build and start all servicesThis starts 5 services: PostgreSQL, migrations, NestJS server, client build, and Caddy reverse proxy with automatic HTTPS.
Open: https://localhost (self-signed) or https://your-domain.com (Let's Encrypt).
Run make help to see all available targets.
webrtc-chat/
├── apps/
│ ├── server/ # NestJS backend (port 3000)
│ │ ├── prisma/ # Database schema and migrations
│ │ ├── src/
│ │ │ ├── auth/ # Authentication (JWT, Passport)
│ │ │ ├── user/ # User CRUD
│ │ │ ├── room/ # Room management
│ │ │ └── sfu/ # mediasoup SFU (WebSocket gateway)
│ │ └── docker-compose.yml # Dev database (PostgreSQL + pgAdmin)
│ └── client/ # React frontend (port 5173)
│ └── src/
│ ├── features/ # Feature modules (auth, room, media, sfu)
│ ├── components/ # Shared UI components
│ ├── hooks/ # Shared hooks
│ └── lib/ # API client, SFU manager, utilities
├── docs/ # Documentation (SDD, deployment, tasks)
├── docker-compose.yml # Production full-stack deployment
├── Makefile # Production Docker orchestration (make help)
├── Caddyfile # Caddy reverse proxy config
└── .env.production.example # Production env template
| Command | Description |
|---|---|
make help |
Show all available targets |
make setup |
Create .env from template |
make deploy |
Build images and start all services |
make down |
Stop all services |
make restart |
Restart all services |
make rebuild-server |
Rebuild and restart only the server |
make rebuild-client |
Rebuild client and restart Caddy |
make migrate |
Run database migrations |
make logs |
Follow logs for all services |
make status |
Show service status and health |
make clean |
Stop and remove containers/networks |
make clean-all |
Remove everything (volumes, images) |
| Command | Description |
|---|---|
pnpm dev |
Run client + server in development |
pnpm test |
Run tests in all workspaces |
pnpm test:client |
Client unit tests (CI mode) |
pnpm test:server |
Server unit tests |
pnpm clean |
Clean caches |
| Command | Description |
|---|---|
pnpm -C apps/server dev |
Development mode with watch |
pnpm -C apps/server build |
Compile TypeScript |
pnpm -C apps/server lint |
ESLint |
pnpm -C apps/server test |
Unit tests |
pnpm -C apps/server test:e2e |
E2E tests |
pnpm -C apps/server migrate:dev |
Apply Prisma migrations |
pnpm -C apps/server bd:dev |
Start dev database (Docker) |
| Command | Description |
|---|---|
pnpm -C apps/client dev |
Vite dev server |
pnpm -C apps/client build |
Production build |
pnpm -C apps/client lint |
ESLint |
pnpm -C apps/client test:run |
Unit tests (CI mode) |
pnpm -C apps/client test:e2e |
Playwright E2E tests |
- Deployment Guide — Production Docker setup
- System Design Document — Architecture, API, data models
- Agent Guide — Rules for AI agents
- Roadmap — Development phases and status
MIT