Skip to content

YuriFA/zvonOK

Repository files navigation

ZvonOK - WebRTC Video Conferencing Platform

A modern WebRTC video chat application built as a pnpm monorepo with NestJS backend and React frontend. Supports group video calls via mediasoup SFU.

Features

  • 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)

Tech Stack

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)

Prerequisites

  • Node.js 22+
  • pnpm (this project uses pnpm only — no npm/yarn)
  • Docker and Docker Compose

Development Setup

1. Install dependencies

pnpm install

2. Configure environment

Server 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.local

Edit apps/client/.env.local:

VITE_API_BASE_URL="http://localhost:3000"
VITE_SOCKET_URL="http://localhost:3000"

3. Start database

pnpm -C apps/server bd:dev

This starts PostgreSQL (port 5432) and pgAdmin (port 5050) via Docker.

4. Run migrations

pnpm -C apps/server migrate:dev

5. Start dev servers

pnpm dev

In dev mode, mediasoup listens on 127.0.0.1 (default without env vars) — video/audio works only on the same machine.

Production Deployment (Docker)

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 services

This 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.

Project Structure

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

Available Commands

Production (Makefile)

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)

Root

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

Server (apps/server/)

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)

Client (apps/client/)

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

Documentation

License

MIT

About

Real-time WebRTC video conferencing platform with chat and signaling server (P2P → scalable SFU architecture).

Resources

License

Stars

Watchers

Forks

Contributors