---
title: "Deploy Langflow Secured Agent Builder + Postgres"
description: "Langflow agent builder with login enforced, signup off and Postgres"
category: "AI/ML"
url: https://railway.com/deploy/langflow-secured-agent-builder-postgres
---

# Deploy Langflow Secured Agent Builder + Postgres

Langflow agent builder with login enforced, signup off and Postgres

**[Deploy Langflow Secured Agent Builder + Postgres on Railway](https://railway.com/template/langflow-secured-agent-builder-postgres)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/langflow-secured-agent-builder-postgres/manifest.json

- **Creator:** Protemplate
- **Category:** AI/ML
- **Total deploys:** 2

## Template content

### Langflow https://raw.githubusercontent.com/langflow-ai/langflow/main/src/frontend/public/icons/128x128.png

- **Image:** langflowai/langflow:1.13.1
- **Start command:** `sh -c 'i=0; while [ "$i" -lt 90 ]; do python -c "import socket,sys; socket.create_connection((sys.argv[1], 5432), 3)" "$DB_WAIT_HOST" 2>/dev/null && break; i=$((i+1)); echo "waiting for Postgres at $DB_WAIT_HOST:5432 ($i/90)"; sleep 2; done; exec langflow run'`
- **Health check:** /health_check
- **Public domain:** Yes

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:17

## Documentation

# 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

- [Langflow Docker deployment docs](https://docs.langflow.org/deployment-docker)
- [Langflow authentication docs](https://docs.langflow.org/api-keys-and-authentication)
- [Langflow GitHub repository](https://github.com/langflow-ai/langflow)

### 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.

```env
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.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius v0.1 Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

Open this page in a browser: https://railway.com/deploy/langflow-secured-agent-builder-postgres
