{"_id":"@alaminislam34/server-monitor","_rev":"2-6e76a10a24b32dc5bbdd3d8c1d3b2992","name":"@alaminislam34/server-monitor","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.3":{"name":"@alaminislam34/server-monitor","version":"1.0.3","license":"MIT","_id":"@alaminislam34/server-monitor@1.0.3","maintainers":[{"name":"alaminislam34","email":"devamin.bd@gmail.com"}],"dist":{"shasum":"6af40a475bf653823da7f35d2dc4a3d312d1c895","tarball":"https://registry.npmjs.org/@alaminislam34/server-monitor/-/server-monitor-1.0.3.tgz","fileCount":25,"integrity":"sha512-I6fJNNFV2XIn533BBGtOwVDYHJKzIXnBePTVaaTODNUcjIm7wehcQYNVGWpWClMQ+hXTLTgKCRtKHdhWZSix0Q==","signatures":[{"sig":"MEQCIFZX1Kf+uVso/4h9meVUgFM3f4dEcUax+mnPr6HXMEpbAiAaYjVMvoP/AAcXYLqwOtehMrLOaLY+DN48FhJM2ElYhg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":2069599},"main":"./dist/index.cjs","_from":"file:alaminislam34-server-monitor-1.0.3.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=16.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./nestjs":{"types":"./dist/nestjs.d.ts","import":"./dist/nestjs.js","require":"./dist/nestjs.cjs"},"./express":{"types":"./dist/express.d.ts","import":"./dist/express.js","require":"./dist/express.cjs"}},"scripts":{"dev":"tsup --watch","test":"tsx tests/run-tests.ts","build":"tsup && pnpm --filter pulse-monitor-dashboard build"},"_npmUser":{"name":"alaminislam34","email":"devamin.bd@gmail.com"},"_resolved":"/tmp/9e3b7cd43b506664b556d2b1a38f570e/alaminislam34-server-monitor-1.0.3.tgz","_integrity":"sha512-I6fJNNFV2XIn533BBGtOwVDYHJKzIXnBePTVaaTODNUcjIm7wehcQYNVGWpWClMQ+hXTLTgKCRtKHdhWZSix0Q==","_npmVersion":"11.6.1","description":"Zero-impact backend monitoring tool for Express and NestJS","directories":{},"_nodeVersion":"24.11.0","_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.0.0","rxjs":"^7.8.0","tsup":"^8.0.0","express":"^4.19.0","typescript":"^5.0.0","@types/node":"^20.0.0","@nestjs/core":"^10.0.0","@nestjs/common":"^10.0.0","@types/express":"^4.17.0"},"peerDependencies":{"express":">=4.0.0","@nestjs/core":">=8.0.0","@nestjs/common":">=8.0.0"},"peerDependenciesMeta":{"express":{"optional":true},"@nestjs/core":{"optional":true},"@nestjs/common":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/server-monitor_1.0.3_1783835099805_0.6496020338251971","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@alaminislam34/server-monitor","version":"1.0.4","description":"Zero-impact backend monitoring tool for Express and NestJS","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./express":{"types":"./dist/express.d.ts","import":"./dist/express.js","require":"./dist/express.cjs"},"./nestjs":{"types":"./dist/nestjs.d.ts","import":"./dist/nestjs.js","require":"./dist/nestjs.cjs"}},"peerDependencies":{"express":">=4.0.0","@nestjs/common":">=8.0.0","@nestjs/core":">=8.0.0"},"peerDependenciesMeta":{"express":{"optional":true},"@nestjs/common":{"optional":true},"@nestjs/core":{"optional":true}},"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0","@types/node":"^20.0.0","@types/express":"^4.17.0","express":"^4.19.0","@nestjs/common":"^10.0.0","@nestjs/core":"^10.0.0","rxjs":"^7.8.0","tsx":"^4.0.0"},"engines":{"node":">=16.0.0"},"license":"MIT","scripts":{"build":"tsup && pnpm --filter pulse-monitor-dashboard build","dev":"tsup --watch","test":"tsx tests/run-tests.ts"},"_id":"@alaminislam34/server-monitor@1.0.4","_integrity":"sha512-rHe/eYCL5onVW0mqPMEnhXWUmfo69mjQ2y/cw3eGA0xy8v8YtHiGl8TirHJviZRWVRQryB9tV+Rc28nYoIh/rg==","_resolved":"/tmp/c019bb0bcd909a7db02b2c856e2ebb11/alaminislam34-server-monitor-1.0.4.tgz","_from":"file:alaminislam34-server-monitor-1.0.4.tgz","_nodeVersion":"24.11.0","_npmVersion":"11.6.1","dist":{"integrity":"sha512-rHe/eYCL5onVW0mqPMEnhXWUmfo69mjQ2y/cw3eGA0xy8v8YtHiGl8TirHJviZRWVRQryB9tV+Rc28nYoIh/rg==","shasum":"0a2551f4d5e6aee618e620148fb2e8196ce7652f","tarball":"https://registry.npmjs.org/@alaminislam34/server-monitor/-/server-monitor-1.0.4.tgz","fileCount":25,"unpackedSize":2069599,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBJL/k5MVHJ2b4uaex7g3UjTK29mMmhxKzlBCY134p+ZAiEAq6EyqLzqYIknep3jANiGCHAS4P1Sg9cKyAUUAjJtOyg="}]},"_npmUser":{"name":"alaminislam34","email":"devamin.bd@gmail.com"},"directories":{},"maintainers":[{"name":"alaminislam34","email":"devamin.bd@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/server-monitor_1.0.4_1783835168742_0.8432601624657923"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-12T05:44:59.675Z","modified":"2026-07-12T05:46:09.012Z","1.0.3":"2026-07-12T05:44:59.988Z","1.0.4":"2026-07-12T05:46:08.913Z"},"license":"MIT","description":"Zero-impact backend monitoring tool for Express and NestJS","maintainers":[{"name":"alaminislam34","email":"devamin.bd@gmail.com"}],"readme":"# ⚡ Pulse Monitor\n\nA zero-latency-impact backend performance and security monitoring tool for both **Express.js** and **NestJS** applications. It bundles a premium, interactive real-time dashboard into a single self-contained HTML asset and auto-adapts to Serverless (Vercel, Netlify, AWS Lambda) and Stateful (Node.js daemon) runtimes.\n\n---\n\n## ✨ Features\n\n- **🚀 Zero-Impact Observability:** Offloads telemetry aggregation to background Worker Threads in stateful environments.\n- **🛡️ Intrusion Detection System (IDS):** Auto-inspects path traversal, SQL Injection (SQLi), Cross-Site Scripting (XSS), and malicious User-Agent signatures.\n- **☁️ Serverless Native:** Automatically detects serverless execution environments and shifts from background thread queuing to zero-loss synchronous logs or database flushes.\n- **🎛️ Single-File Dashboard:** React UI compiled into a single, inline HTML file (`dist/ui/index.html`) using `vite-plugin-singlefile` to completely bypass 404 static asset paths and CORS problems.\n- **🔐 Stealth Mode & Security:** Configurable IP whitelists and access secrets. Hide the dashboard completely (return 404/next) for unwhitelisted clients.\n- **📊 Premium Visual Analytics:** Responsive, beautiful dark-themed dashboard with real-time SVG charting, sorting, filtering, and deep request inspection.\n\n---\n\n## 📦 Installation\n\nInstall the package via your preferred package manager:\n\n```bash\n# npm\nnpm install pulse-monitor\n\n# pnpm\npnpm add pulse-monitor\n\n# yarn\nyarn add pulse-monitor\n\n# bun\nbun add pulse-monitor\n```\n\n---\n\n## 🚀 Quick Start\n\n### 1. Express.js Integration\n\n```typescript\nimport express from 'express';\nimport { Monitor, expressPulseMiddleware } from 'pulse-monitor';\n\nconst app = express();\n\n// Initialize the Monitor instance\nconst monitor = new Monitor({\n  maxBufferSize: 1000,\n  enableThreatDetection: true,\n  dashboardEndpoint: '/pulse', // Accessible path\n  authSecret: 'your-secure-dashboard-password', // Optional password\n});\n\n// Register the Pulse middleware\napp.use(expressPulseMiddleware(monitor));\n\napp.get('/api/users', (req, res) => {\n  res.json([{ id: 1, name: 'Alice' }]);\n});\n\napp.listen(3000, () => {\n  console.log('Server is running on port 3000');\n  console.log('Dashboard is available at http://localhost:3000/pulse');\n});\n```\n\n---\n\n### 2. NestJS Integration\n\n#### Step 1: Create a global Module or Provider for the Monitor instance\n\n```typescript\n// pulse.module.ts\nimport { Module, Global } from '@nestjs/common';\nimport { Monitor } from 'pulse-monitor';\n\n@Global()\n@Module({\n  providers: [\n    {\n      provide: Monitor,\n      useValue: new Monitor({\n        maxBufferSize: 1000,\n        enableThreatDetection: true,\n        dashboardEndpoint: '/pulse',\n        authSecret: 'secret-key',\n      }),\n    },\n  ],\n  exports: [Monitor],\n})\nexport class PulseModule {}\n```\n\n#### Step 2: Bind the Interceptor & Middleware\n\n```typescript\n// main.ts\nimport { NestFactory } from '@nestjs/core';\nimport { AppModule } from './app.module';\nimport { Monitor, NestJSPulseInterceptor, expressPulseMiddleware } from 'pulse-monitor';\n\nasync function bootstrap() {\n  const app = await NestFactory.create(AppModule);\n  \n  // Resolve the Monitor instance\n  const monitor = app.get(Monitor);\n  \n  // Use Express middleware to handle dashboard routes\n  app.use(expressPulseMiddleware(monitor));\n  \n  // Use the NestJS interceptor to capture route performance & metrics\n  app.useGlobalInterceptors(new NestJSPulseInterceptor(monitor));\n\n  await app.listen(3000);\n}\nbootstrap();\n```\n\n---\n\n## ⚙️ Configuration Options\n\n| Option | Type | Default | Description |\n| :--- | :--- | :--- | :--- |\n| `maxBufferSize` | `number` | `1000` | Limits the maximum request logs and threat alerts kept in the in-memory circular buffer. |\n| `enableThreatDetection` | `boolean` | `true` | Enables/disables the real-time intrusion signature scanner. |\n| `whitelistIps` | `string[]` | `[]` | List of client IPs authorized to view the dashboard. If populated, unwhitelisted IPs will be ignored (Stealth Mode). |\n| `dashboardEndpoint` | `string` | `'/pulse'` | Route path where the dashboard will be served. |\n| `authSecret` | `string` | `''` | Passcode required to view the dashboard. Prompts a secure login page if set. |\n| `databaseUrl` | `string` | `''` | Optional database persistence endpoint (useful in serverless environments). |\n\n---\n\n## 🛠️ Build and Development\n\nTo build the package locally for production or npm publishing:\n\n```bash\n# 1. Install dependencies\npnpm install\n\n# 2. Build backend and frontend assets\npnpm run build\n```\n\nThis will:\n1. Compile TypeScript source files using `tsup` into `dist/index.js` (ES Modules) and `dist/index.cjs` (CommonJS).\n2. Install dashboard dependencies and bundle the React code into a single self-contained HTML page at `dist/ui/index.html`.\n\n---\n\n## 📄 License\n\nMIT © [Pulse Monitor](https://github.com/user/pulse-monitor)\n","readmeFilename":"README.md"}