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

@origins-digital/ui-auth

v2.1.0

Published

Configurable backoffice auth middleware for NestJS UIs (Bull Board, Swagger)

Readme

@origins-digital/ui-auth

Configurable backoffice login for Nest UIs (Bull Board, Swagger, or any path). By default login is required in every environment. Pass authRequiredEnvs to limit it (e.g. staging + production).

enforceUiAuth is the same helper in both places:

  • enforceUiAuth(authService) — middleware for Nest modules (Bull Board)
  • enforceUiAuth(app, token)app.use on publicRoute / extraPaths (Swagger)

BullBoardModule.forRootAsync runs in its own DI context — pass the same UiAuthModule.forRoot(...) into its imports.

Installation

npm install @origins-digital/ui-auth

Peer dependencies (already present in Origins Nest services): @nestjs/axios, @nestjs/common, @nestjs/config, @nestjs/jwt, @origins-digital/cacheable, @origins-digital/nestjs-shared-key, express, rxjs, zod.

import {
  UiAuthModule,
  UiAuthService,
  enforceUiAuth,
  DEFAULT_UI_AUTH_REQUIRED_ENVS,
} from '@origins-digital/ui-auth';
import { BullBoardModule } from '@bull-board/nestjs';
import { ExpressAdapter } from '@bull-board/express';

const uiAuthModule = UiAuthModule.forRoot({
  title: 'Payment Bull Board',
  authRequiredEnvs: DEFAULT_UI_AUTH_REQUIRED_ENVS, // omit for every env
  // optional: appEnvKey, backofficeApiHostKey, mountPath, publicRoute
});

@Module({
  imports: [
    uiAuthModule,
    BullBoardModule.forRootAsync({
      imports: [uiAuthModule],
      inject: [UiAuthService],
      useFactory: (auth: UiAuthService) => ({
        route: `/${auth.mountPath}`,
        adapter: ExpressAdapter,
        middleware: enforceUiAuth(auth),
        boardOptions: { uiConfig: { boardTitle: auth.title } },
      }),
    }),
  ],
})
export class ExampleModule {}

Second instance (e.g. Swagger)

Swagger lives at /docs (outside the Nest api prefix), so mount in main.ts:

import {
  UiAuthModule,
  SWAGGER_AUTH,
  enforceUiAuth,
  DEFAULT_UI_AUTH_REQUIRED_ENVS,
} from '@origins-digital/ui-auth';

const swaggerAuthModule = UiAuthModule.forRoot(
  {
    title: 'Payment Swagger',
    publicRoute: '/docs',
    cookieName: 'swagger_user_token',
    cookiePath: '/',
    extraPaths: ['/docs-json', '/docs-yaml'],
    authRequiredEnvs: DEFAULT_UI_AUTH_REQUIRED_ENVS,
  },
  SWAGGER_AUTH,
);

// AppModule imports: [swaggerAuthModule, ...]

// main.ts, before initSwagger:
enforceUiAuth(app, SWAGGER_AUTH);
initSwagger(app, serviceName, version);

cookiePath: '/' so /docs-json and /docs-yaml receive the same cookie.

Requires SharedKeyModule and the configured env keys (defaults: APP_ENV, BACKOFFICE_API_HOST) in the host app.