BBC Consumer Contracts
github.com
What it is
BBC Consumer Contracts is a free JavaScript package for executable consumer-driven API contracts. It describes the requests a consumer makes and the responses expected in return. Every contract requires consumer, name, request, and response properties. The package uses the request HTTP client and Joi schemas to check response status codes, headers, and JSON bodies. Optional before and after functions support setup and cleanup, using callbacks or asynchronous functions. Retry behavior accepts numeric or custom settings; the documented default maximum is zero. The consumer-contracts run command validates contracts recursively in a contracts directory or runs one named file. Programmatic callers can pass an array to validateContracts, which runs every contract instead of stopping at the first failure. Installation instructions cover global CLI use and local pnpm development dependencies. It requires Node.js 18 or later and pnpm 10 or later, and supports API and self-hosted use under Apache License 2.0.
Spec sheet
- Purpose
- Consumer Contracts lets API consumers define executable JavaScript contracts describing the responses they expect from services.Read 8 Oct 2026 · github.com
- Integrations
- The project uses the request HTTP client and Joi for response validation.Read 8 Oct 2026 · github.com
- Security
- The README shows SSL request configuration options, including client certificates and a strictSSL setting, but states no security certification or compliance claim.Read 8 Oct 2026 · github.com
- License
- The repository license identifies Apache License 2.0 and says to contact the BBC for an alternative licence.Read 8 Oct 2026 · github.com
- Founded
- 2017Read 28 Sep 2026 · github.com
- CLI
- The command line tool can run all contracts recursively from a contracts directory or run a single contract by filename.Read 8 Oct 2026 · github.com
- Command line
- The consumer-contracts run command validates contracts recursively in a contracts directory or can run a specified contract file.Read 7 Oct 2026 · github.com
- Contract fields
- Each contract requires a consumer name, contract name, request, and response.Read 8 Oct 2026 · github.com
- Installation
- The README documents global CLI and local development dependency installation with pnpm.Read 8 Oct 2026 · github.com
- Programmatic use
- The package exposes validateContracts for validating an array of contracts in application code.Read 8 Oct 2026 · github.com
- Response checks
- Response validation can cover status codes, headers, and JSON bodies.Read 8 Oct 2026 · github.com
- Retries
- Contracts support fixed or custom retry logic, with the maximum retries defaulting to 0.Read 8 Oct 2026 · github.com
- Runtime requirements
- The package metadata specifies Node.js version 18 or later and pnpm version 10 or later.Read 8 Oct 2026 · github.com
- Security configuration
- Request options may include SSL configuration, and the README documents setting strictSSL to false when strict trust checking is not required.Read 7 Oct 2026 · github.com
- Setup and cleanup
- Contracts can run asynchronous or callback based setup before execution and cleanup afterward.Read 8 Oct 2026 · github.com
- Validation
- It uses HTTP requests and Joi schemas to validate API responses.Read 8 Oct 2026 · github.com
Plans and prices
Strong points and limits
Strong points
- Free plan with no paid plans stated
- Validates statuses, headers, and JSON bodies
- Runs contracts recursively or by filename
- Programmatic validation runs every contract
- Supports setup, cleanup, and retries
Limits
- Requires Node.js 18 or later
- Requires pnpm 10 or later
- Documented default maximum retries is zero
- Uses JavaScript contract format
Who it suits
It suits JavaScript teams defining and checking API expectations between consumers and providers. Self-hosted projects needing command-line or programmatic validation can use it.
Verdict
BBC Consumer Contracts focuses on executable API expectations, with CLI and programmatic validation paths. Its requirements and Apache License 2.0 are specified, while deployment is self-hosted.
Where Specifiction places it
- Contract Testing Tools#8 of 228.1