Last month I shared a 1-line observability middleware for Express and Fastify. It logged requests to your console - method, route, status, latency.
Since then, I've added a lot:
- Auto DB profiling (patches pg, mysql2, mongoose, prisma, knex, sequelize, ioredis, better-sqlite3)
- A free cloud dashboard at apilens.rest
- Per-query execution times with masked SQL
- N+1 query detection
- Geographic insights + bot detection
- Real-time live request tailing
Here's what it looks like.
The Dashboard
Overview - KPIs + charts at a glance
Total requests, error rate, P95 latency, request volume over time, status distribution, method breakdown - all updating in real-time.
Request Log - every request, fully expanded
Click any request to see the full details: trace ID, IP, user agent, and every database query that request made - with masked SQL, source library, and individual execution times.
Database Performance - catch N+1 queries
See which routes make the most DB calls, find your slowest queries, and spot N+1 issues before your users do.
Setup: still 1 line
npm install auto-api-observe
Local only (no account needed)
const express = require('express');
const observe = require('auto-api-observe');
const app = express();
app.use(observe());
Every request logs structured JSON to your console:
{
"method": "GET",
"route": "/api/users/:id",
"status": 200,
"latency": 85,
"latencyMs": "85ms",
"traceId": "a1b2c3d4-...",
"dbCalls": {
"calls": 2,
"totalTime": 45,
"queries": [
{ "query": "SELECT * FROM users WHERE id = ?", "source": "pg", "queryTime": 30 },
{ "query": "SELECT * FROM profiles WHERE user_id = ?", "source": "pg", "queryTime": 15 }
]
}
}
With cloud dashboard
app.use(observe({
apiKey: process.env.APILENS_KEY, // get one free at apilens.rest
}));
That's it. Data appears in your dashboard within seconds.
Auto DB Instrumentation
This is the feature I'm most proud of. The middleware automatically patches your DB libraries at startup - zero code changes needed.
Supported: pg, mysql2, mongoose, @prisma/client, knex, sequelize, ioredis, better-sqlite3.
It uses prototype monkey-patching + AsyncLocalStorage to track every query per request. You get:
- Masked SQL strings (values replaced with
?) - Per-query execution time
- Source library name
- Total time and call count per request
When you see dbCalls.calls: 47 on a single endpoint - you've got an N+1 problem. No guesswork.
How it compares
| Feature | auto-api-observe | Datadog | New Relic | Sentry |
|---|---|---|---|---|
| Setup | 1 line | 30+ min | 30+ min | 15+ min |
| Dependencies | 0 | 50+ | 40+ | 30+ |
| Auto DB profiling | 8 libraries | Custom setup | Custom setup | No |
| N+1 detection | Built-in | No | No | No |
| Price | Free (beta) | $23/host/mo | $0.30/GB | $26/mo |
What's in the dashboard
- Overview - KPIs, request volume, latency percentiles, status/method distribution, heatmap
- All Requests - paginated log with search, filters, expandable DB query details
- Routes - per-route breakdown (calls, avg latency, P95, errors)
- Errors - 4xx/5xx timeline, top error routes, filterable error log
- Slow Requests - latency distribution histogram
- Database - N+1 detector, slowest queries, source distribution
- Traces - distributed trace waterfall
- Live Tail - real-time SSE stream with filters
- Geographic - country breakdown, bot detection, rate abuse
- Usage - daily quota tracking
- Alerts - email/Slack notifications
All free during beta. No credit card.
Try it
npm install auto-api-observe
- Dashboard: apilens.rest
- npm: npmjs.com/package/auto-api-observe
- GitHub: github.com/rahhuul/auto-api-observe
Zero dependencies. TypeScript-first. MIT license. 44 tests.
Would love feedback - what features would you want next?



Top comments (0)