Introduction
The Bedrud backend is a single-binary meeting platform written in Go 1.24+. All dependencies - media server, web frontend, TURN server - are embedded in one executable.
Key Technologies
- Core Framework: Fiber v2 (Zero allocation router, Express-like API).
- Database Layer: GORM with support for SQLite (standard) and PostgreSQL (production).
- Media Engine: LiveKit (Embedded as a sibling binary).
- Auth System: Multi-layered auth supporting JWT, OAuth2 (Google/GitHub/Twitter), and passwordless FIDO2 Passkeys.
- Embedded Static Assets: Uses Go 1.16+
embedpackage to bundle the React frontend (SSR pre-rendered client assets). - Deployment: Integrated Debian/Ubuntu auto-installer with systemd orchestration and ACME (Let’s Encrypt) support.
Why this Architecture?
WebRTC platforms typically run separate services for signaling, TURN, web serving, and database management. Bedrud consolidates these into one binary by:
- Extracting the media server binary at runtime.
- Proxying media traffic through the main HTTP(S) port.
- Automating OS-level configuration (SSL, systemd) via the binary itself.
High-Level Architecture
The backend follows a standard layered architecture:
- Server Layer (
internal/server): Sets up the Fiber app, routes, and middleware. - Handler Layer (
internal/handlers): Manages HTTP requests and responses. - Repository Layer (
internal/repository): Handles database queries using GORM. - Model Layer (
internal/models): Defines the database tables and Go structures. - Service/Logic Layer: Integrated into handlers and repositories for simplicity, with specialized packages like
internal/authandinternal/livekit.
Main Entry Point
The application starts in server/cmd/bedrud/main.go. It has three main modes:
run: Starts the full meeting server.livekit: Starts only the embedded media server.install: Automatically sets up the server on Debian/Ubuntu systems.
Documentation Sections
- Code Structure: Where is everything located?
- Database & Models: How is data stored?
- Authentication: How do users log in?
- API Handlers: How are requests processed?
- LiveKit Integration: How does the video server work?
- WebRTC Connectivity: How do clients establish media connections? (STUN/ICE/TURN/SFU)
- TURN Server: TURN relay architecture, configuration, and troubleshooting
- Installation & Deployment: How does the auto-installer work?