Install the Node.js microagent

  1. Review Node.js microagent compatibility to confirm that the Sqreen Microagent for Node.js is compatible with your Node.js application.
  2. Sign up to create your Sqreen account.
  3. Fetch your organization token. From the Sqreen Dashboard, access Account Settings > Environments & Tokens. Your token begins with env_org_. Take note of the token.
  4. From Terminal, install the Sqreen microagent and save it into your project.
    npm install --save sqreen
    
  5. Require the Sqreen microagent first at the top of your main script.
    require('sqreen');
    
  6. Set up your SQREEN_TOKEN in your home folder.
    cat > sqreen.json <<EOF
    {
      "app_name": "YOUR_APPLICATION_NAME",
      "token": "SQREEN_TOKEN"
    }
    EOF
    

The Sqreen Microagent for Node.js is also available at npm.

Install in multiple environments

Typically, you install the Sqreen microagent in your production environment, but you can install it in multiple environments. Use a different name and token for each environment such as production, staging, and development.

  1. From the Sqreen Dashboard, navigate to Account Settings > Environments & Tokens, and Add a new Environment.
  2. Sqreen automatically creates a new token and associates it with the new environment. Take note of the new token.
  3. Set up your application name and SQREEN_TOKEN and include the environment name.
cat > sqreen.json <<EOF
{
    "app_name": "APP_NAME (production)",
    "token": "SQREEN_TOKEN"
}
EOF

Uninstall

To uninstall the Node.js microagent, remove the sqreen microagent from your application.