The official Treblle SDK for JavaScript frameworks including AdonisJS. Seamlessly integrate Treblle to manage communication with your dashboard, send errors, and secure sensitive data.
Treblle with AdonisJS
Note
Legacy Notice: The dedicated AdonisJS 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 AdonisJS:
npm install treblle@^2.0.0Initialize in your AdonisJS application using Koa support (since Adonis runs on Koa):
// start/kernel.ts
import { koaTreblle } from "treblle";
Server.middleware.register([
() => ({
handle: koaTreblle({
sdkToken: process.env.TREBLLE_SDK_TOKEN,
apiKey: process.env.TREBLLE_API_KEY,
}),
}),
]);Legacy Integration (Deprecated)
The original AdonisJS-specific integration is still available but no longer actively maintained.
Legacy Installation
If you’re still using the legacy integration:
npm i @treblle/adonisjs --saveAfter installation, run the configuration command:
node ace configure @treblle/adonisjsThis will create the treblle-adonisjs config in config/treblle.ts.
Legacy Credentials
treblle-adonisjs requires the following environment variables:
TREBLLE_API_KEYTREBLLE_SDK_TOKEN
Validate them in your env.ts file:
TREBLLE_API_KEY: Env.schema.string(),
TREBLLE_SDK_TOKEN: Env.schema.string(),Legacy Setup
Add the middleware globally in your start/kernel.ts:
Server.middleware.register([() => import('@treblle/adonisjs')])Or use it as a named middleware for specific routes:
// start/kernel.ts
Server.middleware.registerNamed({
treblle: () => import('@treblle/adonisjs'),
})Then apply to routes:
Route.group(() => {
Route.post('/posts', async ({ request }) => {
return {
success: true,
message: 'Post created successfully',
data: request.body(),
}
})
})
.prefix('/api/v1')
.middleware('treblle')Migration Guide
To migrate from the legacy integration to the unified SDK:
-
Install the new package:
npm install treblle@^2.0.0 npm uninstall @treblle/adonisjs -
Update your environment variables from
TREBLLE_API_KEY/TREBLLE_SDK_TOKENtoTREBLLE_SDK_TOKEN/TREBLLE_API_KEY -
Update your middleware registration in
start/kernel.tsto use the Koa middleware from the unified SDK -
Test your API endpoints to ensure requests are being captured
Caution
For questions during migration, contact support at support@treblle.com