
Deploy Langflow: Visual AI agent builder
Visual builder for AI agents, RAG flows and MCP servers, with Postgres
Just deployed
/var/lib/postgresql/data
Langflow
Just deployed
/app/langflow
Deploy and Host Langflow on Railway
Langflow is an open-source visual builder for AI agents and LLM workflows. You build flows by connecting components on a canvas: models from any major provider, vector stores and tools. Each flow you build can be called as a REST API or used as a tool on an MCP server. This template runs Langflow with PostgreSQL, sign-in required from the first boot and your superuser password generated for you, on a pinned Langflow release tested together with its database.
About Hosting Langflow
Langflow runs as one container next to a PostgreSQL database. Your flows, users, API keys and encrypted global variables live in PostgreSQL; uploaded files, knowledge bases and Langflow's encryption key live on a persistent volume, so everything survives redeploys. Public sign-up is off, login cookies are HTTPS-only and browser API calls are limited to your own domain. You sign in as the superuser and start building. Model provider keys go in Langflow's own settings after you sign in.
Common Use Cases
- AI agents with tools. Start from the Simple Agent template, pick a model from OpenAI, Anthropic, Google, OpenRouter, Ollama and others, and give it tools such as web search and URL fetching.
- RAG over your own documents. Ingest files into a knowledge base and build retrieval flows that answer from them.
- Flows as an API. Call any flow from your own app with a Langflow API key and keep the prompt logic in Langflow.
- An MCP server for your AI tools. Each project exposes its flows as tools on its own MCP server, ready for Claude, Cursor or any MCP client.
How to Use Langflow After Deployment
- Wait for both services to go green. The first boot takes about a minute while Langflow sets up its database.
- Open the Langflow service, then Settings, then Networking. The generated domain there is your Langflow URL.
- On that service's Variables tab, copy
LANGFLOW_SUPERUSER(the username,langflow) and the generatedLANGFLOW_SUPERUSER_PASSWORD. - Visit your Langflow URL and sign in with them.
- Click Create first flow, then add a model provider with Configure Model Providers and paste your provider API key.
- Pick a template such as Simple Agent and open the Playground to try it.
Is Langflow Free?
The software is free and open source under the MIT license, and this template adds no licence cost. You pay Railway for the infrastructure it runs on, and your model providers for the tokens your flows use through your own keys.
FAQ
How do I add a teammate? The free edition of Langflow has no admin page since version 1.12, so the superuser can add additional users through the API:
- Sign in as
langflow(the password is in the Langflow service'sLANGFLOW_SUPERUSER_PASSWORDvariable), open Settings, then Langflow API Keys, and create a key. - Create the user. New accounts start inactive:
curl -X POST "https://YOUR_DOMAIN/api/v1/users/" -H "Content-Type: application/json" -H "x-api-key: YOUR_API_KEY" -d '{"username": "DESIRED_USERNAME", "password": "STRONG_PASSWORD"}'
- Copy the
idfrom the response and activate the account:
curl -X PATCH "https://YOUR_DOMAIN/api/v1/users/USER_ID" -H "Content-Type: application/json" -H "x-api-key: YOUR_API_KEY" -d '{"is_active": true}'
Your teammate can now sign in.
Docs: Langflow Users API
My MCP client gets "API key required". What do I change? A project's MCP Server tab can show "Auth: None" and a client config without a key, but the server still requires a Langflow API key. On that tab, click Add Auth, choose API key, then Generate API key, and copy the JSON config again: it now carries the key in its --headers arguments.
Can anyone sign up to my Langflow? No. Public sign-up is off (LANGFLOW_ENABLE_SIGNUP is false), and the login page's Sign Up link is refused by the server. Set it to true only if you want open registration; new accounts still start inactive until the superuser activates them.
I added a custom domain. What else do I change? Add the new address to LANGFLOW_CORS_ORIGINS on the Langflow service, comma-separated after the Railway domain (for example https://${{RAILWAY_PUBLIC_DOMAIN}},https://YOUR_DOMAIN), then redeploy.
Where is my data, and how do I back it up? Flows, users, API keys and global variables are in the bundled PostgreSQL. The Postgres service's DATABASE_PUBLIC_URL variable connects pg_dump or any Postgres client from outside for backups. Uploaded files and knowledge bases are on the Langflow service's volume.
Dependencies for Langflow Hosting
- PostgreSQL 18: stores flows, users, API keys and global variables.
Deployment Dependencies
Implementation Details
The superuser is created on first boot from LANGFLOW_SUPERUSER and LANGFLOW_SUPERUSER_PASSWORD; changing the password variable later does not change an existing account's password, so change it under Settings, then General. LANGFLOW_SECRET_KEY encrypts stored API keys and global variables; changing it later makes them unreadable. Every other setting is in the environment variable reference and can be added as a variable on the Langflow service.
How to Upgrade: change the image tag on the Langflow service and redeploy; the database schema updates on boot. You can also let Railway do it: open each service's Settings, find Source, and use Configure Auto Updates with a maintenance window. Turn it on for both services or for neither; this template ships versions that were tested together. The pre-update volume backup is a Pro plan feature, so take your own backup first on Hobby, and detection can lag a new release by a few hours.
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

