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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@rebellionpay/nest-ms-template

v0.3.4

Published

A microservice schematics for nodejs

Downloads

2

Readme

Instalation and usage

tl;dr;

npm i -g @rebellionpay/nest-ms-template

# For generating an app
nest g -c @rebellionpay/nest-ms-template app

# For generating a controller
nest g -c @rebellionpay/nest-ms-template ctlr

What is this project?

This project is a schematic for generating NestJS projects. The CLI support custom schematics and that's what we have done here.

Scope

This project is done by RebellionPay and for covering the needs of RebellionPay. If this can help someone else, that would be great! But the main purpose of this package is to build a pave road for Rebellion dev team.

Usage

For using this as a collection for NestJS CLI you have to install this packages globally first:

npm i -g @rebellionpay/nest-ms-template

Then you can refer to the package from the nest CLI with:

# For generating an app
nest g -c @rebellionpay/nest-ms-template app

# For generating a controller
nest g -c @rebellionpay/nest-ms-template ctlr

Generating an app

If you generate an app, the available parameters are (will be asqued at runtime):

| Name | Type | Optional | Default | Description | |---------------------|---------|----------|-----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------| | name | string | No | - | The app name. Used in the code and in the folder name | | port | number | No | 3000 | The application port | | author | string | Yes | RebellionPay [email protected] | The project author. Appears in package.json | | description | string | Yes | - | The project description. Appears in package.json | | license | string | Yes | MIT | The project license. Appears in package.json | | transport | string | No | NATS | The messaging transport to use with NestJS. Right now only NATS is supported | | pure | boolean | No | false | Whether the app is a pure or an hybird one. Refer to NestJS documentation | | persistence | boolean | No | true | Whether the app is going to have persistence or not | | persistenceDB | string | Yes | - | The DB to generate configuration for. Available options are mongodb, postgresql, mysql and other | | useSpinnaker | boolean | No | true | This will include (or not) a step in the gitlab-ci file for notifying spinnaker when an image is pushed | | spinnakerUrl | string | Yes | - | The spinnaker API url for sending the notification to | | kubernetesNamespace | string | No | default | The kubernetes namespace that will appear in the manifest |

Example result

For an execution with the following answers:

? What name would you like to use for the new project? testing
? In which port will it run? 3000
? Which transport layer would you like to use? NATS
? Are you building a pure app? No
? Are you going to use persistence in a DB? Yes
? Which database would you like to use? mongodb
? Are you going to make the CD with spinnaker? No
? In which kubernetes namespace will this app going to be deployed? default

The generated tree will be:

.
├── README.md
├── kubernetes
│   └── manifest.yml
├── nest-cli.json
├── package.json
├── src
│   ├── app.controller.spec.ts
│   ├── app.controller.ts
│   ├── app.module.ts
│   ├── app.service.ts
│   ├── config
│   │   ├── MongoConfigService.ts
│   │   └── NATSConfigService.ts
│   ├── factory
│   │   └── winstonConfig.ts
│   ├── filters
│   │   └── ExceptionsFilter.ts
│   ├── interceptors
│   │   ├── InjectMetadataInterceptor.ts
│   │   ├── MetricsInterceptor.ts
│   │   └── TimeoutInterceptor.ts
│   ├── interface
│   │   └── MicroserviceMessage.ts
│   ├── main.ts
│   ├── message
│   │   ├── message.module.ts
│   │   ├── message.service.spec.ts
│   │   └── message.service.ts
│   └── metrics
│       ├── metrics.module.ts
│       └── metrics.service.ts
├── test
│   ├── app.e2e-spec.ts
│   └── jest-e2e.json
├── tsconfig.build.json
└── tsconfig.json

Developing

If you want to extend or customize the schematics you have to checkout the project and install the dependencies:

npm i

Then, you can do whatever changes you need to the schematics and, for testing your changes you should first build it:

npm run build

And then youn can refer to the project root folder as schematic for nest CLI:

nest g -c ./nestjs-microservice-template-project app