Deploy LobeHub

LobeHub, formerly LobeChat: AI chat and agents with Postgres and storage

Deploy LobeHub

Just deployed

Just deployed

Deploy and Host LobeHub on Railway

LobeHub is an open-source AI chat and agent workspace: one interface for OpenAI, Anthropic, Google, OpenRouter, Ollama and many other providers, with agents, knowledge bases and file uploads. This template runs the server-database edition, where your chats, agents and settings live in your own Postgres and sync across devices.

About Hosting LobeHub

The deploy form asks for one thing: your email address. Only that address, or the addresses and domains you list there separated by commas, can create an account, so a stranger who finds your URL can't sign up. When the deploy finishes, open LOBEHUB_URL from the Variables tab of the lobehub service, sign up with that email and add your provider keys in LobeHub's settings. Keys saved there are encrypted with KEY_VAULTS_SECRET.

The template has three services: LobeHub itself on the official image, Postgres on ParadeDB (Postgres 17 with pgvector and pg_search, the image LobeHub's own compose file uses) and RustFS for uploaded files.

I started with a Railway Bucket for the files. LobeHub uploads from the browser straight to storage through signed links, which needs a CORS rule on the bucket, and Railway Buckets don't keep one: the API accepts the rule and stores nothing. RustFS does keep it, so this template uses RustFS, as LobeHub's compose file does. The bucket stays private. LobeHub shows files through signed links that expire, and anonymous requests get a 403.

LobeHub signs its internal service calls, file parsing for example, with an RSA key in JWKS_KEY, and those calls fail without it. A Railway template can't generate an RSA key, so a small start script creates one on first boot, stores it in the private bucket and reads it back on every restart. If you set JWKS_KEY yourself, yours is used.

Before publishing I ran the template end to end. Signing up with a different email was refused with EMAIL_NOT_ALLOWED and signing up with the allowed one worked. An upload through a signed link passed the browser's CORS check and landed in the bucket, and LobeHub parsed the file into chunks, which is the path that needs JWKS_KEY. A chat through OpenRouter answered. After a restart the account and the file were still there and the same signing key was reused.

The logs warn that QSTASH_TOKEN isn't set. That's Upstash's hosted queue, which LobeHub uses to create scheduled jobs; without it those are skipped, and chat, uploads and file parsing all worked in my test.

Common Use Cases

  • One chat interface for all your model providers, with history synced across your devices
  • Upload documents to a knowledge base and ask questions about them

Dependencies for LobeHub Hosting

An API key for at least one model provider (OpenAI, Anthropic, Google, OpenRouter and others), added in LobeHub's settings after you sign up.

Deployment Dependencies

Implementation Details

AUTH_ALLOWED_EMAILS=you@example.com          # who can sign up
APP_URL=https://
DATABASE_URL=${{Postgres.DATABASE_URL}}      # private network
KEY_VAULTS_SECRET, AUTH_SECRET               # generated per deploy
S3_ENDPOINT=https://          # browsers upload and load files here
S3_INTERNAL_ENDPOINT=http://:9000
S3_BUCKET=lobehub                            # created on first start, private
S3_ENABLE_PATH_STYLE=1
S3_SET_ACL=0

If you add a custom domain, set APP_URL to it and redeploy the lobehub service: the start script moves the bucket's CORS rule to the new address on every start.

The lobehub service builds from the newest LobeHub release, and LobeHub runs its database migrations on start. To stay on one version, set LOBEHUB_VERSION (an image tag) on the lobehub service.

Idle, the lobehub service used 0.44 GB of RAM, Postgres 0.32 GB and RustFS 0.07 GB.

Why Deploy LobeHub on Railway?

Your chats, agents and uploaded files stay in a database and bucket you own, behind a sign-up only you can use. The three services come to about $8 a month in RAM at idle; model usage is billed by your providers.


Template Content

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
116
View Template
stella
Self-host stella with web, API, Postgres, Redis, and object storage.

Jan Kubica
7
View Template
Hermes Agent | OpenClaw Alternative with Dashboard
Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

codestorm
81