Deploy Langflow
Langflow: visual builder for AI agents and RAG flows, with Postgres
Langflow
Just deployed
/app/langflow
Just deployed
/var/lib/postgresql/data
Deploy and Host Langflow with Railway
Langflow is the open-source visual builder for AI agents and RAG pipelines: drag components onto a canvas, wire models, prompts, tools, vector stores and memory together, test in a built-in chat, then call the result as an API or MCP server. This template deploys the official Langflow image pinned by digest with a Postgres 17 database, a persistent volume for uploaded files and the encryption key, every secret generated for you, and a deployment healthcheck. There is nothing to fill in. After the deploy, open the public URL and log in as admin with the password in the Langflow service's Variables tab (LANGFLOW_SUPERUSER_PASSWORD).
Plan requirements. Measured on this exact image: Langflow idles around 1.25 GB (measured after five idle minutes on two fresh deploys) and needs about 1.6 GB peak while it loads its component catalogue; Postgres adds about 60 MB. It is killed on a 1 GB limit (verified) and runs comfortably at 2 GB. Hobby plan or higher (8 GB limit) is required; it will not start on Free or Trial. Upstream's own Railway guide states the same 2 GB minimum.
About Hosting Langflow
Langflow runs as one Python service that serves the editor, the API and flow execution. Flows, users, API keys and global variables live in Postgres; the volume at /app/langflow holds the encryption key that protects stored credentials, uploaded files and profile pictures. Schema migrations run automatically on start, including on upgrades. Login is required (LANGFLOW_AUTO_LOGIN=false) because the service is reachable on a public domain; the first account is the generated superuser, and new sign-ups stay inactive until an admin activates them. The container runs as root on Railway so it can write to the root-owned volume mount - the same approach Railway's own database templates take.
Common Use Cases
- Prototype a RAG pipeline over your documents with OpenAI, Anthropic, Gemini, Ollama or any OpenAI-compatible endpoint
- Build a multi-tool agent visually, then expose it as a REST endpoint or MCP server for your app
- Give a non-engineering team a hosted playground with per-user logins and shared global API keys
- Evaluate prompts and models side by side in the built-in chat before committing to code
- Run scheduled or webhook-triggered flows without standing up your own orchestration
Dependencies for Langflow Hosting
langflowai/langflow:1.12.2(Docker Hub, pinned by digest)ghcr.io/railwayapp-templates/postgres-ssl:17(Railway's Postgres image, pinned by digest) on a/var/lib/postgresql/datavolume
Deployment Dependencies
- Langflow documentation and the environment variable reference
- Langflow on GitHub (MIT)
- Railway volumes and private networking
Implementation Details
First run. Open the Langflow service's public domain. Log in with username admin and the value of LANGFLOW_SUPERUSER_PASSWORD from the Variables tab. Change it under your profile if you like. Add provider keys either as OPENAI_API_KEY / ANTHROPIC_API_KEY service variables (both optional, then redeploy) or as global variables inside Langflow, which are encrypted with LANGFLOW_SECRET_KEY.
Calling flows from code. Create an API key under your profile, then POST https://YOUR-DOMAIN/api/v1/run/FLOW_ID with an x-api-key header. Each flow's API access panel shows the exact request.
Generated secrets. LANGFLOW_SECRET_KEY, LANGFLOW_SUPERUSER_PASSWORD and the Postgres password are generated at deploy time. Back up LANGFLOW_SECRET_KEY with your database backups: rotating it makes stored provider keys unreadable.
Healthcheck. Railway polls /health_check (which also checks the database) before routing traffic to a new deployment, so redeploys and upgrades cut over only once migrations have finished.
Persistence. Redeploys and restarts keep every flow, user and key (Postgres volume) and the encryption key and uploads (/app/langflow volume). A Postgres restart makes /health_check report db: error for a few seconds; Langflow reconnects on its own.
Upgrades. The image is pinned. To upgrade, change the Langflow service's image tag to a newer release and redeploy; Langflow migrates the schema on start. Read the release notes first - component changes can affect existing flows.
Variables you may want to change. LANGFLOW_NEW_USER_IS_ACTIVE (false) gates sign-ups behind admin activation. DO_NOT_TRACK (true) disables telemetry. Remove LANGFLOW_AUTO_LOGIN=false only if the service is not reachable from the internet.
Risks. Flows execute arbitrary components, including code and HTTP calls, with the service's network access - only give accounts to people you trust. Pinned images receive security fixes when you upgrade, not automatically. Railway's fair-use policy applies to what your flows do.
Why Deploy Langflow on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Langflow on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content
