Introduction
@lerix-dev/lerix-nestjs is the server-side Lerix SDK for NestJS. Once the
module is registered, every unhandled exception in your API is reported to the
dashboard with its stack trace, host, release and request context, and your
services get a typed client for the push notifications REST API.
Create a project with the NestJS framework in the dashboard
and copy its API key and project id from Project Settings.
Requirements
The package has no runtime dependencies and works with both the Express and
Fastify adapters.
1. Install the package
2. Register the module
ImportLerixModule once in your root module:
app.module.ts
main.ts
Load options from ConfigService
forRootAsync accepts the same options plus imports and inject:
app.module.ts
3. Verify the integration
Add a route that throws and call it once:app.controller.ts
500 response and the error appears in your
dashboard within seconds. Remove the route afterwards.
Options
How your service appears in the dashboard
The SDK registers your service as aserver app. The app id defaults to the
name in package.json and the release to its version, so reports are
grouped per service and per release. Override them with the app option when
you deploy several instances of the same code base or want a git SHA as the
build number:
.lerix/state.json under the working directory, so restarts reuse it. Add
that folder to .gitignore, or mount it in containers. Pass
statePath: false to skip persistence, or userId to control the id yourself.
Next steps
Error Tracking
What the filter reports, how to change the policy, and manual reporting.
Push Notifications
Send, schedule, update and unsend notifications from your backend.