Skip to main content

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
app.module.ts
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 watcherTelescope recordsNestLens watcherNestLens records
BatchQueued job batchesbatchBatch and bulk operations: imports, exports, bulk updates
CacheCache hits, misses, updates and removalscacheCache gets, sets, deletes and clears, with hit or miss
CommandArtisan commands: arguments, options, exit code, outputcommandCQRS commands sent through CommandBus
DumpVariable dumpsdumpDatabase dumps, exports, imports, backups and migrations
EventDispatched events, their listeners and broadcast dataeventEventEmitter2 events, their payloads and listeners
ExceptionReportable exceptions and their stack tracesexceptionUnhandled exceptions and their stack traces
GateGate and policy checks and their resultsgateAuthorization checks made through a gate service you provide
HTTP ClientOutgoing HTTP client requestshttpClientOutgoing HTTP requests
JobDispatched jobs and their statusjobBull and BullMQ jobs and their status
LogLog entrieslogLogs written through NestJS's logger
MailSent mail, with an in-browser previewmailSent mail: recipients, subject and content
ModelEloquent model eventsmodelTypeORM and Prisma model operations
NotificationSent notificationsnotificationNotifications on email, SMS, push, socket and webhook channels
QueryRaw SQL, bindings and execution timequeryTypeORM 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)
RedisRedis commandsredisRedis commands, their arguments and duration
RequestRequests, headers, session and responserequestHTTP requests and responses, headers, bodies and timing
ScheduleScheduled tasks and their outputschedule@Cron, @Interval and @Timeout tasks
ViewRendered views, their data and composersviewTemplate rendering
——graphqlGraphQL queries, mutations and subscriptions, with N+1 detection
——messageMessages a microservice handler receives, on any transport, with its answer
——websocketMessages 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​

TelescopeNestLens
SetupA service provider, and watchers listed in config/telescope.phpNestLensModule.forRoot(), once, in the root module. It is global, so feature modules inject a watcher without importing it again
StorageDatabase tables, created by php artisan migrateIn memory by default; SQLite or Redis when entries have to survive a restart. No migration
PruningSchedule telescope:prune; 24 hours by defaultRuns on its own: entries older than 24 hours, checked every hour, both configurable
Who can open itThe local environment, and a viewTelescope gate elsewheredevelopment, local and test by default, plus IP rules, roles and a canAccess function
HTTPLaravel's ownExpress and Fastify
GraphQLNo watcher in its listRegisters itself with Apollo or Mercurius when graphql is on
N+1 queriesEach query is recorded; telling a repeated one apart is left to the readerCounted per request: the request names the statement it repeated, and the request and every run are tagged N+1
Queues and socketsJobs are the queue; broadcasting is not recordedA microservice's messages and a gateway's events have watchers of their own, message and websocket
AI agentsNot part of Telescope; Laravel has separate MCP and Boost packagesnestlens-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​