This npm package provides generators and executors for NestJS applications within an Nx workspace. It helps streamline the setup of NestJS projects with features like Swagger, Sentry, health indicators, and standardized configurations. It also includes executors for generating package.json files and Swagger documentation.
Add the package to your workspace:
yarn add @rxap/plugin-nestjs
Execute the init generator:
yarn nx g @rxap/plugin-nestjs:init
Use the nx generate to create a new application:
NAME=app
nx g @nx/nest:application \
--name=service-$NAME \
--directory service/$NAME \
--projectNameAndRootFormat as-provided \
--tags service,nest
Initialize the application:
nx g @rxap/plugin-nestjs:init-application \
--project service-$NAME \
--cleanup \
--generateMain \
--overwrite
Use the nx generate to create a new standalone microservice:
nx g @rxap/plugin-nestjs:frontend-microservice --name $NAME
Run the following command to create a new frontend microservice:
nx g @rxap/plugin-nestjs:frontend-microservice --feature $FEATURE --frontend $PROJECT
Run the following command to create a new feature microservice:
nx g @rxap/plugin-nestjs:feature-microservice --feature $FEATURE --frontend $PROJECT
init generator
nx g @rxap/plugin-nestjs:init
Option | Type | Default | Description |
---|---|---|---|
project | string | ||
projects | array | ||
skipFormat | boolean | false | |
overwrite | boolean | false | Whether to overwrite existing files |
skipProjects | boolean | false | Whether to skip executing project specific initialization |
init-library generator
nx g @rxap/plugin-nestjs:init-library
Option | Type | Default | Description |
---|---|---|---|
project | string | ||
projects | array | ||
overwrite | boolean | false | Whether to overwrite existing files |
skipFormat | boolean | false | |
skipProjects | boolean | false | Whether to skip executing project specific initialization |
targets | object |
init-application generator
nx g @rxap/plugin-nestjs:init-application
Option | Type | Default | Description |
---|---|---|---|
project | string | ||
projects | array | ||
sentry | boolean | true | Whether this service should use sentry |
skipFormat | boolean | false | |
swagger | boolean | true | Whether this service should use swagger |
swaggerLive | boolean | false | Whether this service should start a swagger live server |
generateMain | boolean | false | Whether the main file should be generated |
healthIndicator | boolean | true | Whether this service should use a health indicator |
healthIndicatorList | array | A list of health indicators | |
validator | boolean | true | Whether this service use the ValidationPipe |
platform | string | express | |
port | number | The default port where the server is listens | |
apiPrefix | |||
pluginBuildInfoOptions | object | ||
pluginDockerOptions | object | ||
sentryDsn | string | Default sentry dsn | |
overwrite | boolean | false | Whether to overwrite existing files |
jwt | boolean | false | Whether the application should use jwt |
openApi | boolean | false | Whether the application should use openApi as client |
skipProjects | boolean | false | Whether to skip executing project specific initialization |
apiConfigurationFile | string | The api configuration file to use | |
standalone | boolean | false | Whether the nest service should be standalone |
typeorm | string | none | |
bootstrap | string | monolithic | |
transport | string | none | The transport to use for microservices communication |
minio | boolean | false | Whether the application should use minio |
openai | boolean | false | Whether the application should use openai |
swagger generator
nx g @rxap/plugin-nestjs:swagger
Option | Type | Default | Description |
---|---|---|---|
project | string | The name of the project. | |
overwrite | boolean | ||
standalone | boolean | false | Whether the nest service should be standalone |
sentry generator
nx g @rxap/plugin-nestjs:sentry
Option | Type | Default | Description |
---|---|---|---|
project | string | The name of the project. | |
dsn | string | Default sentry dsn | |
required | boolean | Whether or not the sentry dsn should be required to start the application | |
overwrite | boolean | false | Whether to overwrite existing files |
validator generator
nx g @rxap/plugin-nestjs:validator
Option | Type | Default | Description |
---|---|---|---|
project | string | The name of the project. | |
overwrite | boolean |
open-api generator
nx g @rxap/plugin-nestjs:open-api
Option | Type | Default | Description |
---|---|---|---|
project | string | ||
overwrite | boolean |
jwt generator
nx g @rxap/plugin-nestjs:jwt
Option | Type | Default | Description |
---|---|---|---|
project | string | ||
overwrite | boolean |
health-indicator generator
nx g @rxap/plugin-nestjs:health-indicator
Option | Type | Default | Description |
---|---|---|---|
name | string | The name of the health indicator class | |
project | string | The name of the project. | |
overwrite | boolean |
health-indicator-init generator
nx g @rxap/plugin-nestjs:health-indicator-init
Option | Type | Default | Description |
---|---|---|---|
project | string | The name of the project. | |
overwrite | boolean |
microservice generator
nx g @rxap/plugin-nestjs:microservice
Option | Type | Default | Description |
---|---|---|---|
name | string | The name of microservice | |
directory | string | The directory to create the microservice in | |
sentry | boolean | true | Whether this service should use sentry |
skipFormat | boolean | false | |
swagger | boolean | true | Whether this service should use swagger |
swaggerLive | boolean | false | Whether this service should start a swagger live server |
generateMain | boolean | Whether the main file should be generated | |
healthIndicator | boolean | true | Whether this service should use a health indicator |
healthIndicatorList | array | A list of health indicators | |
validator | boolean | true | Whether this service use the ValidationPipe |
platform | string | express | |
port | number | The default port where the server is listens | |
apiPrefix | |||
sentryDsn | string | Default sentry dsn | |
overwrite | boolean | false | Whether to overwrite existing files |
jwt | boolean | false | Whether the application should use jwt |
openApi | boolean | false | Whether the application should use openApi as client |
apiConfigurationFile | string | The api configuration file to use | |
standalone | boolean | false | Whether the nest service should be standalone |
feature-microservice generator
nx g @rxap/plugin-nestjs:feature-microservice
Option | Type | Default | Description |
---|---|---|---|
feature | string | The feature of the frontend project | |
sentry | boolean | true | Whether this service should use sentry |
skipFormat | boolean | false | |
swagger | boolean | true | Whether this service should use swagger |
swaggerLive | boolean | false | Whether this service should start a swagger live server |
generateMain | boolean | Whether the main file should be generated | |
healthIndicator | boolean | true | Whether this service should use a health indicator |
healthIndicatorList | array | A list of health indicators | |
validator | boolean | true | Whether this service use the ValidationPipe |
platform | string | express | |
port | number | The default port where the server is listens | |
sentryDsn | string | Default sentry dsn | |
overwrite | boolean | false | Whether to overwrite existing files |
jwt | boolean | false | Whether the application should use jwt |
openApi | boolean | false | Whether the application should use openApi as client |
apiConfigurationFile | string | The api configuration file to use | |
standalone | boolean | false | Whether the nest service should be standalone |
frontend-microservice generator
nx g @rxap/plugin-nestjs:frontend-microservice
Option | Type | Default | Description |
---|---|---|---|
frontend | string | The name of frontend project | |
feature | string | The feature of the frontend project | |
sentry | boolean | true | Whether this service should use sentry |
skipFormat | boolean | false | |
swagger | boolean | true | Whether this service should use swagger |
swaggerLive | boolean | false | Whether this service should start a swagger live server |
generateMain | boolean | Whether the main file should be generated | |
healthIndicator | boolean | true | Whether this service should use a health indicator |
healthIndicatorList | array | A list of health indicators | |
validator | boolean | true | Whether this service use the ValidationPipe |
platform | string | express | |
port | number | The default port where the server is listens | |
sentryDsn | string | Default sentry dsn | |
overwrite | boolean | false | Whether to overwrite existing files |
jwt | boolean | false | Whether the application should use jwt |
openApi | boolean | false | Whether the application should use openApi as client |
apiConfigurationFile | string | The api configuration file to use | |
standalone | boolean | false | Whether the nest service should be standalone |
package-json executor
Option | Type | Default | Description |
---|---|---|---|
dependencies | array | ||
includeLocalProjects | boolean | false | Include local projects in the package.json file, if they have a package.json file |
swagger-generate executor
Option | Type | Default | Description |
---|---|---|---|
buildTarget | string |