Skip to content

bas3line/Surf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Surf

A production-grade, open-source video conferencing platform built with modern web technologies. Surf combines a powerful WebRTC SFU (Selective Forwarding Unit) with AI-powered features to deliver a scalable, real-time communication solution.

🌊 Overview

Surf is a complete video conferencing solution consisting of:

  • Surf-Media: High-performance WebRTC SFU written in Rust for real-time audio/video streaming
  • Surf-Service: Modern TypeScript/Node.js backend API built with Hono
  • Surf-AI: AI-powered transcription and processing service
  • Surf-Bench: Performance benchmarking tools
  • Surf-Utils: Shared utilities and documentation

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚    Web Client        β”‚
β”‚    (Next.js App)     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚ HTTP/WebSocket
           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    WebRTC Media    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   API Server         │◄──────────────────►│   Media Server       β”‚
β”‚   (Hono + Node.js)   β”‚                    β”‚   (Rust SFU)         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚                                           β”‚
           β”‚         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
           β”‚         β”‚                                 β”‚          β”‚
           β–Ό         β–Ό                                 β–Ό          β–Ό
      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”                      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”
      β”‚ Redis  β”‚  β”‚ NATS β”‚                      β”‚   AI   β”‚  β”‚   R2   β”‚
      β”‚ Cache  β”‚  β”‚ Msg  β”‚                      β”‚Service β”‚  β”‚Storage β”‚
      β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”˜                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜

✨ Features

  • Real-time Video/Audio: WebRTC-based SFU for efficient media routing
  • AI Transcription: Real-time transcription and AI-powered features
  • Recording: Server-side recording with cloud storage (R2/S3)
  • Scalable Architecture: Redis caching, NATS messaging for horizontal scaling
  • Modern Stack: Rust for performance-critical media handling, TypeScript for business logic
  • Production-Ready: Monitoring, metrics, rate limiting, and security built-in

πŸš€ Quick Start

Prerequisites

  • Rust (1.75+) - Install Rust
  • Bun (1.1.0+) - Install Bun
  • Node.js (20+)
  • Docker & Docker Compose (for infrastructure)

Development Setup

  1. Clone the repository
git clone https://github.com/bas3line/Surf.git
cd Surf
  1. Start infrastructure services
# Start Redis, NATS, PostgreSQL, and other dependencies
bun run dev:infra
  1. Set up environment variables
# Surf-Service
cd Surf-Service
cp .env.example .env
# Edit .env with your configuration

# Surf-Media
cd ../Surf-Media
cp .env.example .env
# Edit .env with your configuration
  1. Install dependencies
# Surf-Service (monorepo with workspaces)
cd Surf-Service
bun install

# Surf-AI
cd ../Surf-AI
bun install
  1. Run the development servers
# Option 1: Use the convenience script (runs both Media and Service)
./dev.sh

# Option 2: Run services individually

# Terminal 1 - Surf-Media (Rust SFU)
cd Surf-Media
cargo run

# Terminal 2 - Surf-Service (API + Web)
cd Surf-Service
bun run dev

# Terminal 3 - Surf-AI (Optional)
cd Surf-AI
bun run dev

Access the Application

πŸ“¦ Project Structure

Surf/
β”œβ”€β”€ Surf-Media/           # Rust WebRTC SFU (media server)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ media/       # WebRTC peer connections
β”‚   β”‚   β”œβ”€β”€ audio/       # Audio processing & codecs
β”‚   β”‚   β”œβ”€β”€ cache/       # Redis session management
β”‚   β”‚   β”œβ”€β”€ recording/   # Server-side recording
β”‚   β”‚   └── api/         # HTTP/WebSocket API
β”‚   └── Cargo.toml
β”‚
β”œβ”€β”€ Surf-Service/         # TypeScript monorepo (API + Web)
β”‚   β”œβ”€β”€ apps/
β”‚   β”‚   β”œβ”€β”€ api/         # Hono backend API
β”‚   β”‚   β”œβ”€β”€ web/         # Next.js web client
β”‚   β”‚   └── docs/        # Documentation site
β”‚   β”œβ”€β”€ packages/
β”‚   β”‚   β”œβ”€β”€ db/          # Database (Drizzle ORM)
β”‚   β”‚   β”œβ”€β”€ auth/        # Authentication (Better Auth)
β”‚   β”‚   β”œβ”€β”€ cache/       # Redis cache layer
β”‚   β”‚   β”œβ”€β”€ nats/        # NATS messaging
β”‚   β”‚   └── types/       # Shared TypeScript types
β”‚   └── package.json
β”‚
β”œβ”€β”€ Surf-AI/              # AI transcription service
β”‚   └── src/
β”‚
β”œβ”€β”€ Surf-Bench/           # Performance benchmarks
β”‚
β”œβ”€β”€ Surf-Utils/           # Utilities and docs
β”‚
└── dev.sh               # Development launcher script

πŸ› οΈ Technology Stack

Backend

  • Rust - High-performance media server (WebRTC, SFU)
  • TypeScript - Business logic and API
  • Hono - Fast, lightweight web framework
  • Drizzle ORM - Type-safe database access
  • Better Auth - Modern authentication

Frontend

  • Next.js 16 - React framework with App Router
  • React 19 - UI library
  • TailwindCSS - Styling
  • Radix UI - Accessible components
  • Zustand - State management

Infrastructure

  • PostgreSQL - Primary database
  • Redis - Caching and session storage
  • NATS - Message broker
  • R2/S3 - Object storage for recordings
  • Docker - Containerization

WebRTC & Media

  • mediasoup-client - WebRTC client library
  • Opus - Audio codec
  • WebRTC (Rust) - Native WebRTC implementation

πŸ”§ Development

Available Scripts

# Surf-Service
bun run dev              # Start web + API
bun run dev:all          # Start all services
bun run dev:docs         # Start documentation site
bun run build            # Build all packages
bun run lint             # Lint code
bun run format           # Check code formatting
bun run format:fix       # Fix code formatting

# Database
bun run db:generate      # Generate migrations
bun run db:migrate       # Run migrations
bun run db:push          # Push schema changes
bun run db:studio        # Open Drizzle Studio

# Infrastructure
bun run dev:infra        # Start Docker services
bun run dev:infra:down   # Stop Docker services
bun run docker:clean     # Clean Docker volumes

Building for Production

# Surf-Media (Rust)
cd Surf-Media
cargo build --release

# Surf-Service (TypeScript)
cd Surf-Service
bun run build

# Run production builds
cd Surf-Media
./target/release/surf-media

cd Surf-Service
bun run start

πŸ“Š Monitoring & Metrics

  • Prometheus-compatible metrics endpoint
  • Built-in logging with Pino
  • Performance monitoring
  • Rate limiting and security features

🀝 Contributing

We welcome contributions! Please see:

πŸ” Security

Found a security vulnerability? Please read SECURITY.md for responsible disclosure guidelines.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ“¬ Contact

πŸ™ Acknowledgments

Built with modern open-source technologies and powered by the amazing Rust and TypeScript communities.


Note: This is an active development project. APIs and features may change. Check individual component READMEs for more detailed documentation:

About

Surf Meets app, Built over Call

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •