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.

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

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

FeatureDockerVercelCloud Platforms
Full control⚠️
Custom domain
One-click deploy
Auto-scaling
Free tierVaries
Function timeoutUnlimited10sVaries
WebSocket supportVaries
File storageLocal/RustFSExternal S3Varies
DatabaseIncludedExternalVaries

Prerequisites

Before deploying LobeHub, gather the following:

Required

AI provider API keys — At minimum, you need an API key from one AI provider:

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

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:

  1. Use HTTPS — Always deploy with SSL/TLS certificates
  2. Secure your database — Use strong passwords and restrict network access
  3. Environment variables — Store secrets securely (never in code)
  4. Authentication — Enable Better Auth for multi-user deployments
  5. 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

  1. Choose your deployment method — Docker for maximum control or Vercel for simplicity
  2. Gather API keys — Obtain API keys from your chosen AI providers
  3. Set up infrastructure — Provision database, Redis, and storage as needed
  4. Configure environment variables — See the environment variable reference
  5. Deploy — Follow the platform-specific guide above
  6. Configure authentication — Set up Better Auth for multi-user access