Deploy Langflow Secured Agent Builder + Postgres

Langflow agent builder with login enforced, signup off and Postgres

Deploy Langflow Secured Agent Builder + Postgres

Just deployed

Deploy and Host Langflow on Railway

Langflow is an open source visual builder for AI agents and workflows. You drag components (LLMs, prompts, vector stores, tools, MCP servers) onto a canvas, test them in the playground, and serve each flow as an API or an MCP server.

About Hosting Langflow

Hosting Langflow means running the Langflow server next to a PostgreSQL database that stores your flows, users and global variables, plus a persistent folder for uploaded files and knowledge bases. This template runs the official langflowai/langflow:1.13.1 image (pinned) with a volume at /app/langflow and a private PostgreSQL 17 service.

The instance is locked down from the first boot. Since version 1.13 Langflow requires sign in and will not start without an admin password, which is why many older templates now crash. Here the admin password and the encryption key are generated for you, automatic login is off, and public sign up is disabled, so nobody else can claim your instance.

Plan requirement: Langflow needs at least 2 GB of RAM. Deploy on the Railway Hobby plan or higher. The Free plan (0.5 GB per service) and the Trial (1 GB) run out of memory.

Common Use Cases

  • AI agents: build tool using agents with any LLM provider and test them in the playground
  • RAG pipelines: load documents, embed them into a knowledge base and chat with them
  • Flows as APIs: call any flow over REST from your own app
  • MCP servers: expose your flows as MCP tools for Claude, Cursor and other clients
  • Team prototyping: the admin adds teammates as users, each with their own projects

Dependencies for Langflow Hosting

  • PostgreSQL 15 or newer: included (PostgreSQL 17)
  • Railway Hobby plan or higher: 2 GB RAM minimum
  • LLM provider key: optional at boot; add it in Settings after you sign in

Deployment Dependencies

Implementation Details

The start command waits for Postgres on the private network, then runs langflow run on port 7860 with one worker. Railway checks /health_check, which confirms the database and cache are reachable. Database migrations run automatically on boot.

PORT=7860
LANGFLOW_PORT=7860
LANGFLOW_HOST=0.0.0.0
LANGFLOW_DATABASE_URL=${{Postgres.DATABASE_URL}}
LANGFLOW_CONFIG_DIR=/app/langflow
LANGFLOW_AUTO_LOGIN=false
LANGFLOW_SUPERUSER=admin
LANGFLOW_SUPERUSER_PASSWORD=${{secret(32)}}
LANGFLOW_SECRET_KEY=${{secret(64)}}
LANGFLOW_ENABLE_SIGNUP=false

First steps after deploy:

  1. Wait for the first boot to finish (a few minutes while components load).
  2. Open the Langflow URL and sign in as admin. The password is LANGFLOW_SUPERUSER_PASSWORD in the Langflow service Variables tab.
  3. Add your provider key under Settings, Global Variables (or set OPENAI_API_KEY or ANTHROPIC_API_KEY before deploying).
  4. Open a starter project, run it in the playground, then use the API or MCP tab to call it from your app.

Do not change LANGFLOW_SECRET_KEY after saving credentials, or they become unreadable. Changing LANGFLOW_SUPERUSER_PASSWORD later does not reset the admin password; change it in the UI instead.

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 get a secured visual agent builder with Postgres, generated secrets, persistent storage, health checks, managed SSL, and private networking to the rest of your stack.


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
Weaviate
Vector database with hybrid search and an API key-protected API

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

bento
1