Deploy Prefect

Prefect 3.8 workflow orchestration server and UI with Postgres and login.

Deploy Prefect

/var/lib/postgresql/data

Deploy and Host Prefect on Railway

Prefect is a workflow orchestration framework for Python. You turn functions into flows and tasks with decorators, and the Prefect server tracks every run with retries, caching, schedules, concurrency limits and a detailed UI. Data pipelines, machine learning jobs and scripts become observable and repeatable without rewriting them.

About Hosting Prefect

This template deploys the Prefect v3.8.6 server and UI from the official image with a Railway Postgres database. The API and UI are protected with basic authentication using a generated password, and analytics are off. Flows running anywhere connect to the public API URL with the same credentials; workers on Railway can use the private URL. The server only orchestrates: add a worker service or run flows from your own machines and CI to execute work. The server is light and fits on the Hobby plan. Back up Postgres regularly to keep the run history.

Common Use Cases

  • Scheduling and monitoring Python data pipelines and ETL jobs
  • Orchestrating machine learning training and batch inference
  • Retries, alerts and visibility for scripts that used to run from cron

Dependencies for Prefect Hosting

  • prefecthq/prefect:3.8.6-python3.12 (official image)
  • Railway Postgres (ghcr.io/railwayapp-templates/postgres-ssl:18) with a volume

Deployment Dependencies

Implementation Details

ServiceImageNetworkingStorage
prefectprefecthq/prefect:3.8.6-python3.12public domain on 4200; privatenone (state in Postgres)
PostgresRailway Postgres 18private onlyvolume

Run a flow against the server:

export PREFECT_API_URL=https:///api
export PREFECT_API_AUTH_STRING="admin:"
python my_flow.py
VariableDefaultPurpose
PREFECT_SERVER_API_AUTH_STRINGadmin:Basic auth for the API and UI
PREFECT_API_DATABASE_CONNECTION_URLPostgres referenceDatabase (asyncpg)
PREFECT_PRIVATE_API_URLprivate URLFor workers on Railway

Notes:

  • The server listens on 0.0.0.0, so private clients connect over IPv4.
  • /api/health is open for Railway's health check; all other API routes need the login.

This is a community-maintained deployment package and does not imply affiliation with or endorsement by the Prefect project or its maintainers.

Why Deploy Prefect 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 Prefect 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

More templates in this category

View Template
N8N Main + Worker
Deploy and Host N8N with Inactive worker.

jakemerson
120
View Template
Evolution API with n8n
Automate WhatsApp workflows with Evolution API, n8n, and Postgres.

codestorm
95
View Template
Postgres Backup
Cron-based PostgreSQL backup to bucket storage

Railway Templates
870