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

@modulator/core

v1.1.1

Published

The `core` package provides foundational features for building modular, event-driven Node.js applications. It includes:

Readme

Nodesmith Core

The core package provides foundational features for building modular, event-driven Node.js applications. It includes:

  • Dependency Injection (DI) Container
  • Event Bus
  • Module Loader
  • Type Definitions for Modules

Installation

npm install @yourorg/core

Features

1. Dependency Injection (DI) Container

A simple, class-based DI container for registering and resolving dependencies.

Register a class:

import { container } from '@yourorg/core';

container.register('EmailService', EmailServiceClass, { singleton: true });

Resolve a class:

const emailService = container.resolve<EmailService>('EmailService');
  • Supports singleton and transient lifecycles.
  • All dependencies are registered and resolved by string keys.

2. Event Bus

A lightweight event bus for decoupled communication between modules.

Usage:

import { container, EventBus } from '@yourorg/core';

// Register EventBus as a singleton in the DI container
container.register('EventBus', EventBus, { singleton: true });

// Resolve the singleton EventBus instance
const eventBus = container.resolve<EventBus>('EventBus');

// Listen for events
eventBus.on('user.created', (user) => {
  console.log('User created:', user);
});

// Emit events
eventBus.emit('user.created', { id: 1, name: 'Alice' });
  • Register and remove event handlers.
  • Emit events with arbitrary payloads.
  • Always resolve the EventBus from the DI container to ensure a single shared instance.

3. Module Loader

Automatically loads enabled modules based on your config/modules.json file.

Usage:

import { loadEnabledModules } from '@yourorg/core';

const modules = loadEnabledModules();
  • Scans the modules/ directory for modules with a module.json manifest.
  • Automatically enables new modules and removes stale ones.
  • Validates module dependencies and migration files.

4. Type Definitions

TypeScript interfaces for module manifests and lifecycle hooks.

Example:

import { ModuleManifest, LoadedModule, NodesmithModuleHooks } from '@yourorg/core';
  • ModuleManifest: Describes a module’s metadata, dependencies, and assets.
  • LoadedModule: Represents a loaded module with its manifest and path.
  • NodesmithModuleHooks: Lifecycle hooks for modules (init, registerRoutes, registerModels, onShutdown).

Example: Registering and Using the Event Bus via DI

import { container, EventBus } from '@yourorg/core';

// Register EventBus as a singleton
container.register('EventBus', EventBus, { singleton: true });

// Resolve and use
const eventBus = container.resolve<EventBus>('EventBus');
eventBus.emit('app.started');

Directory Structure

core/
  di/
    container.ts
  events/
    eventBus.ts
  loaders/
    moduleLoader.ts
  types/
    index.ts
  index.ts
  package.json

Contributing

Feel free to open issues or PRs to improve the core features!