Guides
Configuration
All client options for cloud and self-hosted deployments
OpenfuseCloud (managed)
Connect to Openfuse's managed service at https://api.openfuse.io.
import { OpenfuseCloud } from '@openfuseio/sdk'
const openfuse = new OpenfuseCloud({
system: 'payments',
clientId: 'YOUR_CLIENT_ID',
clientSecret: 'YOUR_CLIENT_SECRET',
})Options
| Option | Type | Required | Description |
|---|---|---|---|
system | string | Yes | System slug that groups related breakers. Created in the dashboard. |
clientId | string | Yes | SDK client ID from the dashboard. |
clientSecret | string | Yes | SDK client secret from the dashboard. |
metrics | Partial<TMetricsConfig> | No | Override default metrics settings. See Metrics configuration. |
instanceId | string | No | Custom instance ID for metrics deduplication. Auto-detected if omitted. See Production. |
Openfuse (self-hosted)
Connect to your own Openfuse API deployment.
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',
})Options
| Option | Type | Required | Description |
|---|---|---|---|
baseUrl | string | Yes | Your Openfuse API base URL. |
system | string | Yes | System slug that groups related breakers. |
clientId | string | Yes | SDK client ID. |
clientSecret | string | Yes | SDK client secret. |
metrics | Partial<TMetricsConfig> | No | Override default metrics settings. |
instanceId | string | No | Custom instance ID for metrics deduplication. |
Metrics configuration
Metrics defaults come from the server. Override any of them:
| Option | Type | Default | Description |
|---|---|---|---|
windowSizeMs | number | 10000 | Aggregation window in milliseconds. |
flushIntervalMs | number | 15000 | How often to flush metrics to the backend. |
maxLatencySamples | number | 1000 | Max latency samples per window for percentile calculation. |
enabled | boolean | true | Set to false to disable metrics collection. |
const openfuse = new OpenfuseCloud({
system: 'payments',
clientId: 'YOUR_CLIENT_ID',
clientSecret: 'YOUR_CLIENT_SECRET',
metrics: {
flushIntervalMs: 30_000,
enabled: true,
},
})Secrets and environment variables
Keep clientId and clientSecret out of source code. Use your platform's secret management (environment variables, AWS Secrets Manager, Vault).
The SDK doesn't read environment variables directly. Load credentials from your environment or secret manager at runtime and pass them to the constructor.
Init options
Control the bootstrap process:
openfuse.init({
timeoutMs: 5000,
maxAttempts: 3,
})