pacto

module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2026 License: MIT

README

CI PkgGoDev Go Report Card codecov GitHub Release

Pacto

Pacto (/ˈpak.to/ — from Spanish: pact, agreement) is an open, OCI-distributed contract standard for cloud-native services.

It provides a single, declarative source of truth that bridges the gap between developers who build services and platform engineers who run them. A Pacto contract captures everything a platform needs to know about a service — its interfaces, configuration, runtime semantics, dependencies, and scaling requirements — without assuming any specific infrastructure.

Documentation

Full documentation is available at trianalab.github.io/pacto.

Quick example

pactoVersion: "1.0"

service:
  name: payments-api
  version: 2.1.0
  owner: team/payments

interfaces:
  - name: rest-api
    type: http
    port: 8080
    visibility: public
    contract: interfaces/openapi.yaml

runtime:
  workload: service
  state:
    type: stateful
    persistence:
      scope: local
      durability: persistent
    dataCriticality: high
  health:
    interface: rest-api
    path: /health

dependencies:
  - ref: ghcr.io/acme/auth-pacto@sha256:abc123
    required: true
    compatibility: "^2.0.0"

scaling:
  min: 2
  max: 10

Installation

Via installer script
curl -fsSL https://raw.githubusercontent.com/TrianaLab/pacto/main/scripts/get-pacto.sh | bash

Note: The installer script may request elevated permissions (sudo) to install the binary to /usr/local/bin. You can use --no-sudo to install without elevated permissions or set PACTO_INSTALL_DIR to a custom directory.

Via Go
go install github.com/trianalab/pacto/cmd/pacto@latest
Build from source
git clone https://github.com/TrianaLab/pacto.git
cd pacto
make build

Getting started

# Scaffold a new contract
pacto init my-service

# Validate
pacto validate my-service

# Pack and push
pacto pack my-service
pacto push ghcr.io/your-org/my-service-pacto -p my-service

License

MIT

Directories

Path Synopsis
cmd
pacto command
internal
app
cli
oci
testutil
Package testutil provides shared test mocks and fixtures used across multiple test packages to avoid duplication.
Package testutil provides shared test mocks and fixtures used across multiple test packages to avoid duplication.
pkg
tests
e2e/testplugin command
testplugin is a minimal pacto plugin for e2e testing.
testplugin is a minimal pacto plugin for e2e testing.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL