- HTML 37%
- JavaScript 34.5%
- TypeScript 28.5%
| art | ||
| src | ||
| .gitignore | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
Adonis JS Debug Bar
Debug bar for AdonisJS for adonis v6 and v7
Request View
Timeline View
Queries View
A bottom panel in development to inspect:
- request details
- SQL queries, bindings, duration, duplicates, and source
- a timeline of the request lifecycle
- previous request snapshots in the same browser session
Install
npm install @eznix/adonisjs-debugbar
Setup
1. Register the provider
In adonisrc.ts:
providers: [
// ...
() => import('@eznix/adonisjs-debugbar/provider'),
]
2. Register the middleware
In start/kernel.ts:
router.use([
// ...
() => import('@eznix/adonisjs-debugbar/middleware'),
])
If you use Inertia, place it after @adonisjs/inertia/inertia_middleware so render timings are captured.
Example with Inertia:
router.use([
() => import('@adonisjs/core/bodyparser_middleware'),
() => import('@adonisjs/session/session_middleware'),
() => import('@adonisjs/shield/shield_middleware'),
() => import('@adonisjs/inertia/inertia_middleware'),
() => import('@eznix/adonisjs-debugbar/middleware'),
])
Example without Inertia:
router.use([
() => import('@adonisjs/core/bodyparser_middleware'),
() => import('@adonisjs/session/session_middleware'),
() => import('@adonisjs/shield/shield_middleware'),
() => import('@eznix/adonisjs-debugbar/middleware'),
])
Non-Inertia apps still get request, query, and timeline data. Only Inertia-specific render entries are unavailable.
3. Render the debug bar
Add @debugbar() near the end of your Edge layout:
<!DOCTYPE html>
<html>
<body>
@!section('content')
@debugbar()
</body>
</html>
4. To view SQL queries
Dont forget to add debug: true to your database configuration.
Preferably, use:
const dbConfig = defineConfig({
//...
connections: {
yourconnection: {
debug: env.get('NODE_ENV') === 'development',
// ...
},
},
})
Configuration
The debug bar is enabled by default when NODE_ENV=development.
You can override it with DEBUGBAR_ENABLED:
DEBUGBAR_ENABLED=true
or
DEBUGBAR_ENABLED=false
Extending DebugBar
Most apps only need the provider, middleware, and @debugbar().
If you need manual instrumentation, these are the useful public helpers:
isDebugBarEnabled()- check whether the debug bar is activerunWithDebugBar(fn)- run custom async work inside a debug bar contextrecordDebugRender(label, startedAt, meta?)- add a custom render/timing entry to the timelinerecordDebugQuery(event)- record a custom query event when you are not using Lucid's built-in instrumentation
Types are available from @eznix/adonisjs-debugbar/types.
License
MIT


