---
title: "Deploy Langfuse Prompt Management"
description: "Versioned LLM prompts with labels, rollback and tracing"
category: "AI/ML"
url: https://railway.com/deploy/langfuse-prompt-management
---

# Deploy Langfuse Prompt Management

Versioned LLM prompts with labels, rollback and tracing

**[Deploy Langfuse Prompt Management on Railway](https://railway.com/template/langfuse-prompt-management)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/langfuse-prompt-management/manifest.json

- **Creator:** onepush
- **Category:** AI/ML

## Template content

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

### ClickHouse

- **Image:** clickhouse/clickhouse-server:24.8

### langfuse-web

- **Image:** langfuse/langfuse:3
- **Public domain:** Yes

### langfuse-worker

- **Image:** langfuse/langfuse-worker:3

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

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

## Buckets

- **langfuse-bucket**

## Documentation

# Deploy and Host self hosted Langfuse Prompt Management (Open-Source Prompt Versioning) on Railway

Langfuse Prompt Management takes prompts out of your codebase: every edit becomes an immutable version, labels decide what production serves, and the SDK fetches it at runtime. This template runs the full Langfuse v3 stack, so prompts, traces and per-version metrics live in one self-hosted, MIT-licensed place.

## About Hosting Langfuse Prompt Management open-source software on Railway (self hosted Langfuse prompt management template)

The template deploys six services. Prompts, versions, labels and config live in Postgres. `langfuse-web` serves the UI and the public prompts API on port 3000, with Redis as a server-side prompt cache. The worker ingests traces into ClickHouse 24.8, and a Railway Storage Bucket replaces MinIO for raw events and media. Shipping a prompt means moving the `production` label, not pushing code.

## Why Deploy Langfuse Prompt Management, the PromptLayer alternative on Railway (Railway Free Trial)

PromptLayer is a closed-source SaaS registry, so your prompt text lives on someone else's servers. Self-hosted Langfuse gives you versions, movable labels, SDK caching, versioned config, a playground and trace-linked metrics, and prompts stay in your Railway project.

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 Langfuse Prompt Management 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.

### Railway vs Other Hosting Providers and VPS for Langfuse Prompt Management self hosting

| Provider | Langfuse self-hosting experience |
|---|---|
| DigitalOcean | Compose on a Droplet; you handle ClickHouse volumes, HTTPS and Spaces or MinIO. |
| AWS | ECS or EKS plus RDS, ElastiCache, S3 and a self-run ClickHouse. Lots of wiring. |
| Hetzner | Cheap and solid, but bare. Docker, DNS, certs, backups and upgrades are yours. |

## Common Use Cases for hosted Langfuse Prompt Management

- **Prompt deploys without code deploys:** move `production` from version 3 to 4 in the UI, and move it back if replies get worse.
- **Model config in the prompt:** keep `model`, `temperature`, `max_tokens`, `response_format` and tools in each version's `config` JSON.
- **Tenants and A/B splits:** custom labels like `staging`, `tenant-a` or `prod-b`, fetched with `get_prompt("support", label="tenant-a")`.
- **Per-version metrics:** link the prompt to a generation and its Metrics tab shows latency, tokens, cost and scores by version.
- **Non-engineers editing prompts:** product people iterate in the UI and playground.

## Dependencies for Langfuse Prompt Management Docker hosted on Railway

All six services are required even if prompts are all you care about; v3 web won't run without Postgres, Redis, ClickHouse and the bucket. Secrets are generated per deploy with `${{secret()}}`. The one first-deploy chore: restart the worker once after web finishes migrations.

### Deployment Dependencies for Managed Langfuse Prompt Management Service (Prompt Versioning)

- **langfuse-web:** `langfuse/langfuse:3`, port 3000, UI plus the API your SDK calls for prompts.
- **langfuse-worker:** `langfuse/langfuse-worker:3`, port 3030, trace ingestion and evals.
- **Postgres:** prompts, versions, labels, users, API keys.
- **Redis:** prompt cache and ingestion queue, via `REDIS_CONNECTION_STRING` with `?family=0` for Railway's IPv6 network.
- **ClickHouse:** traces and scores linked to prompt versions, volume `/var/lib/clickhouse`.
- **Railway Storage Bucket:** S3-compatible raw events and media.

### Implementation Details for Langfuse Prompt Management (Using Langfuse official docker images)

Key variables: `DATABASE_URL`, the `CLICKHOUSE_*` set with `CLICKHOUSE_CLUSTER_ENABLED=false`, `LANGFUSE_S3_EVENT_UPLOAD_*`, `LANGFUSE_S3_MEDIA_UPLOAD_*`, `SALT`, `ENCRYPTION_KEY` (64 hex), `NEXTAUTH_SECRET`, `NEXTAUTH_URL`. On a cache miss the API reads Redis, then Postgres. Playground provider keys are LLM connections added under Project Settings, encrypted at rest with `ENCRYPTION_KEY`, so keep that value stable.

## How does Langfuse Prompt Management compare against other prompt management tools

### Langfuse vs LangSmith Prompt Hub

- **License:** Langfuse core is MIT. LangSmith is closed source and self-hosts only on Enterprise.
- **Deploy model:** Langfuse labels are pointers you move; no label in the request means `production`.

### Langfuse vs PromptLayer

- **Hosting:** PromptLayer is SaaS. Langfuse keeps prompt text in your own Postgres.
- **Config:** Langfuse versions model parameters, schemas and tools alongside the prompt text.

### Langfuse vs Agenta

- **Both open source:** Agenta is an LLMOps platform with a prompt playground and evals.
- **Langfuse's edge:** ClickHouse-backed tracing plus SDK caching and fallbacks for runtime fetches.

### Langfuse vs prompts in Git

- **Cadence:** Git prompts need a PR, merge and deploy. A label move reaches apps in about a minute.
- **Metrics:** Git can't show cost or scores per version. Langfuse links every generation to its prompt version.
- **Review:** Git has PR review built in. In Langfuse, use the version diff view and decide who may move `production`.

## How to use Langfuse Prompt Management (the OSS prompt management platform)?

1. Sign up on the web domain, create a project, and set `LANGFUSE_PUBLIC_KEY`, `LANGFUSE_SECRET_KEY` and `LANGFUSE_HOST` in your app.
2. Create a prompt in the UI or with `langfuse.create_prompt(name="support", type="text", prompt="Help a {{plan}} customer: {{question}}", labels=["production"])`. Text or chat type can't change later.
3. Fetch with `prompt = langfuse.get_prompt("support")`, which serves `production`. Pass `label="staging"` or `version=3` instead, never both (that's a 400). A missing label returns 404 with no silent fallback.
4. Fill variables with `prompt.compile(plan="pro", question=q)`. Reuse shared text with `@@@langfusePrompt:name=tone|label=production@@@`, and insert chat history with message placeholders.
5. Link it: `start_as_current_observation(as_type="generation", name="answer", prompt=prompt)` in Python.
6. Ship: save a new version, check the diff, move `production` in the UI or with `update_prompt(name="support", version=4, new_labels=["production"])`. Roll back the same way.

## How to self host Langfuse Prompt Management on other VPS Services (Langfuse self hosting guide)

Upstream's Docker Compose file targets one VM, with no high availability.

### Clone the Repository

Run `git clone https://github.com/langfuse/langfuse.git && cd langfuse`. `docker-compose.yml` sits in the root.

### Install Dependencies

Install Docker and Compose. The file runs web, worker, Postgres, Redis, ClickHouse and MinIO. Expose only port 3000 through a reverse proxy with HTTPS.

### Configure Environment Variables

Edit every value marked CHANGEME: database and ClickHouse passwords, a 64-hex `ENCRYPTION_KEY`, `SALT`, `NEXTAUTH_SECRET` and `NEXTAUTH_URL` set to your public URL.

### Start the Langfuse Prompt Management Application

Run `docker compose up -d`, wait for web migrations, then `docker compose restart langfuse-worker` if it errored early. Open port 3000 and create your project.

## Official Pricing of Langfuse Prompt Management (Langfuse pricing)

Langfuse Cloud: Hobby free (50k units/mo, 30 days, 2 users), Core $29/mo (100k units, 90 days), Pro $199/mo (3 years), Enterprise $2,499/mo. Extra units are $8 per 100k. Self-hosted MIT has no usage or seat limits. Prompt versions, labels, caching, config, the playground and experiments are all MIT. Protected prompt labels and project-level RBAC need an Enterprise license.

## Langfuse Prompt Management cloud vs self hosted comparison (Pricing, features, costs, and more)

Cloud has nothing to patch, but plans cap retention and units, and prompt text sits on Langfuse's servers. Self-hosting keeps prompts in your Railway project with unlimited versions and traces; you own upgrades and backups. Without EE, anyone with member access can move `production`, so keep people who shouldn't ship prompts on the viewer role.

### Monthly cost of self hosting Langfuse Prompt Management on Railway

Expect roughly $15-40/mo at low traffic, mostly ClickHouse memory. The $5 Railway trial covers a test deploy.

### System Requirements for Hosting Langfuse Prompt Management on a VPS

Upstream suggests 4 cores, 16 GiB RAM and 100 GiB disk for a single VM. ClickHouse is the memory hog; on Railway, raise its limit first. Back up Postgres separately, since that's where every prompt version lives.

## Frequently Asked Questions (FAQs)

### What happens if Langfuse is down when my app fetches a prompt?

The SDK serves its cached copy, even a stale one. A process starting with an empty cache gets an error unless you pre-fetch on startup or pass a `fallback` prompt, so do both in production.

### How fast does a label move reach production?

The default SDK cache TTL is 60 seconds, and stale prompts are served while refreshing in the background, so expect about a minute. Set `cache_ttl_seconds=0` in dev with `label="latest"`.

### What's the difference between labels and versions?

Versions are immutable snapshots numbered 1, 2, 3. Labels are movable pointers: `production` is the default, `latest` tracks the newest version, and custom labels cover environments or tenants.

### Can I lock the production label?

Protected prompt labels exist, but self-hosted they're an Enterprise Edition feature. In the MIT build, control it with org roles.

### Does fetching prompts add latency?

Cache hits are in-memory with no network call. Langfuse's own benchmark with caching disabled averaged about 40 ms per fetch against Cloud.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [stella](https://railway.com/deploy/stella) — Self-host stella with web, API, Postgres, Redis, and object storage.
- [Hermes Agent | OpenClaw Alternative with Dashboard](https://railway.com/deploy/hermes-agent-or-openclaw-alternative-wit) — Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

Open this page in a browser: https://railway.com/deploy/langfuse-prompt-management
