@openfuseio/sdk
v0.3.0
Published
Openfuse SDK for Node.js - Circuit breaker management with zero runtime dependencies
Maintainers
Readme
Openfuse SDK for Node.js
Node.js client for the Openfuse circuit breaker service. Zero runtime dependencies.
Installation
npm install @openfuseio/sdkRequirements: Node.js >= 18.3 and an Openfuse account with an SDK client configured.
Quick start
import { OpenfuseCloud } from '@openfuseio/sdk'
const openfuse = new OpenfuseCloud({
system: 'payments',
clientId: 'YOUR_CLIENT_ID',
clientSecret: 'YOUR_CLIENT_SECRET',
})
openfuse.init()
const customer = await openfuse
.breaker('stripe-get-customer')
.protect(() => stripe.customers.retrieve(customerId), { fallback: () => cachedCustomer })If the stripe-get-customer breaker is open, fallback returns immediately — no network call attempted.
Documentation
- Quickstart — Zero to a protected call in under 2 minutes
- Protecting calls — Timeouts, fallbacks, and cancellation
- Error handling — Which methods throw and how to handle them
- Configuration — All client options for cloud and self-hosted
- API reference — Full API reference
Self-hosted
import { Openfuse } from '@openfuseio/sdk'
const openfuse = new Openfuse({
baseUrl: 'https://openfuse.your-domain.com',
system: 'payments',
clientId: 'YOUR_CLIENT_ID',
clientSecret: 'YOUR_CLIENT_SECRET',
})
openfuse.init()