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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@prism-dev/nexus

v1.1.5

Published

A lightweight, event-driven, layer-stack framework for building modular Node.js applications with TypeScript.

Downloads

209

Readme

Nexus

Nexus. The composable backend. Build with intention

A lightweight, event-driven, layer-stack framework for building modular Node.js applications with TypeScript.

Nexus provides a simple yet powerful architecture for your backend applications, inspired by game engine design. It's built around two core concepts: a Layer Stack for processing logic in stages and a global Event Bus for decoupled, application-wide communication.

This structure allows you to build complex applications where components are completely isolated, making them easy to test, maintain, and scale.

Core Philosophy

  1. Layers: Your application logic is divided into Layers. An event or update tick flows through the stack, allowing each layer to inspect, handle, or pass on the data.

  2. Events: Layers and services don't call each other directly. Instead, they emit events (e.g., UserRegisterEvent) onto a central EventBus.

  3. Services: Other layers or services can listen for these events (e.g., EmailService listens for UserRegisterEvent) and react accordingly.

  4. DI: A simple, built-in ServiceLocator provides easy Dependency Injection for your services (like ConfigService or DatabaseService) without any "prop drilling."

Key Features

  • Layer Stack: A powerful middleware-like system. Push layers and overlays to manage logic flow.

  • Event-Driven: A global EventBus (Pub/Sub) allows deep decoupling between modules.

  • Simple DI: Built-in ServiceLocator for clean dependency injection.

  • Lightweight: Zero external dependencies in the core.

  • Type-Safe: Written entirely in TypeScript.

Nexus CLI

To speed up development and ensure best practices, we highly recommend using the official Nexus CLI. It handles all the boilerplate for you.

NPM Package: @prism-dev/nexus-cli

Installation

npm install -g @prism-dev/nexus-cli

Capabilities

The CLI allows you to instantly generate:

  • Projects: nexus create:project <project-name> (Sets up TS, directory structure, and config)

  • Layers: nexus create:layer <LayerName>

  • Events: nexus create:event <EventName>

  • Services: nexus create:service <ServiceName>

Ideal For

Nexus is perfect for any application that benefits from a clear separation of concerns:

  • Event-driven Microservices

  • Backend APIs (REST, GraphQL)

  • Real-time applications (WebSockets)

  • Chat Bots (Discord, Slack, etc.)

  • Game server backends

Basic Usage

Here is what a minimal app-api application looks like using Nexus. (Note: You can generate a full project structure automatically using the CLI).

main.ts

import {
    Application,
    ApplicationSpecification,
    Event,
    Layer,
    Log,
    ServiceLocator
} from "@prism-dev/nexus";

// 1. Define a simple Layer.
class MyLayer extends Layer {
    OnAttach(): void {
        Log.Info("MyLayer Attached!");
        // You can get services anywhere.
        // const config = ServiceLocator.Get(ConfigService);
    }

    OnDetach(): void {}
    OnUpdate(ts: number): void {}

    OnEvent(event: Event): void {
        Log.Info(`MyLayer saw event: ${event.Name}`);
    }
}

// 2. Create the Application.
(async () => {
    const spec: ApplicationSpecification = { Name: "MyApp" };
    const app: Application = new Application(spec);

    try {
        // 3. Register & Initialize Services.
        // app.RegisterService(ConfigService, new ConfigService());
        await app.InitializeServices();
    } catch (error: any) {
        Log.Error(`Failed to initialize services!: ${error.message}`);
        process.exit(1);
    }
    
    // 4. Push Layers.
    app.PushLayer(new MyLayer());

    // 5. Run the Application.
    app.Run();

    // 6. Handle shutdown.
    process.on('SIGINT', () => app.Close());
})();