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.
Recommended: Using the Unified SDK
Section titled “Recommended: Using the Unified SDK”We now recommend using our unified JavaScript SDK which works with SailsJS:
npm install treblle@^2.0.0Initialize in your SailsJS application using Koa support (since SailsJS runs on Koa):
// config/routes.js or similarconst { koaTreblle } = require("treblle");
module.exports.routes = { // Your routes here};
// In your Sails.js bootstrap:// Register Treblle middlewareapp.use(koaTreblle({ sdkToken: process.env.TREBLLE_SDK_TOKEN, apiKey: process.env.TREBLLE_API_KEY,}));Legacy Integration (Deprecated)
Section titled “Legacy Integration (Deprecated)”The original SailsJS-specific integration is still available but no longer actively maintained.
Legacy Installation
Section titled “Legacy Installation”If you’re still using the legacy integration:
npm i @treblle/sails --saveLegacy Credentials
Section titled “Legacy Credentials”@treblle/sails supports configuration through:
Environment Variables:
TREBLLE_API_KEYTREBLLE_PROJECT_ID
Config file in config/local.js:
treblle: { apiKey: '<YOUR_TREBLLE_API_KEY>', projectId: '<YOUR_TREBLLE_PROJECT_ID>'}Legacy Setup
Section titled “Legacy Setup”Create config/treblle.js:
module.exports.treblle = { apiKey: '<YOUR_TREBLLE_API_KEY>', projectId: '<YOUR_TREBLLE_PROJECT_ID>', additionalFieldsToMask: ['key1', 'key2'], // optional routesToMonitor: [], // optional}Legacy routesToMonitor Option
Section titled “Legacy routesToMonitor Option”By default, monitors these routes:
routesToMonitor: [ 'GET r|^((?![^?]*\\/[^?\\/]+\\.[^?\\/]+(\\?.*)?).)*$|', 'POST /*', 'PATCH /*', 'PUT /*', 'DELETE /*',]To monitor only specific routes:
module.exports.treblle = { routesToMonitor: ['/api/*'],}Migration Guide
Section titled “Migration Guide”To migrate from the legacy integration to the unified SDK:
-
Install the new package:
Terminal window npm install treblle@^2.0.0npm uninstall @treblle/sails -
Update your environment variables from
TREBLLE_API_KEY/TREBLLE_PROJECT_IDtoTREBLLE_SDK_TOKEN/TREBLLE_API_KEY -
Update your middleware registration to use the Koa middleware from the unified SDK
-
Test your API endpoints to ensure requests are being captured
For questions during migration, contact support at support@treblle.com
Status
Section titled “Status”- Current Version: Legacy (v1.x)
- Support Deadline: December 31, 2025
- Recommendation: Migrate to unified SDK immediately
- Migration Time: 10-15 minutes