The official Treblle SDK for JavaScript frameworks including SailsJS. Seamlessly integrate Treblle to manage communication with your dashboard, send errors, and secure sensitive data.
Treblle with SailsJS
Caution
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
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 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,
}));Legacy Integration (Deprecated)
Caution
The original SailsJS-specific integration is still available but no longer actively maintained.
The legacy Treblle SDK for SailsJS framework (maintenance mode, support ending December 31, 2025).
Legacy Installation
If you’re still using the legacy integration:
npm i @treblle/sails --saveLegacy Credentials
@treblle/sails supports configuration through:
Environment Variables:
TREBLLE_API_KEYTREBLLE_SDK_TOKEN
Config file in config/local.js:
treblle: {
apiKey: '<YOUR_TREBLLE_API_KEY>',
sdkToken: '<YOUR_TREBLLE_SDK_TOKEN>'
}Legacy Setup
Create config/treblle.js:
module.exports.treblle = {
apiKey: '<YOUR_TREBLLE_API_KEY>',
sdkToken: '<YOUR_TREBLLE_SDK_TOKEN>',
additionalFieldsToMask: ['key1', 'key2'], // optional
routesToMonitor: [], // optional
}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
To migrate from the legacy integration to the unified SDK:
Step
Action
1. Install new package
```sh copy npm install treblle@^2.0.0 npm uninstall @treblle/sails ```
2. Update environment variables
Change from `TREBLLE_API_KEY` / `TREBLLE_SDK_TOKEN` to `TREBLLE_SDK_TOKEN` / `TREBLLE_API_KEY`
3. Update middleware registration
Use the Koa middleware from the unified SDK
4. Test API endpoints
Ensure requests are being captured correctly
Note
For questions during migration, contact support at support@treblle.com
Status
Item
Details
Current Version
Legacy (v1.x)
Support Deadline
December 31, 2025
Recommendation
Migrate to unified SDK immediately
Migration Time
10-15 minutes