Build a Circuit Breaker
Build a Circuit Breaker in TypeScript: Closed, open and half-open states with a failure threshold. Readable code with a live playground.
Closed, open and half-open states with a failure threshold.
Related
- Circuit Breaker States — Simulation
- Microservices Lab — Lab
Other builds
- Build Your Own Cache — put(), get(), LRU eviction and TTL expiry.
- Build a Consistent Hash Ring — Virtual nodes and minimal key movement when servers change.
- Build a Mini Message Broker — Topics, partitions, offsets and consumer groups in ~100 lines.
- Build a Retry Mechanism — Exponential backoff with jitter and a retry budget.
- Build a Simple Event Bus — Publish/subscribe with isolated subscriber failures.
- Build a Repository — A collection-like interface backed by an in-memory store.
- Build a Unit of Work — Track new, dirty and removed objects; commit them together.
- Build a Simple CQRS System — Commands update a write model; events project read models.