Deploy Pact Broker

Pact Broker 2.121: share and verify consumer-driven API contracts.

Deploy Pact Broker

/var/lib/postgresql/data

Deploy and Host Pact Broker on Railway

The Pact Broker stores and shares consumer-driven contracts between services. Consumer tests publish pacts, provider builds fetch and verify them, and the broker records which versions work together. Its can-i-deploy check tells your pipeline whether a release is safe, which makes integration testing of microservices faster and less brittle.

About Hosting Pact Broker

This template runs the official pactfoundation/pact-broker:3.0.0-pactbroker2.121.2 image with a Railway Postgres database. Basic authentication is on, with two generated accounts: admin can publish pacts and results, and reader can only read them. Anonymous visitors get a login prompt, except for the heartbeat endpoint used as the health check. On first boot, the start command waits until the database hostname resolves, then the broker creates its schema. The web UI and the HAL API share one HTTPS domain. Anonymous usage pings from the image are turned off. It fits the Hobby plan.

Common Use Cases

  • Sharing contracts between consumer and provider CI pipelines
  • Gating deployments with can-i-deploy checks
  • Triggering provider verification with webhooks when a pact changes

Dependencies for Pact Broker Hosting

  • pactfoundation/pact-broker:3.0.0-pactbroker2.121.2 (official image)
  • Railway Postgres

Deployment Dependencies

Implementation Details

ServiceSourceNetworkingStorage
pact-brokerpactfoundation/pact-broker:3.0.0-pactbroker2.121.2public HTTPSPostgres
PostgresRailway Postgresprivatevolume
VariablePurpose
PACT_BROKER_BASIC_AUTH_USERNAME / _PASSWORDRead-write account (admin)
PACT_BROKER_BASIC_AUTH_READ_ONLY_USERNAME / _PASSWORDRead-only account (reader)
PACT_BROKER_ALLOW_PUBLIC_READfalse; set true to let anyone read
PACT_BROKER_BASE_URLPublic URL used in links

Publish from CI:

pact-broker publish ./pacts --broker-base-url "$PACT_BROKER_BASE_URL" \
  --broker-username admin --broker-password "$PACT_BROKER_BASIC_AUTH_PASSWORD" --consumer-app-version "$GIT_SHA"

Set PACT_BROKER_DATABASE_CLEAN_ENABLED=true to prune old data on a schedule.

This is a community-maintained deployment package and does not imply affiliation with or endorsement by the Pact Foundation.

Why Deploy Pact Broker 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 Pact Broker 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