Nestjs Actuator
A module to monitor your Nestjs applications.
Description
Nestjs-actuator is a NestJS module (Typescript) implementation of the Spring Actuator API .
This project was inspired by Pyctuator.
This module aims to register and monitor NestJS application through Spring Boot Admin. However, this module can also be used just to expose the endpoints provided.
The project come with only one hard dependency, @nestjs/schedule
which might be removed in the future.
Installation
$ npm install --save @glosur/nestjs-actuator
How to use
Import ActuatorModule
into the root ApplicationModule
import { Module } from '@nestjs/common';
import {ActuatorModule} from "./actuator.module";
@Module({
imports: [
ActuatorModule.forRoot({
registration : {
adminServerUrl: 'http://localhost:8080', // URL of the spring boot admin server
name: 'myApp', // Name of your app
serviceUrl: 'http://localhost:3000', // URL to register with to Spring Boot Admin. This is what Spring Boot Admin will try to call to fetch informations.
auth: { // Optional, needed if you secured your Spring Boot Admin Server
"username": "username",
"password": "pwd"
}
}
}),
]
})
export class ApplicationModule {}
Supported SBA features
- Version: Display the version of the app
- Environment: Display environment variables (Hiding sensible ones)
More to come !
Actuator Endpoints security
This project does not provide any security on the exposed endpoints. Apply a middleware to /actuator
to protect it.
However make sure to make the Spring Boot Admin Server aware of those security concerns through metadata.
Compatibility version
This module has only be tested againt NestJS 7+. It might work with lower versions.
License
MIT licensed