{"_id":"@angelo_castellani/reqwatch","name":"@angelo_castellani/reqwatch","dist-tags":{"latest":"0.2.0"},"versions":{"0.2.0":{"name":"@angelo_castellani/reqwatch","version":"0.2.0","description":"Self-hosted logging and monitoring middleware for REST APIs, with an embedded dashboard and pluggable storage.","keywords":["logging","monitoring","middleware","observability","rest-api","express","fastify","dashboard"],"license":"MIT","packageManager":"pnpm@11.2.2","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"engines":{"node":">=22.5.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"repository":{"type":"git","url":"git+https://github.com/AngeloCastellanii/Logger.git"},"bugs":{"url":"https://github.com/AngeloCastellanii/Logger/issues"},"homepage":"https://github.com/AngeloCastellanii/Logger#readme","scripts":{"build":"tsc -p tsconfig.json && node scripts/copy-assets.mjs","test":"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage","test-ct":"playwright test -c playwright-ct.config.ts","test:integration":"vitest run -c vitest.integration.config.ts","lint":"eslint .","format":"prettier --write .","premigrate":"pnpm run build","migrate":"node scripts/migrate.mjs","migrate:rollback":"node scripts/migrate.mjs --rollback","prebenchmark:overhead":"pnpm run build","benchmark:overhead":"node scripts/benchmark-overhead.mjs"},"dependencies":{"dotenv":"^16.4.5","pg":"^8.12.0"},"peerDependencies":{"express":">=4","fastify":">=4"},"peerDependenciesMeta":{"express":{"optional":true},"fastify":{"optional":true}},"devDependencies":{"@eslint/js":"^9.10.0","@playwright/test":"^1.47.0","@testing-library/dom":"^10.4.0","@testing-library/jest-dom":"^6.5.0","@types/express":"^4.17.21","@types/node":"^22.9.0","@types/pg":"^8.11.8","@typescript-eslint/eslint-plugin":"^8.5.0","@typescript-eslint/parser":"^8.5.0","@vitest/coverage-v8":"^4.1.10","eslint":"^9.10.0","eslint-config-prettier":"^9.1.0","express":"^4.19.2","fastify":"^5.11.2","happy-dom":"^20.11.1","prettier":"^3.3.3","typescript":"^5.6.2","vitest":"^4.1.10"},"gitHead":"e7e397743f61a4ad77f64b20c0ac22a74cba630e","_id":"@angelo_castellani/reqwatch@0.2.0","_nodeVersion":"24.14.1","_npmVersion":"11.8.0","dist":{"integrity":"sha512-JvIZCQETPpwMR7JQgHGTiBHJKPNhdv4G6y6WUEI9DgS24F5n5FVr2QTL3Sa5a730Uxzj+8yaU/zrbui0jpOZKQ==","shasum":"e306c06f49d668bbb1035deef1b18150ea2e600c","tarball":"https://registry.npmjs.org/@angelo_castellani/reqwatch/-/reqwatch-0.2.0.tgz","fileCount":166,"unpackedSize":292627,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCEqUO5srJYhPNr7ISXtfrpXLamhir+4aR6Cg7qLMVzBgIhANrudVuzhiSV9MkxVXQ/U8Tqwl1uGfa6TchlMRsJRlr+"}]},"_npmUser":{"name":"angelo_castellani","email":"castelll1515@gmail.com"},"directories":{},"maintainers":[{"name":"angelo_castellani","email":"castelll1515@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/reqwatch_0.2.0_1786128976629_0.37717256223179474"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-07T18:56:16.490Z","0.2.0":"2026-08-07T18:56:16.804Z","modified":"2026-08-07T18:56:17.063Z"},"maintainers":[{"name":"angelo_castellani","email":"castelll1515@gmail.com"}],"description":"Self-hosted logging and monitoring middleware for REST APIs, with an embedded dashboard and pluggable storage.","homepage":"https://github.com/AngeloCastellanii/Logger#readme","keywords":["logging","monitoring","middleware","observability","rest-api","express","fastify","dashboard"],"repository":{"type":"git","url":"git+https://github.com/AngeloCastellanii/Logger.git"},"bugs":{"url":"https://github.com/AngeloCastellanii/Logger/issues"},"license":"MIT","readme":"# reqwatch\r\n\r\nSelf-hosted logging and monitoring middleware for REST APIs — a self-hosted alternative to services like the Sentry SDK. Capture every request/response automatically, log manually from anywhere in your code, and inspect everything from an embedded web dashboard, with zero external services required.\r\n\r\n- Works with **Express** or **Fastify**.\r\n- Three interchangeable storage strategies: **in-memory**, **SQLite** (via Node's built-in `node:sqlite`, no native binary to compile), or **PostgreSQL**.\r\n- Ships an embedded monitoring dashboard (metrics, request explorer, filters, cursor pagination) — no separate service to deploy.\r\n- Configured with one JSON file; secrets stay in `.env`.\r\n\r\n## Install\r\n\r\n```bash\r\nnpm install @angelo_castellani/reqwatch\r\n```\r\n\r\nRequires Node.js **>= 22.5**. No database server, no build step, no extra system dependencies — everything needed ships in the package (RF-01).\r\n\r\n## Quick start (Express)\r\n\r\n```ts\r\nimport express from 'express';\r\nimport { createReqWatch } from '@angelo_castellani/reqwatch';\r\n\r\nconst app = express();\r\napp.use(express.json());\r\n\r\nconst rw = await createReqWatch(); // reads ./logger.config.json (or defaults) + .env\r\nrw.mountExpress(app); // wires the capture middleware + the /api/monitoring dashboard\r\n\r\napp.get('/hello', (_req, res) => res.json({ hello: 'world' }));\r\n\r\napp.use((err, req, res, next) => {\r\n  rw.getExpressHandlers().errorHandler(err, req, res, next);\r\n  res.status(500).json({ error: 'internal error' });\r\n});\r\n\r\napp.listen(3000, () => {\r\n  rw.logInfo('server started', { port: 3000 });\r\n});\r\n```\r\n\r\nOpen `http://localhost:3000/api/monitoring` to see the dashboard.\r\n\r\n## Quick start (Fastify)\r\n\r\n```ts\r\nimport Fastify from 'fastify';\r\nimport { createReqWatch } from '@angelo_castellani/reqwatch';\r\n\r\nconst app = Fastify();\r\nconst rw = await createReqWatch();\r\nawait rw.registerFastify(app);\r\n\r\napp.get('/hello', async () => ({ hello: 'world' }));\r\n\r\nawait app.listen({ port: 3000 });\r\nrw.logInfo('server started', { port: 3000 });\r\n```\r\n\r\nSee [examples/](./examples) for complete, runnable projects for both frameworks, exercising all three storage strategies.\r\n\r\n## Manual logging\r\n\r\nOutside of the automatic request/response capture, log anything from anywhere in your code:\r\n\r\n```ts\r\nrw.logInfo('cache warmed', { entries: 1200 });\r\nrw.logWarning('slow external call', { ms: 820 });\r\nrw.logError('payment failed', { orderId, error: err.message });\r\nrw.logDebug('cache miss', { key });\r\n```\r\n\r\n> `rw.log(level, message)` still works but is **deprecated** — see [MIGRATION.md](./MIGRATION.md).\r\n\r\n## Configuration\r\n\r\nEverything is driven by `logger.config.json` in your project root (path is configurable), with `${VAR_NAME}` placeholders resolved from `.env` for secrets:\r\n\r\n```json\r\n{\r\n  \"storage\": {\r\n    \"strategy\": \"sqlite\",\r\n    \"config\": { \"database_path\": \"./logs/api_logs.db\" }\r\n  },\r\n  \"monitoring\": {\r\n    \"auth\": {\r\n      \"enabled\": true,\r\n      \"username\": \"${LOGGER_MONITORING_USER}\",\r\n      \"password\": \"${LOGGER_MONITORING_PASSWORD}\"\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n```bash\r\n# .env — never commit this file\r\nLOGGER_MONITORING_USER=admin\r\nLOGGER_MONITORING_PASSWORD=change-me\r\n```\r\n\r\nFull reference of every option, per storage strategy, with examples: **[CONFIGURATION.md](./CONFIGURATION.md)**.\r\n\r\n## Documentation\r\n\r\n| Document | Contents |\r\n| :-- | :-- |\r\n| [INSTALLATION.md](./INSTALLATION.md) | Detailed setup for Express/Fastify, each storage strategy, and Docker-based PostgreSQL |\r\n| [CONFIGURATION.md](./CONFIGURATION.md) | Every `logger.config.json` option, defaults, and `.env` secret handling |\r\n| [ARCHITECTURE.md](./ARCHITECTURE.md) | Component design, storage strategy trade-offs, request lifecycle |\r\n| [API.md](./API.md) | Monitoring HTTP endpoints (`/metrics`, `/requests`, `/requests/:id`, auth) |\r\n| [TESTING.md](./TESTING.md) | Unit / integration / component testing strategy |\r\n| [MIGRATION.md](./MIGRATION.md) | Migrating off the deprecated `log()` method |\r\n| [CHANGELOG.md](./CHANGELOG.md) | Release history (Keep a Changelog + SemVer) |\r\n\r\n## License\r\n\r\nMIT — see [LICENSE](./LICENSE).\r\n","readmeFilename":"README.md","_rev":"1-4e0935b54168b99d373b1ff788df33b6"}