Deploy Langflow

Self-hosted Langflow: build AI agents and RAG apps visually, with Postgres.

Deploy Langflow

/var/lib/postgresql/data

Just deployed

Deploy and Host Langflow on Railway

Langflow logo

Langflow is the open-source visual builder for AI agents and RAG apps, with 155,000+ GitHub stars: drag components for models, vector stores, tools and memory onto a canvas, test them live, and expose any flow as an API or MCP server. Hosted agent platforms like Lindy start at $49.99 per user per month — self-host Langflow on Railway for ~$10–20/month plus your model usage.


What This Template Deploys

ServicePurpose
LangflowLangflow visual editor and API (langflowai/langflow, port 7860, public HTTPS domain).
PostgresPostgreSQL storing flows, users, API keys and message history.
Persistent VolumeMounted on Postgres at /var/lib/postgresql/data — flows and history survive redeploys.

Two services. Langflow stores everything in Postgres through LANGFLOW_DATABASE_URL, so the app container itself can be replaced freely.


About Hosting Langflow

Langflow runs Python components and can execute code, so a public instance needs a real login, a persistent database and a fixed secret for stored credentials. Run locally with defaults, it auto-logs everyone in as the superuser — fine on a laptop, dangerous on the internet.

On Railway, Langflow gets an HTTPS domain, a Postgres database and a generated LANGFLOW_SECRET_KEY. You add a superuser password and it's ready for your team.

Set a superuser password before you deploy. Current Langflow images turn auto-login off and refuse to start without LANGFLOW_SUPERUSER_PASSWORD. Set LANGFLOW_SUPERUSER and LANGFLOW_SUPERUSER_PASSWORD, keep LANGFLOW_AUTO_LOGIN=false, and consider LANGFLOW_NEW_USER_IS_ACTIVE=false so new accounts need approval.

Typical cost: ~$10–20/month on Railway (Langflow uses about 1–2 GB of RAM), plus the model API usage you choose. Lindy's Team plan is $49.99 per active user per month.


Deploy Langflow in Under 5 Minutes

  1. Add LANGFLOW_SUPERUSER and LANGFLOW_SUPERUSER_PASSWORD to the Langflow service.
  2. Click Deploy on Railway — Langflow and Postgres start (~3–5 minutes).
  3. Open the public URL and sign in with your superuser.
  4. Add your model provider key (OpenAI, Anthropic, Google, Ollama endpoint) in Langflow's global variables.
  5. Build a flow from a starter template, test it in the playground, and call it through the API.

No Python environment to manage. No local-only setup. No per-seat pricing.


Common Use Cases

  • Self-hosted AI agent builder — "langflow self hosted" with your own models and data
  • RAG chatbots — chat over PDFs and docs with a vector store of your choice
  • Agents with tools — give models search, APIs and code tools visually
  • MCP servers — expose flows as MCP tools for Claude and other clients
  • API backends for AI features — call flows from your app over REST
  • Prototyping LLM apps — test prompts and chains before writing code

Configuration

VariableRequiredDescription
LANGFLOW_SUPERUSER / LANGFLOW_SUPERUSER_PASSWORD✅ Add theseAdmin login. Langflow won't start without a password when auto-login is off.
LANGFLOW_AUTO_LOGINRecommendedKeep false so visitors must sign in.
LANGFLOW_SECRET_KEY🔐 Auto-generatedEncrypts stored credentials. Never change it.
LANGFLOW_DATABASE_URL✅ Auto-injectedPostgres connection. Prefer the private Postgres URL.
LANGFLOW_LOG_LEVELOptionaldebug by default — use info or error in production.
PORT / LANGFLOW_PORTAuto-set7860.

Never expose Langflow with auto-login on. Anyone who reaches the URL would act as the superuser and could run code on the server.


Langflow vs. Alternatives

Langflow on RailwayLindyFlowiseDify
Monthly cost~$10–20 + model usage$49.99 per user (Team)Free, you host itFree, you host it
Self-hosted✅ Yes❌ No✅ Yes✅ Yes
Bring your own model✅ Yes❌ No✅ Yes✅ Yes
Visual flow editor✅ Yes✅ Yes✅ Yes✅ Yes
Flows as API and MCP✅ Yes⚠️ Limited✅ API✅ API
Per-user pricing✅ None❌ Per user✅ None✅ None
License✅ MIT❌ Proprietary⚠️ Open core⚠️ Custom open-source license

Dependencies for Langflow Hosting

  • Railway account — plan for ~1–2 GB RAM for Langflow plus a small Postgres.
  • An AI model provider key (OpenAI, Anthropic, Google) or your own Ollama endpoint.

Deployment Dependencies

Implementation Details

The template runs the official langflowai/langflow image on port 7860 with LANGFLOW_DATABASE_URL pointing at the Postgres service, so flows, users and API keys live in the database rather than the container.

Before going live: set the superuser credentials, keep auto-login off, lower the log level from debug, and point the database URL at the private Postgres endpoint. Pin a specific Langflow version instead of latest once you're happy with it.


Frequently Asked Questions

What is Langflow and why self-host it? Langflow is a visual builder for AI agents and RAG workflows that turns flows into APIs. Self-hosting keeps prompts, documents and keys on your infrastructure and lets you use any model.

How much does Langflow cost to host compared to hosted agent platforms? About $10–20/month in Railway usage plus your model costs. Lindy's Team plan is $49.99 per active user per month.

Why won't Langflow start, or why does it say the superuser password is required? Current Langflow images disable auto-login and require LANGFLOW_SUPERUSER_PASSWORD. Add LANGFLOW_SUPERUSER and LANGFLOW_SUPERUSER_PASSWORD to the Langflow service and redeploy.

Do I lose my flows when I redeploy? No. Flows, users, API keys and message history are stored in Postgres on a persistent volume.

Can I use local models with Langflow? Yes. Point Langflow's Ollama component at an Ollama server you host (for example another Railway service), or use any OpenAI-compatible endpoint.

Is Langflow safe to expose on the internet? Only with authentication on: keep LANGFLOW_AUTO_LOGIN=false, set a strong superuser password, and restrict sign-ups. Keep the image updated, since older versions had serious vulnerabilities.


Why Deploy and Host 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 get a private visual AI agent builder with Postgres-backed storage and an HTTPS API for a flat usage cost plus the models you choose.


Template Content

More templates in this category

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

okisdev
117
View Template
NEW
Möbius v0.1 Personal AI OS
Self-hosted AI agent that builds and runs apps for you, with memory.

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

Jan Kubica
7