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

@veap/kernel

v0.1.6

Published

Core dependency injection container, event bus, and application lifecycle for Veap

Readme

CI Release Version

@veap/kernel

Core dependency injection container, event bus, application lifecycle, and system contracts for the Veap ecosystem.

Overview

@veap/kernel provides the foundational runtime primitives powering Veap applications and modular packages. It is runtime-agnostic (Node.js, Bun, Edge, and browser-safe subsets) and ships with a zero-dependency IoC container, strongly typed event bus, centralized configuration service, error handling utilities, and application builder abstractions.

Features

  • Dependency injection container: Lightweight TypeScript IoC container supporting singletons, transient instances, factory providers, constructor injection via @Injectable() and @Inject(), and resolution hooks.
  • Application lifecycle builder: Fluent Application.configure() builder orchestrating ServiceProvider registration, asynchronous boot sequences, and concurrency-safe bootstrap deduplication.
  • Typed event bus: High-performance asynchronous pub/sub event bus with wildcard matching (user:*) and subscription lifecycle management.
  • Result type & error handling: Unified Result<T, E>, AppError taxonomy (NotFound, Unauthorized, Forbidden, Validation, Conflict), and server-action error formatters (ok, err, handleActionError).
  • Standard service contracts: Abstract port tokens for cookies, HTTP request context, caching, logging, and database connections.

Installation

# Using bun
bun add @veap/kernel

# Using pnpm
pnpm add @veap/kernel

# Using npm
npm install @veap/kernel

Usage

IoC Container & Service Providers

Define injectable classes and custom service providers using the container:

import {
  container,
  app,
  Injectable,
  Inject,
  ServiceProvider,
} from "@veap/kernel";

export const GREETING_TOKEN = Symbol.for("app:greeting");

@Injectable()
export class GreeterService {
  constructor(@Inject(GREETING_TOKEN) private readonly prefix: string) {}

  public greet(name: string): string {
    return `${this.prefix}, ${name}!`;
  }
}

export class GreeterServiceProvider extends ServiceProvider {
  register(): void {
    this.container.register({
      token: GREETING_TOKEN,
      useValue: "Hello",
    });

    this.container.register({
      token: GreeterService,
      useClass: GreeterService,
      singleton: true,
    });
  }
}

Application Composition & Bootstrap

Compose multiple service providers and boot the system safely:

import { Application } from "@veap/kernel";
import { GreeterServiceProvider } from "./greeter.provider";

export const appInstance = Application.configure()
  .use(GreeterServiceProvider)
  .create();

let bootstrapPromise: Promise<void> | null = null;

export async function initializeSystem(): Promise<void> {
  if (!bootstrapPromise) {
    bootstrapPromise = (async () => {
      await appInstance.bootstrap();
    })().catch((err) => {
      bootstrapPromise = null;
      throw err;
    });
  }
  return bootstrapPromise;
}

Event Bus

Publish and subscribe to typed asynchronous events:

import { eventBus } from "@veap/kernel";

// Subscribe to a specific topic
const unsubscribe = eventBus.subscribe("user:registered", async (payload) => {
  console.log("New user registered:", payload);
});

// Publish an event
await eventBus.publish("user:registered", {
  userId: "usr_123",
  email: "[email protected]",
});

// Clean up listener when no longer needed
unsubscribe();

Result Type & Action Error Handling

Safely wrap server actions or service boundaries with standardized results:

import { ok, err, handleActionError, type Result } from "@veap/kernel";

export async function calculateRatio(
  a: number,
  b: number,
): Promise<Result<number>> {
  try {
    if (b === 0) {
      return err("Division by zero is not allowed");
    }
    return ok(a / b);
  } catch (error) {
    return handleActionError(error, "Math:CalculateRatio");
  }
}

Subpath Exports

| Export Path | Content | | --------------------- | ---------------------------------------------------------------- | | @veap/kernel | All core IoC, Application, events, config, cache, and error APIs | | @veap/kernel/server | Server-specific entry points and CLI infrastructure |

Documentation

For full guides and framework architecture patterns, visit:

License

MIT