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

@oneminutelogs/nestjs

v1.0.3

Published

NestJS SDK for OneMinuteLogs

Downloads

32

Readme

@oneminutelogs/nestjs

The official NestJS SDK for OneMinuteLogs.

This package provides a seamless integration with NestJS, including a Global Module, Service for manual logging, and an Interceptor for automatic request logging.

Official Documentation: oneminutestack.com/docs/nestjs

Features

  • Global Module: Initialize once, use everywhere via dependency injection.
  • Interceptor: Automatically logs every HTTP request with duration, status, and metadata.
  • Type-Safe Service: injectable OneMinuteLogsService with all typed log methods (info, error, audit, etc.).
  • Async Configuration: Support for forRootAsync to load config from ConfigService.

Installation

npm install @oneminutelogs/nestjs
# or
yarn add @oneminutelogs/nestjs
# or
pnpm add @oneminutelogs/nestjs

Quick Start

1. Import Module

Import OneMinuteLogsModule in your root AppModule.

import { Module } from "@nestjs/common";
import { OneMinuteLogsModule } from "@oneminutelogs/nestjs";

@Module({
  imports: [
    OneMinuteLogsModule.forRoot({
      apiKey: process.env.OML_API_KEY!,
      appName: "my-nestjs-service",
      environment: process.env.NODE_ENV || "development"
    }),
  ],
})
export class AppModule {}

2. Automatic Request Logging

Bind the OneMinuteLogsInterceptor globally in your main.ts or as a global provider.

Option A: In main.ts

import { OneMinuteLogsInterceptor, OneMinuteLogsService } from "@oneminutelogs/nestjs";

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  
  const omlService = app.get(OneMinuteLogsService);
  app.useGlobalInterceptors(new OneMinuteLogsInterceptor(omlService));
  
  await app.listen(3000);
}
bootstrap();

Option B: As a Provider (Recommended)

import { Module } from "@nestjs/common";
import { APP_INTERCEPTOR } from "@nestjs/core";
import { OneMinuteLogsModule, OneMinuteLogsInterceptor } from "@oneminutelogs/nestjs";

@Module({
  imports: [
    OneMinuteLogsModule.forRoot({ /* ... */ }),
  ],
  providers: [
    {
      provide: APP_INTERCEPTOR,
      useClass: OneMinuteLogsInterceptor,
    },
  ],
})
export class AppModule {}

3. Manual Logging

Inject OneMinuteLogsService into any provider or controller.

import { Injectable } from "@nestjs/common";
import { OneMinuteLogsService } from "@oneminutelogs/nestjs";

@Injectable()
export class AuthService {
  constructor(private readonly logger: OneMinuteLogsService) {}

  async validateUser(username: string) {
    // Info log
    await this.logger.info({ message: `Validating user ${username}` });
    
    // Security Audit
    await this.logger.audit({
      message: "Login attempt",
      security: {
        auth_status: "pending",
        user_id: username
      }
    });
  }
}

Async Configuration

If you need to load configuration asynchronously (e.g., from @nestjs/config), use forRootAsync.

import { ConfigModule, ConfigService } from "@nestjs/config";

OneMinuteLogsModule.forRootAsync({
  imports: [ConfigModule],
  useFactory: async (configService: ConfigService) => ({
    apiKey: configService.getOrThrow("OML_API_KEY"),
    appName: configService.get("APP_NAME"),
  }),
  inject: [ConfigService],
});

API Reference

OneMinuteLogsService

  • info(payload)
  • error(payload)
  • warning(payload)
  • audit(payload)
  • metric(payload)
  • debug(payload)
  • success(payload)
  • send(payload) (Generic)
  • get(filters) (Query logs)
  • stream(filters) (Stream logs)

Support

If you have any questions or need assistance, please contact us at [email protected].