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

nest-boot

v3.0.1

Published

A Nest framework (node.js) module for getting config parameters when the app is running.

Readme

Description

A component of nestcloud. NestCloud is a nest framework micro-service solution.

中文文档

A Nest module to get configurations when the app bootstrap.

Installation

$ npm i --save nest-boot

Quick Start

Import Module

import { Module } from '@nestjs/common';
import { BootModule } from 'nest-boot';

const env = process.env.NODE_ENV;

@Module({
  imports: [BootModule.register(__dirname, `bootstrap-${env}.yml`)],
})
export class ApplicationModule {}

Yaml Config File

eg: bootstrap-development.yml.

web:
  name: example-service
  port: 3000

Usage

There are two ways to get configurations, the first, use get method:

import { Injectable } from '@nestjs/common';
import { InjectBoot, Boot } from 'nest-boot';

@Injectable()
export class TestService {
  constructor(@InjectBoot() private readonly boot: Boot) {}

  getPort() {
      return this.boot.get('web.port', 3000);
  }
}

The second, use @BootValue:

import { Injectable } from '@nestjs/common';
import { InjectBoot, Boot, DynamicBoot, BootValue } from 'nest-boot';

@Injectable()
export class TestService extends DynamicBoot {
  @BootValue('web.port', 3000)
  private readonly port: number; 
  
  constructor(
      @InjectBoot() private readonly boot: Boot
  ) {
      super(boot);
  }

  getPort() {
      return this.port;
  }
}

Get configurations with env.

nest-boot supports get configurations with env, use ${} expression, example:

web:
  serviceId: ${ SERVICE_ID || example-service }
  serviceName: ${ SERVICE_NAME || example-service }
  port: 3000

API

class BootModule

static register(path: string, filename: string): DynamicModule

Import nest boot module.

| field | type | description | | :--- | :--- | :--- | | path | string | the config file path | | filename | string | the config filename |

class Boot

get<T>(path: string, defaults?: T): T

Get configurations

| field | type | description | | :--- | :--- | :--- | | path | string | path of configurations | | defaults | any | default value if the specific configuration is not exist |

getEnv(): string

Get current NODE_ENV value, if not set, it will return 'development'.

getFilename(): string

Get the current config filename.

getConfigPath(): string

Get the current path of the config file.

getFullConfigPath(): string

Get the current full path of the config file.

Decorator

InjectBoot(): PropertyDecorator

Inject Boot instance.

BootValue(path: string, defaultValue?: any): PropertyDecorator

Set configuration to class attribute.

Stay in touch

License

NestCloud is MIT licensed.