Vue Storefront is now Alokai! Learn More
Circuit Breaker

Circuit Breaker

A circuit breaker is a resilience pattern that monitors requests to a backend and temporarily stops sending traffic when failures exceed a threshold. This prevents a single slow or failing service from cascading into a full storefront outage.

The Alokai middleware includes a built-in circuit breaker for each integration — no setup required.


Quick Start

1. Nothing to configure

A circuit breaker is automatically created per integration when it receives its first request.

2. (Optional) Choose a preset

In middleware.config.ts:

integrations: {
  commerce: {
    location: "./integrations/commerce/index.server.ts",
    configuration: { /* ... */ },
    circuitBreaker: { preset: "BALANCED" },
  },
}

Available presets: BALANCED (default), AGGRESSIVE, FAST_FAILURE, HARD_FAIL, RELAXED_DEBUG, TOLERANT, EXTREME_DEBUG

3. (Optional) Override preset values

All preset fields can be overridden per integration if needed.


Summary

  • Automatic protection per integration
  • Easy preset-based configuration
  • Clear logging & metrics
  • Zero boilerplate

If your backend slows down or fails, the Circuit Breaker prevents everything else from breaking along with it.