Skip to content

Treblle with SailsJS

Legacy Notice: The dedicated SailsJS integration is in maintenance mode. We recommend using our unified JavaScript SDK (treblle-node) instead, which provides better support and more frequent updates. Support for this integration will end on December 31, 2025. To migrate, follow the updated setup guide below.

We now recommend using our unified JavaScript SDK which works with SailsJS:

Terminal window
npm install treblle@^2.0.0

Initialize in your SailsJS application using Koa support (since SailsJS runs on Koa):

// config/routes.js or similar
const { koaTreblle } = require("treblle");
module.exports.routes = {
// Your routes here
};
// In your Sails.js bootstrap:
// Register Treblle middleware
app.use(koaTreblle({
sdkToken: process.env.TREBLLE_SDK_TOKEN,
apiKey: process.env.TREBLLE_API_KEY,
}));

The original SailsJS-specific integration is still available but no longer actively maintained.

If you’re still using the legacy integration:

Terminal window
npm i @treblle/sails --save

@treblle/sails supports configuration through:

Environment Variables:

  • TREBLLE_API_KEY
  • TREBLLE_PROJECT_ID

Config file in config/local.js:

treblle: {
apiKey: '<YOUR_TREBLLE_API_KEY>',
projectId: '<YOUR_TREBLLE_PROJECT_ID>'
}

Create config/treblle.js:

module.exports.treblle = {
apiKey: '<YOUR_TREBLLE_API_KEY>',
projectId: '<YOUR_TREBLLE_PROJECT_ID>',
additionalFieldsToMask: ['key1', 'key2'], // optional
routesToMonitor: [], // optional
}

By default, monitors these routes:

routesToMonitor: [
'GET r|^((?![^?]*\\/[^?\\/]+\\.[^?\\/]+(\\?.*)?).)*$|',
'POST /*',
'PATCH /*',
'PUT /*',
'DELETE /*',
]

To monitor only specific routes:

module.exports.treblle = {
routesToMonitor: ['/api/*'],
}

To migrate from the legacy integration to the unified SDK:

  1. Install the new package:

    Terminal window
    npm install treblle@^2.0.0
    npm uninstall @treblle/sails
  2. Update your environment variables from TREBLLE_API_KEY / TREBLLE_PROJECT_ID to TREBLLE_SDK_TOKEN / TREBLLE_API_KEY

  3. Update your middleware registration to use the Koa middleware from the unified SDK

  4. Test your API endpoints to ensure requests are being captured

For questions during migration, contact support at support@treblle.com


  • Current Version: Legacy (v1.x)
  • Support Deadline: December 31, 2025
  • Recommendation: Migrate to unified SDK immediately
  • Migration Time: 10-15 minutes