Deploy LibreChat

LibreChat on a pinned release: admin set at deploy, file search, Mongo

Deploy LibreChat

Just deployed

MongoDB

mongo:8.0

Just deployed

Just deployed

Deploy and Host LibreChat on Railway

LibreChat (MIT) is a self-hosted chat interface for OpenAI, Anthropic, Google, OpenRouter and other providers, with agents, file search, conversation search and accounts for several people.

This template runs a pinned LibreChat release (v0.8.7) with MongoDB, Meilisearch for searching conversations, and LibreChat's RAG API on pgvector for chatting with uploaded files.

About Hosting LibreChat

LibreChat gives the admin role to the first account that registers, so on a public URL whoever gets there first owns the instance. This template keeps registration closed from the start and creates the admin account itself: the deploy form asks for your email, a password is generated into ADMIN_PASSWORD, and a start step runs LibreChat's own create-user script with both. When the deploy finishes, open LIBRECHAT_URL and sign in with that email and ADMIN_PASSWORD.

OPENROUTER_KEY is optional. If you set it on the LibreChat service, everyone on the instance can chat with OpenRouter models, and the RAG API uses the same key for the embeddings behind file search. If you leave it empty, each user adds their own OpenRouter, OpenAI, Anthropic or Google key in the interface. When you add the key after deploying, redeploy the rag-api service too: in my test Railway redeployed LibreChat but left rag-api on the old value until I redeployed it.

Before publishing I tested it end to end. Registering a new account returned "Registration is not allowed", and the admin signed in with the admin role. With an OpenRouter key set, a message to openai/gpt-4o-mini came back with the expected answer and LibreChat titled the conversation. A text file I uploaded was embedded by the RAG API. After a restart the admin signed in again and the conversations were still there.

Common Use Cases

  • One chat interface for a small team, with each person's provider keys stored encrypted
  • Upload documents to a conversation and ask questions about them

Dependencies for LibreChat Hosting

An API key for at least one model provider: set OPENROUTER_KEY for everyone, or let each user add their own in the interface. File search needs an embeddings key, which OPENROUTER_KEY covers.

Deployment Dependencies

Implementation Details

ADMIN_EMAIL / ADMIN_PASSWORD      # admin account, created on first start
ALLOW_REGISTRATION=false          # open it while your team signs up, then close it again
OPENROUTER_KEY                    # optional: chat for everyone + file search embeddings
CREDS_KEY / CREDS_IV              # encrypt the provider keys users save (generated, keep them)
MONGO_URI                         # MongoDB with a password, private network only
RAG_API_URL                       # rag-api service, private network only

Five services: LibreChat, MongoDB, Meilisearch, VectorDB (pgvector) and rag-api. Uploads, generated images and logs go on a volume on the LibreChat service. Meilisearch has no volume on purpose: some Railway plans allow three volumes per project (my first version used four and wasn't allowed to deploy), and LibreChat rebuilds the search index from MongoDB when it starts.

To move to a newer release, set LIBRECHAT_VERSION (an image tag such as v0.8.8) on the LibreChat service. The official Railway template runs the nightly librechat-dev:latest image instead; a pinned tag only changes when you change it. The RAG API image is only published as librechat-rag-api-dev-lite:latest.

Idle, LibreChat used 0.60 GB of RAM, MongoDB 0.33 GB, rag-api 0.19 GB, Meilisearch 0.16 GB and VectorDB 0.09 GB.

Why Deploy LibreChat on Railway?

The instance is yours from the first minute, with no open sign-up for someone else to claim, and every database stays on Railway's private network. Idle RAM for the five services comes to about $14 a month; model usage is billed by your providers.


Template Content

MongoDB

mongo:8.0

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