npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@infinityi/forge

v1.3.0

Published

The boring infrastructure layer your business logic deserves. An opinionated, composable, Bun-first toolkit for distributed systems: telemetry, resilience, config, data, messaging, http, security, and lifecycle.

Readme

🛠️ Forge

The boring infrastructure layer your business logic deserves.

Bun Version TypeScript License: MIT


🎯 Project Goal

Most production applications stand on the same nine infrastructure pillars. Yet, most teams reinvent them—usually poorly, under time pressure, and without realizing they are solving already-solved problems.

Forge exists to eliminate the "infrastructure tax." It is an opinionated, composable toolkit that handles the heavy lifting of distributed systems so your team can spend time on what the app does (business value), rather than how it survives (infrastructure).

Forge makes the right way the easy way.


⚡ Tech Stack

Forge is unapologetically built for modern, high-performance backend development.

  • TypeScript (Strict Mode): Every module is heavily typed. Configurations are inferred, database queries are type-checked, and resilience policies are strictly validated at compile time.
  • Bun Runtime: Forge is Bun-first. We leverage Bun's native TypeScript execution, blazing-fast startup times, built-in test runner, and native APIs (like bun:sqlite for lightweight outbox/job queues) to keep overhead near zero.

Why Bun?

Node.js served us well, but modern backends need faster feedback loops and lower memory footprints. Bun provides native TS execution without transpilation overhead, a Jest-compatible test runner that runs in milliseconds, and a bundler that makes deploying single-binary serverless functions trivial.


📦 Core Modules

Forge is modular. Import only what you need; tree-shaking ensures zero bloat.

| Module | Purpose | | :--- | :--- | | forge/telemetry | Structured logging, distributed tracing, and metrics (Prometheus/OTLP) with automatic context propagation. | | forge/resilience | Composable decorators for retry, timeout, circuitBreaker, bulkhead, and rateLimit. | | forge/config | Schema-validated, fail-fast configuration and secrets management. Typed access, redacted logging. | | forge/preference | User-owned runtime preferences with fail-safe reads, validated writes, durable stores, scopes, and migrations. | | forge/data | Connection pooling, Unit of Work (transactions), type-safe query building, and migration tooling. | | forge/messaging | Transactional Outbox pattern, idempotent consumers, Dead Letter Queues (DLQ), and background jobs. | | forge/http | Resilient HTTP client, server middleware stack, OpenAPI generation, and RFC 7807 Problem Details. | | forge/security | JWT/JWKS validation, declarative AuthZ middleware, and automated audit logging. | | forge/lifecycle | Graceful shutdown orchestration, dependency health probes (liveness/readiness), and signal handling. |


🧠 Design Principles

  1. Bun First: Leverage Bun's native APIs instead of reinventing them. Use Bun.serve() for HTTP servers, Bun's built-in fetch for HTTP requests, bun:sqlite for lightweight persistence, and bun:test for testing. If Bun already provides a capability—don't wrap it, don't polyfill it, don't replace it with a third-party library. Forge extends Bun; it doesn't abstract it away.
  2. Composable, Not Monolithic: Use forge/resilience without forge/data. There are no forced peer dependencies.
  3. Interfaces First: Every module exposes an interface (Logger, Cache, MessageBus) with real and in-memory implementations. Testability is a first-class feature.
  4. Observable by Default: Every operation emits metrics and traces unless explicitly silenced. You cannot fix what you cannot see.
  5. Fail-Fast at Boot: Misconfigurations and missing secrets crash the app in milliseconds during startup, not 3 hours later in production.
  6. Zero Magic: No hidden control flow, no global state, no decorator-based dependency injection containers. Explicit wiring only.

🚧 Constraints (What Forge is NOT)

A good library knows its boundaries. To keep Forge lean and focused, we explicitly do not build:

  • A UI/Frontend Framework: Forge is strictly for backend/server-side infrastructure.
  • A Domain Modeler: We do not enforce DDD, CQRS, or Event Sourcing. Your business entities are your own.
  • A Heavy ORM: No identity maps, no lazy-loading proxies, no hidden N+1 queries. We provide a type-safe query builder and raw SQL execution.
  • A Workflow/BPMN Engine: For complex, long-running state machines, use dedicated tools like Temporal or Inngest.
  • A Service Mesh: We handle application-level resilience. Network-level mTLS and routing should be handled by your infrastructure (e.g., Kubernetes, Istio).

🚀 Quick Start

Installation

bun add @infinityi/forge

Bootstrapping an App

import { forge, databaseComponent, httpServerComponent } from '@infinityi/forge/lifecycle';
import { serve, type HttpServer } from '@infinityi/forge/http';
import { config } from './config';
import { db } from './data';
import { router } from './http';

const server: HttpServer = serve(router, { port: config.http.port });

const app = await forge.boot({
  config,
  logger: console,
  components: [
    databaseComponent('db', db),
    httpServerComponent('http', server),
  ],
  shutdownTimeout: 30_000, // Graceful shutdown window
});

app.logger.info('Forge application started', {
  port: config.http.port,
});

Running Tests

Forge ships with in-memory doubles for all core interfaces, making unit testing with Bun's native test runner effortless:

import { describe, it, expect } from 'bun:test';
import { InMemoryMessageBus } from '@infinityi/forge/messaging/testing';

describe('Order Service', () => {
  it('publishes an event when an order is placed', async () => {
    const bus = new InMemoryMessageBus();

    await bus.publish({
      type: 'OrderPlaced',
      payload: { orderId: '123' },
    });

    expect(bus.publishedEvents).toContainEqual({
      type: 'OrderPlaced',
      payload: { orderId: '123' },
    });
  });
});

Run tests at lightning speed:

bun test

🤝 Contributing

We welcome contributions! Please read our Contributing Guide to get started.

Development Setup:

git clone https://github.com/your-org/forge.git
cd forge
bun install
bun run build
bun test

📄 License

Forge is open-source software licensed under the MIT License.