How to setup recording & monitoring for JavaScript applications


To setup RevDeBug you will need to:

Configure RevDeBug.json with your project

Create a file revdebug.json in main app folder of your project where you have package.json to set up a connection with RevDeBug Monitor.

  "host":         "revdebug.server.address",
  "apm":          true,
  "mode":         "onevent",
  "solution":     "Node.js Application",
  // Server instrumentation options
  ".server": {
    "application":  "Node.js Application Server",
    "target":       "node",
    // All js files that are responsible for the server side
    // If you want to instrument all js files type ""**/*.js""
    "files":        ["src/*.js", "app.js"]
  // Browser Recording instrumentation options
  // If you only want to use monitoring of the server side, remove this section
  ".client": {
    "application":  "Node.js Application Client",
    "useFMP":       true,
    "screen":       true,
    "target":       "web",
    "sourceMap":    true,
    "files":        "public/YourFrontendScript.js",
    "index":        "public/index.html"

Install RevDeBug NPM repository

Before compiling your project with RevDeBug you should have configured revdebug.json. Everything is done using the revd script. Depending on how you have the RevDeBug npm module installed you either execute it directly or run it with npx revd. For a full list of options run revd --help.

First, add a reference to the @revdebug module repository:

npm config set @revdebug:registry

Or you can just set the repository for a single project by adding an .npmrc file with the line:


Then install as a local dependency:

npm install @revdebug/revdebug

You can verify that RevDeBug is available by running node in interactive mode and doing:


Instrument your project with RevDeBug:

npx revd

RevDeBug will instrument your application's code in-place and will preserve the original code in the “__revd/” folder in your project’s directory. Running “npx revd --remove” will reverse the operation.

Instrumentation is meant to be executed on CI/CD Server and not on local development environment, but when running locally keep in mind the above and use “npx revd --remove” to restore the codebase to its uninstrumented state. If you would locally change the kept original source files in “__revd/” folder, running “npx revd” again will instrument the altered code (i.e. your uninstrumented code is kept safe in “__revd/” folder).

Basic setup

Environment variables may be accessed in revdebug.json as such:

"mode": "${MODE}"

These variables can also be passed in on the command line via the -a var=value or --arg var=value option. If you wish to use an environment variable or command line specified argument for an option that takes a number or boolean value then you must use a string:

"port": "${RECORD_PORT}"

For more detailed configuration go to Advanced configuration.

Last updated