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

@exium/core

v1.0.0-rc.0

Published

Opinionated NestJS-based framework for building DDD and Hexagonal Architecture microservices

Downloads

21

Readme

Exium

Opinionated NestJS-based framework for building DDD, hexagonal, modular-monolith-first microservices.

Exium is built primarily for Exium-based services. It is public so applications can install it from the npm registry, but it remains an opinionated platform framework rather than a generic NestJS replacement.

Published package:

npm install @exium/core

CLI package:

npm install -g @exium/cli
exium new order-management

Exium is designed as an internal platform framework. It intentionally ships with the infrastructure choices this codebase standardizes on:

  • NestJS runtime
  • Express HTTP adapter
  • MikroORM persistence
  • PostgreSQL and MongoDB persistence drivers
  • Kysely read-side query engine
  • RabbitMQ integration messaging
  • Redis cache and idempotency adapters

Layers

src/foundation      Result and failure primitives
src/domain          DDD building blocks
src/application     CQRS, middleware, ports, read contracts
src/infrastructure  Persistence, messaging, Redis, cache, idempotency adapters
src/http            External/internal HTTP contracts, responses, filters, interceptors
src/runtime         Outermost Nest runtime and Exium bootstrap

HTTP Model

HTTP endpoints can be marked as external or internal contracts.

External APIs are the public contract exposed through a gateway:

@Controller('orders')
@ExternalApi({ name: 'orders', owner: 'order-management' })
export class OrderController {}

Internal APIs are module/service-to-module/service contracts. Internal calls can resolve locally in a modular monolith or remotely over HTTP after extraction:

@Controller('orders/internal')
@InternalApi({ name: 'orders-internal', mode: 'auto' })
export class InternalOrderController {}

Application Model

Commands and queries return Result.

@Transactional()
export class CreateOrderCommand extends Command<string> {}

@HandleCommand(CreateOrderCommand)
export class CreateOrderCommandHandler extends CommandHandler<CreateOrderCommand> {
  async handle(command: CreateOrderCommand): Promise<ResultType<string>> {
    return Result.ok('order-id');
  }
}

Transactional commands commit only on Result.ok(...). Result.fail(...) rolls back.

Exception vs Result

Exium follows a strict policy:

  • Thrown exceptions = unexpected failures. Programmer errors, infrastructure faults, broken invariants. The exception filter logs them and surfaces a generic HTTP 500 — internal details never leak to clients.
  • Result.fail(Failure...) = expected business failures. Validation, not-found, business rule violations, conflicts, authentication/authorization denials. The response interceptor maps each Failure.kind to the appropriate 4xx status.
// Expected — return as Result
async handle(command: CreateOrderCommand): Promise<ResultType<string>> {
  if (await this.repo.exists(command.id)) {
    return Result.fail(
      Failure.conflict('ORDER_ALREADY_EXISTS', 'Order already exists.', {
        orderId: command.id,
      }),
    );
  }
  return Result.ok(command.id);
}

// Unexpected — let it throw, filter turns it into 500
if (!this.connection.isOpen) {
  throw new Error('Database connection is closed.');
}

HttpException is the only exception type that keeps its original status — preserved for compatibility with NestJS pipes (e.g. ValidationPipe).

Release Gate

Start the test databases first:

npm run test:db:up

Run the v1 gate:

npm test

The root test gate includes domain, config, infrastructure, application, core, HTTP, e2e, CLI workspace, and example build checks.

The CLI workspace smoke test also verifies that exium new order-management --skip-install creates a default Order aggregate project that typechecks. The CLI package is kept separate from @exium/core.

ADRs

Architecture decisions live in docs/adr.

Start with: