Purpose
StreamVault uses a separate backend server to handle sensitive operations that cannot be safely performed client-side. The backend acts as a secure proxy for:- OAuth Authentication - Keeps Google OAuth client secrets server-side
- WebSocket Relay - Coordinates Watch Together synchronized playback
- TMDB Proxy - Optional metadata API proxy
Default Server
The official StreamVault backend is hosted at:localhost:3001 when running a local backend instance.
Self-Hosting
You can run your own backend server for complete control over your data:Official Repository
Configuration
To use a custom backend, configure these environment variables before building:Architecture
Security Model
Client Secrets Stay Server-Side: Google OAuth credentials never leave the backend. The client receives only access tokens via secure callback URLs. Token Exchange Flow:- Client opens browser to
/auth/googleon backend - User authenticates with Google
- Backend exchanges authorization code for tokens
- Backend redirects to
http://localhost:8085/callback?tokens=BASE64_JSON - Client extracts tokens from callback
API Categories
Authentication Endpoints
POST /auth/google- Initiate OAuth flowPOST /auth/refresh- Refresh access token
WebSocket Endpoints
WS /ws/watchtogether- Watch Together room coordination
TMDB Proxy (Optional)
GET /api/tmdb/*- Proxy TMDB API requests
Environment Detection
The client automatically selects the appropriate backend URL:Development vs Production
| Environment | Auth Server | WebSocket Server |
|---|---|---|
| Development | localhost:3001 (override) | ws://localhost:3001/ws/watchtogether |
| Production | https://streamvault-backend-server.onrender.com | wss://streamvault-backend-server.onrender.com/ws/watchtogether |
Next Steps
Authentication
Learn about OAuth flow and token management
WebSocket Protocol
Understand Watch Together synchronization