NestLens vs Laravel Telescope
NestLens is a Laravel Telescope for NestJS: the same idea, a dashboard of what the application just did, built for NestJS's modules, interceptors and the libraries a NestJS application uses instead of the ones Laravel ships with.
What Telescope is
Laravel Telescope is Laravel's
debugging assistant for local development. Its watchers record the requests
coming into the application, exceptions, log entries, database queries, queued
jobs, mail, notifications, cache operations, scheduled tasks, variable dumps and
more, and its dashboard at /telescope shows them.
Install in three lines
npm install nestlens
imports: [NestLensModule.forRoot({ enabled: process.env.NODE_ENV !== 'production' })],
Start the application and open http://localhost:3000/nestlens. The
quick start has the whole file.
Watcher by watcher
Telescope's documentation lists eighteen watchers. NestLens has a watcher of the same name for each of them, and three more: for GraphQL, for microservice messages and for WebSocket gateways. A shared name does not always mean the same thing is recorded: where the two differ, the table says so.
| Telescope watcher | Telescope records | NestLens watcher | NestLens records |
|---|---|---|---|
| Batch | Queued job batches | batch | Batch and bulk operations: imports, exports, bulk updates |
| Cache | Cache hits, misses, updates and removals | cache | Cache gets, sets, deletes and clears, with hit or miss |
| Command | Artisan commands: arguments, options, exit code, output | command | CQRS commands sent through CommandBus |
| Dump | Variable dumps | dump | Database dumps, exports, imports, backups and migrations |
| Event | Dispatched events, their listeners and broadcast data | event | EventEmitter2 events, their payloads and listeners |
| Exception | Reportable exceptions and their stack traces | exception | Unhandled exceptions and their stack traces |
| Gate | Gate and policy checks and their results | gate | Authorization checks made through a gate service you provide |
| HTTP Client | Outgoing HTTP client requests | httpClient | Outgoing HTTP requests |
| Job | Dispatched jobs and their status | job | Bull and BullMQ jobs and their status |
| Log | Log entries | log | Logs written through NestJS's logger |
| Sent mail, with an in-browser preview | mail | Sent mail: recipients, subject and content | |
| Model | Eloquent model events | model | TypeORM and Prisma model operations |
| Notification | Sent notifications | notification | Notifications on email, SMS, push, socket and webhook channels |
| Query | Raw SQL, bindings and execution time | query | TypeORM and Prisma queries and MongoDB commands (Mongoose and the native driver), their duration and — by default in development only — their parameters, and the statements a request ran over and over (N+1) |
| Redis | Redis commands | redis | Redis commands, their arguments and duration |
| Request | Requests, headers, session and response | request | HTTP requests and responses, headers, bodies and timing |
| Schedule | Scheduled tasks and their output | schedule | @Cron, @Interval and @Timeout tasks |
| View | Rendered views, their data and composers | view | Template rendering |
| — | — | graphql | GraphQL queries, mutations and subscriptions, with N+1 detection |
| — | — | message | Messages a microservice handler receives, on any transport, with its answer |
| — | — | websocket | Messages a WebSocket gateway receives, on Socket.IO or ws |
request, query, exception and log are on by default. The other seventeen
are switched on in watchers, and most of them also need the library's client
handed to NestLens, because in NestJS the queue, the mailer and the cache are
separate packages rather than part of the framework. Each watcher's page shows
how.
What is different
| Telescope | NestLens | |
|---|---|---|
| Setup | A service provider, and watchers listed in config/telescope.php | NestLensModule.forRoot(), once, in the root module. It is global, so feature modules inject a watcher without importing it again |
| Storage | Database tables, created by php artisan migrate | In memory by default; SQLite or Redis when entries have to survive a restart. No migration |
| Pruning | Schedule telescope:prune; 24 hours by default | Runs on its own: entries older than 24 hours, checked every hour, both configurable |
| Who can open it | The local environment, and a viewTelescope gate elsewhere | development, local and test by default, plus IP rules, roles and a canAccess function |
| HTTP | Laravel's own | Express and Fastify |
| GraphQL | No watcher in its list | Registers itself with Apollo or Mercurius when graphql is on |
| N+1 queries | Each query is recorded; telling a repeated one apart is left to the reader | Counted per request: the request names the statement it repeated, and the request and every run are tagged N+1 |
| Queues and sockets | Jobs are the queue; broadcasting is not recorded | A microservice's messages and a gateway's events have watchers of their own, message and websocket |
| AI agents | Not part of Telescope; Laravel has separate MCP and Boost packages | nestlens-mcp lets an agent read what was recorded, read-only by default |
Both tag entries and can filter what is recorded. In NestLens that is the
filter option and the filtering guide.
Next
- Installation: requirements and the optional peers.
- Watchers overview: every watcher and its options.
- Production usage: before turning it on anywhere but your machine.