OSS-first docs

These docs teach the open system first: contracts, generated surfaces, runtimes, governance, and incremental adoption. Studio shows up as the operating layer on top, not as the source of truth.

AI index

Integration Circuit Breakers

External APIs are the most common source of instability. Wrap every integration call in a circuit breaker to protect your system.

Pattern

Create a dedicated circuit breaker instance for each external service. This ensures that a failure in Stripe doesn't trigger the circuit breaker for Twilio.

// integrations/stripe.ts
import { CircuitBreaker } from '@contractspec/lib.resilience/circuit-breaker';

const stripeBreaker = new CircuitBreaker({
  failureThreshold: 10,
  resetTimeoutMs: 60000,
});

export async function createCharge(amount: number) {
  return stripeBreaker.execute(() => stripe.charges.create({ amount }));
}