Build Your Own LobeHub
LobeHub can be self-hosted on your own infrastructure, giving you complete control over your data, customization, and deployment environment. Whether you're deploying for a team, organization, or personal use, LobeHub supports multiple deployment methods.
Deploy with Vercel
Deploy with Docker
Deploy with Docker Compose
Deploy with Zeabur
Deploy with SealOS
Deploy with RepoCloud
Deploy with Dokploy
Architecture Overview
LobeHub consists of several key components:
Core Services
- Next.js application — Hybrid SSR/SPA frontend with API routes
- PostgreSQL database — Stores conversations, agents, files, and user data
- Redis (optional) — Session storage and caching
- S3-compatible storage — File uploads and knowledge base documents
Optional Services
- RustFS / MinIO — Self-hosted S3-compatible storage
- Langfuse — LLM observability and tracing
- OpenTelemetry — Distributed tracing
- Searxng — Privacy-focused web search
Choosing a Deployment Method
Docker Compose (Recommended)
Best for: Self-hosted installations, full infrastructure control, team deployments.
Pros:
- Complete stack in one command
- Easy updates with
docker compose pull - Includes PostgreSQL, Redis, RustFS, Searxng
- Full feature support — no timeout limits, WebSocket support
Cons:
- Requires server management
- Need to handle backups and monitoring
Vercel
Best for: Quick deployments, serverless scaling, low maintenance.
Pros:
- One-click deployment
- Automatic HTTPS and CDN
- Scales automatically
- Free tier available
Cons:
- Requires an external PostgreSQL database
- 10-second serverless function timeout limit
- No WebSocket support
- Less control over infrastructure
Cloud Platforms (Zeabur, Sealos, Dokploy)
Similar to Vercel with regional options. Good for specific geographic requirements with various pricing and feature differences.
Feature Comparison
| Feature | Docker | Vercel | Cloud Platforms |
|---|---|---|---|
| Full control | ✅ | ❌ | ⚠️ |
| Custom domain | ✅ | ✅ | ✅ |
| One-click deploy | ❌ | ✅ | ✅ |
| Auto-scaling | ❌ | ✅ | ✅ |
| Free tier | ✅ | ✅ | Varies |
| Function timeout | Unlimited | 10s | Varies |
| WebSocket support | ✅ | ❌ | Varies |
| File storage | Local/RustFS | External S3 | Varies |
| Database | Included | External | Varies |
Prerequisites
Before deploying LobeHub, gather the following:
Required
AI provider API keys — At minimum, you need an API key from one AI provider:
- OpenAI —
OPENAI_API_KEYfrom platform.openai.com - Anthropic —
ANTHROPIC_API_KEYfrom console.anthropic.com - Google —
GOOGLE_API_KEYfrom aistudio.google.com
See AI Provider Configuration for the full list of supported providers.
Database (for server deployment) — PostgreSQL 14+ is required:
- Managed options: Neon, Supabase, Railway, Vercel Postgres
- Self-hosted: Docker (included in Docker Compose), AWS RDS, Google Cloud SQL
Optional but Recommended
Redis — Improves performance for session storage, rate limiting, and caching. Use Upstash, Redis Cloud, or self-hosted Redis.
S3-compatible storage — Required for file uploads and knowledge bases:
- AWS S3 — Production-ready, scalable
- Cloudflare R2 — No egress fees
- RustFS / MinIO — Self-hosted S3 alternative (included in Docker Compose)
Authentication provider — For SSO and team features (Google OAuth, GitHub OAuth, Microsoft Azure AD, Auth0, Keycloak). See Authentication Setup for configuration.
Security Considerations
Never commit API keys or secrets to version control. Always use environment variables.
Essential security measures:
- Use HTTPS — Always deploy with SSL/TLS certificates
- Secure your database — Use strong passwords and restrict network access
- Environment variables — Store secrets securely (never in code)
- Authentication — Enable Better Auth for multi-user deployments
- Regular updates — Keep LobeHub and dependencies up to date
Authentication options:
- Open access — No authentication (single-user deployments only)
- Better Auth — Built-in auth with email/password, OAuth, magic links
- Reverse proxy — Use Authelia, Authentik, or similar
Next Steps
- Choose your deployment method — Docker for maximum control or Vercel for simplicity
- Gather API keys — Obtain API keys from your chosen AI providers
- Set up infrastructure — Provision database, Redis, and storage as needed
- Configure environment variables — See the environment variable reference
- Deploy — Follow the platform-specific guide above
- Configure authentication — Set up Better Auth for multi-user access