opossum: A Robust Node.js Circuit Breaker for Resilient Applications
This repository profile is provided by osrepos.com, an open source repository discovery platform.

Summary
opossum is a robust Node.js circuit breaker designed to enhance application resilience. It intelligently monitors asynchronous function executions, failing fast to prevent cascading failures when services are unstable. This library provides essential features like fallbacks and state management, ensuring your systems remain stable and responsive.
Repository Information
Topics
Click on any tag to explore related repositories
Use at your own risk
OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.
Introduction
opossum is a robust Node.js circuit breaker designed to enhance the resilience of your applications. It intelligently executes asynchronous functions and monitors their execution status, playing dead and failing fast when issues arise. This prevents cascading failures, ensuring your system remains stable and responsive even when dependent services are experiencing problems.
With over 1560 stars and 112 forks on GitHub, opossum is a well-regarded solution for implementing the circuit breaker pattern in Node.js environments. It offers features like configurable timeouts, error thresholds, and reset mechanisms, along with support for fallback functions and event-driven monitoring.
Installation
To integrate opossum into your Node.js project, simply install it via npm:
npm install opossum
Please note that opossum requires Node.js version 20 or higher.
Examples
Here's a basic example demonstrating how to use opossum to wrap an asynchronous function that might fail:
const CircuitBreaker = require('opossum');
function asyncFunctionThatCouldFail(x, y) {
return new Promise((resolve, reject) => {
// Simulate an operation that might fail or take time
if (Math.random() > 0.5) {
setTimeout(() => resolve(`Success with ${x}, ${y}`), 100);
} else {
setTimeout(() => reject(new Error(`Failure with ${x}, ${y}`)), 50);
}
});
}
const options = {
timeout: 3000, // If our function takes longer than 3 seconds, trigger a failure
errorThresholdPercentage: 50, // When 50% of requests fail, trip the circuit
resetTimeout: 30000 // After 30 seconds, try again.
};
const breaker = new CircuitBreaker(asyncFunctionThatCouldFail, options);
breaker.fire('arg1', 'arg2')
.then(console.log)
.catch(console.error);
You can also define a fallback function to provide a graceful degradation experience when the circuit is open:
const breakerWithFallback = new CircuitBreaker(asyncFunctionThatCouldFail, options);
breakerWithFallback.fallback(() => 'Sorry, the service is currently unavailable.');
breakerWithFallback.fire('arg1', 'arg2')
.then(console.log)
.catch(console.error);
Why Use opossum?
Implementing a circuit breaker like opossum offers significant advantages for modern distributed applications:
- Prevents Cascading Failures: By isolating failing services, opossum stops errors from propagating throughout your system, protecting healthy parts of your application.
- Improves Fault Tolerance: Your application becomes more resilient to transient failures in external dependencies, maintaining functionality even under stress.
- Graceful Degradation: Fallback functions allow you to provide alternative responses or default data when a service is unavailable, enhancing user experience.
- Real-time Monitoring: opossum emits various events (
open,close,failure,success,timeout, etc.) that enable real-time monitoring and alerting on service health. - Performance Optimization: Features like call coalescing can significantly improve performance by grouping multiple identical requests within a short timeframe.
- Browser Support: opossum can also be used in browser environments to guard against network failures in AJAX calls, making it versatile for full-stack resilience.
- Metrics Integration: Easily integrate with monitoring tools like Prometheus via opossum-prometheus or Hystrix Dashboard via opossum-hystrix for comprehensive insights.
Links
- GitHub Repository: https://github.com/nodeshift/opossum
- Documentation: https://nodeshift.dev/opossum/
- Typings: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/opossum
- Issue Tracker: https://github.com/nodeshift/opossum/issues
- Prometheus Integration: https://github.com/nodeshift/opossum-prometheus
- Hystrix Integration: https://github.com/nodeshift/opossum-hystrix
Related repositories
Similar repositories that may be relevant next.

Frontend Slides: Create Stunning Web Presentations with AI Coding Agents
June 28, 2026
Frontend Slides is an innovative GitHub repository that empowers users to create beautiful web presentations using AI coding agents. It simplifies the design process by offering visual style discovery and can even convert existing PowerPoint files into elegant HTML slides. This project is ideal for non-designers seeking professional, dependency-free presentations.
OrbitDB: Peer-to-Peer Databases for the Decentralized Web
June 22, 2026
OrbitDB is a serverless, distributed, peer-to-peer database designed for the decentralized web. It leverages IPFS for data storage and Libp2p Pubsub for automatic synchronization, ensuring eventual consistency through Merkle-CRDTs. This makes OrbitDB an excellent choice for p2p, decentralized, blockchain, and local-first web applications, offering various database types like event logs, documents, and key-value stores.

Open-Higgsfield-AI: Free, Self-Hosted AI Image Generation & Cinema Studio
June 15, 2026
Open-Higgsfield-AI offers an open-source, self-hosted alternative for AI image generation and a cinema studio. It provides access to over 20 models, including Flux, SDXL, Midjourney, and Ideogram, allowing users to create stunning visuals and cinematic content. This MIT-licensed project is fully customizable and designed for local operation.

Nextcloud Office Online: Seamless Document Integration
June 13, 2026
The `nextcloud/officeonline` repository provides an integration app for Nextcloud, enabling users to edit documents directly within their Nextcloud instance using an on-premise Office Online Server. This solution facilitates collaborative document editing and viewing, enhancing productivity for Nextcloud users. It specifically supports self-hosted Office Online Server deployments, not cloud-based Office 365.
Source repository
Open the original repository on GitHub.