A complete self-hosted stack for AI-powered voice/video communication with workflow automation.
┌─────────────────────────────────────────────────────────────────┐
│ Services │
├─────────────────────────────────────────────────────────────────┤
│ React App (:3000) │ Dashboard (:8000) │ n8n (:5678) │
├─────────────────────────────────────────────────────────────────┤
│ Token Server (:3001) │
├─────────────────────────────────────────────────────────────────┤
│ LiveKit Server (:7880-7882) │
├─────────────────────────────────────────────────────────────────┤
│ LiveKit Agent │ PostgreSQL │ Qdrant (:6333) │
└─────────────────────────────────────────────────────────────────┘
| Service | Port | Description |
|---|---|---|
| livekit | 7880, 7881, 7882/udp | WebRTC media server |
| livekit-react-app | 3000 | Video conferencing UI |
| livekit-token-server | 3001 | Token generation API |
| livekit-agent | - | AI voice assistant (STT/LLM/TTS) |
| livekit-dashboard | 8000 | Admin dashboard |
| n8n | 5678 | Workflow automation |
| postgres | 5432 | Database for n8n |
| qdrant | 6333, 6334 | Vector database |
git clone https://github.com/rjarman/livekit-voice-agent.git
cd livekit-voice-agentcp .env.example .envEdit .env with your values:
# Required - Your server's public IP or domain
SERVER_IP_ADDRESS=<server-ip-address or domain>
# Generate secure passwords
POSTGRES_PASSWORD=$(openssl rand -base64 24)
N8N_ENCRYPTION_KEY=$(openssl rand -base64 24)
# LiveKit credentials (generate or use existing)
LIVEKIT_API_KEY=your-api-key
LIVEKIT_API_SECRET=your-api-secret
# Dashboard admin
LIVEKIT_DASHBOARD_USERNAME=admin
LIVEKIT_DASHBOARD_PASSWORD=your-secure-password
LIVEKIT_DASHBOARD_SECRET_KEY=$(openssl rand -hex 32)
# AI Service API Keys (free tiers available)
ASSEMBLYAI_API_KEY=xxx # https://www.assemblyai.com
GROQ_API_KEY=xxx # https://console.groq.com
CARTESIA_API_KEY=xxx # https://play.cartesia.ai
# Qdrant
QDRANT_API_KEY=your-qdrant-key# Using openssl
echo "API Key: API$(openssl rand -hex 7)"
echo "API Secret: $(openssl rand -base64 32)"docker compose up -ddocker compose ps
docker compose logs -fAfter deployment (replace with your server IP/domain):
| Service | URL |
|---|---|
| React App | http://<server-ip>:3000 |
| Dashboard | http://<server-ip>:8000 |
| n8n | http://<server-ip>:5678 |
| Token API | http://<server-ip>:3001/token |
The agent uses free-tier AI services:
| Function | Provider | Free Tier |
|---|---|---|
| Speech-to-Text | AssemblyAI | 100 hours |
| LLM | Groq (Llama 3.1) | Generous limits |
| Text-to-Speech | Cartesia | Free tier |
# View logs
docker compose logs -f livekit-agent
# Rebuild agent after changes
docker compose build livekit-agent
docker compose up -d livekit-agent
# Rebuild react app after changes
docker compose build livekit-react-app
docker compose up -d livekit-react-app
# Stop all
docker compose down
# Stop and remove volumes (data loss!)
docker compose down -vlivekit-voice-agent/
├── docker-compose.yml # Main orchestration
├── .env.example # Environment template
├── .env # Your configuration (create this)
├── livekit.yaml # LiveKit server config
├── livekit-token-server/ # Token generation service
│ ├── server.js
│ └── package.json
├── livekit-agent/ # AI voice agent
│ ├── agent.py
│ ├── pyproject.toml
│ └── Dockerfile
└── livekit-react-app/ # React frontend
├── src/
├── Dockerfile
└── nginx.conf
Browsers require HTTPS (or localhost) to access camera/microphone. If you're using HTTP with an IP address, you'll see:
Error: Accessing media devices is available only in secure contexts
-
Open Chrome and go to:
chrome://flags/#unsafely-treat-insecure-origin-as-secure -
Paste your server URLs (comma-separated):
http://<server-ip>:3000,http://<server-ip>:7880,http://<server-ip>:3001 -
Set to Enabled
-
Click Relaunch
For production, set up a domain with SSL using Caddy or a reverse proxy.
Ensure these ports are open on your server:
| Port | Protocol | Service |
|---|---|---|
| 3000 | TCP | React App |
| 3001 | TCP | Token Server |
| 5678 | TCP | n8n |
| 6333-6334 | TCP | Qdrant |
| 7880 | TCP | LiveKit HTTP |
| 7881 | TCP | LiveKit TCP |
| 7882 | UDP | LiveKit WebRTC |
| 8000 | TCP | Dashboard |