Quickstart

Get a valid Pacto contract running in under two minutes.


Table of contents

1. Install Pacto

go install github.com/trianalab/pacto/cmd/pacto@latest

2. Initialize a new contract

pacto init my-service

This creates a complete bundle structure:

my-service/
  pacto.yaml
  interfaces/
    openapi.yaml
  configuration/
    schema.json

3. Validate the contract

pacto validate my-service/pacto.yaml
my-service/pacto.yaml is valid

The generated contract passes all three validation layers out of the box.

4. Pack the bundle

pacto pack my-service/pacto.yaml
Packed my-service@0.1.0 -> my-service-0.1.0.tar.gz

5. Push to a registry

# Authenticate first
pacto login ghcr.io -u your-username

# Push the bundle
pacto push ghcr.io/your-org/my-service-pacto:0.1.0 -p my-service/pacto.yaml
Pushed my-service@0.1.0 -> ghcr.io/your-org/my-service-pacto:0.1.0
Digest: sha256:a1b2c3...

6. Pull from a registry

pacto pull ghcr.io/your-org/my-service-pacto:0.1.0

7. Inspect the contract

pacto explain my-service/pacto.yaml
Service: my-service@0.1.0
Owner: team/my-team
Pacto Version: 1.0

Runtime:
  Workload: service (finite)
  State: stateless
  Persistence: local/ephemeral
  Data Criticality: low

Interfaces (1):
  - api (http, port 8080, internal)

Scaling: 1-3

Next steps