
Deploy Pact Broker
Pact Broker 2.121: share and verify consumer-driven API contracts.
Just deployed
Just deployed
/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-deploychecks - 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
| Service | Source | Networking | Storage |
|---|---|---|---|
| pact-broker | pactfoundation/pact-broker:3.0.0-pactbroker2.121.2 | public HTTPS | Postgres |
| Postgres | Railway Postgres | private | volume |
| Variable | Purpose |
|---|---|
PACT_BROKER_BASIC_AUTH_USERNAME / _PASSWORD | Read-write account (admin) |
PACT_BROKER_BASIC_AUTH_READ_ONLY_USERNAME / _PASSWORD | Read-only account (reader) |
PACT_BROKER_ALLOW_PUBLIC_READ | false; set true to let anyone read |
PACT_BROKER_BASE_URL | Public 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
