10 packages · Apache-2.0 · TypeScript-first

The missing toolkit
for production backends

Composable building blocks for resilient Node.js backends — built from production experience with distributed systems. Framework-agnostic cores with optional NestJS integration and adaptive auto-tuning.

10packages
0runtime deps (core)
100%TypeScript
payment.service.ts
import { ok, fail } from '@backendkit-labs/result';
import { CircuitBreaker } from '@backendkit-labs/circuit-breaker';
 
const cb = new CircuitBreaker( {
name: 'stripe', failureThreshold: 40
} );
 
const result = await cb.execute( () => stripe.charges.create(dto) );
 
if (result.ok) {
return result.value; // Payment
}
// result.error is typed — no try/catch needed
result.ok === true
Philosophy

Designed with intent

Three principles that guide every decision in the BackendKit ecosystem.

🎯
Modular

Composable over monolithic

Each package solves one problem and solves it well. Mix and match freely — use result without circuit-breaker, or wire the full stack. No hidden coupling.

🔌
Universal

Framework-agnostic core

Zero-dependency core packages work in any Node.js project. Optional NestJS bindings live in /nestjs subpath exports — import only what you actually use.

TypeScript

Types first

The type system guides you toward correct usage. Errors are values in function signatures — not surprises at runtime. If it compiles, it's explicit.

Packages

Explore the libraries

Ten focused packages. Install only what you need — no bundled bloat.

RE

result

v0.2.1
@backendkit-labs/result

Result<T, E> is the semantic base of the entire BackendKit suite. Errors become first-class values in your type signatures: the compiler enforces that callers handle both the success and failure paths, map/flatMap compose chains without nesting, and run() safely wraps any throwing third-party code.

$ npm install @backendkit-labs/result
Features
  • Zero runtime dependencies
  • map, flatMap, andThen, orElse, mapError
  • run() catches exceptions at boundaries
  • match() for declarative branching
user.service.ts
import { ok, fail, type Result } from '@backendkit-labs/result';

interface User { id: string; name: string; email: string }
interface NotFoundError { type: 'not_found'; id: string }

async function getUser(id: string): Promise<Result<User, NotFoundError>> {
  const user = await db.users.findById(id);
  if (!user) return fail({ type: 'not_found', id });
  return ok(user);
}

const result = await getUser('usr_123');

if (result.ok) {
  console.log(result.value.name);  // TypeScript knows: User
} else {
  console.error(result.error.type); // TypeScript knows: 'not_found'
}
auto-learning

Your backend teaches itself to be resilient

Manual threshold tuning is guesswork. A timeout that works in staging breaks in production. auto-learning closes the feedback loop automatically — no ML models, no cloud services.

01
Monitor

Records latency percentiles, error rates, and call frequency per endpoint in a sliding window — continuously, in the background.

02
Detect

Z-score analysis and percentile thresholds flag latency spikes, error surges, and unknown traffic patterns before they cascade.

03
Adjust

Updates circuit breaker thresholds, bulkhead concurrency limits, and HTTP client timeouts automatically. No restart, no manual tuning.

↺ continuous loop — adapts as traffic changes
No ML models requiredNo cloud servicesStatistically deterministicPluggable StorageAdapter
Explore Auto-Learning
About

Built from experience,
not from theory

BackendKit started as internal utilities while working on Node.js backends that needed resilience under real production load — circuit breakers for payment integrations, bulkheads for third-party API isolation, typed errors to make failure visible across large codebases.

The patterns worked. I open-sourced them so others don't have to wire the same pieces together from scratch — or discover the edge cases the hard way.

The packages are battle-tested. The community around them is just getting started. That means your use cases, bug reports, and ideas have real weight in shaping what comes next.

Built by Mairon Cuello — backend engineer, distributed systems.
Origin

Built from real production problems — payment integrations, third-party API isolation, cascading failures under load. Not theoretical patterns.

Design principle

Packages designed to compose, not just coexist. Result, circuit breaker, retry, and pipeline share the same error model so they wire together without glue code.

The differentiator

auto-learning closes the feedback loop between observability and resilience config. Statistical analysis — percentiles, z-score — no external ML models required.

Benchmarks

Result is within 5% of raw try/catch. Circuit breaker uses an AsyncMutex for safe concurrent state transitions — the trade-off is explicit and measured.

View full results →
Install

Start in seconds

Install only what you need. Each package is independent.

# Install what you need
$npm install @backendkit-labs/result
$npm install @backendkit-labs/circuit-breaker
$npm install @backendkit-labs/http-client axios
✓ Tree-shakeable✓ ESM + CJS✓ Node 18+✓ TypeScript 5.x✓ Zero runtime deps (core)