Skip to main content



Installs and configures App Insights in your NodeJS app.

This generator will add and configure applicationinsights npm package for you.


  • Requires a NodeJs server for application insights to hook into.

Use the @nx/next:custom-server generator which will have been added to your workspace by @ensono-stacks/workspace` to generate your NodeJS server!

  • Requires the APPLICATIONINSIGHTS_CONNECTION_STRING environment variable to be set.

There is a known issue with the @nx/next:custom-server impacting customServerTarget when typescript libraries are present in the monorepo. Please check the following Github Issue for the status of this issue.


nx generate @ensono-stacks/azure-node:app-insights

Command line arguments

The following command line arguments are available:

--projectTarget project name.string
--applicationinsightsConnectionStringThe env variable that stores the app insights connection string.string
--serverPath to custom server file inside the project.string

Generator Output

  • Adds applicationinsights dependency in package.json.
  • Extends main() function in the server file to initialise and configure app insights.