{"_id":"@alikhan-devs/docify","_rev":"3-46471bba66885c678d9f14738ea3e443","name":"@alikhan-devs/docify","dist-tags":{"latest":"1.3.0"},"versions":{"1.0.0":{"name":"@alikhan-devs/docify","version":"1.0.0","keywords":["express","middleware","api","documentation","auto-docs","swagger-alternative","rest-api","developer-tools"],"author":{"name":"Ali Khan"},"license":"MIT","_id":"@alikhan-devs/docify@1.0.0","maintainers":[{"name":"alikhan-devs","email":"alikhandevs@gmail.com"}],"dist":{"shasum":"8eef2b337e0b146bc49a78d5925f9dc8a287b6d0","tarball":"https://registry.npmjs.org/@alikhan-devs/docify/-/docify-1.0.0.tgz","fileCount":9,"integrity":"sha512-Kb8PpiR+d9aXmfMyy1NZACXbt0qnSasIkDSgzBtsHRDu94OGkR9XAM4ShWTdeN3feQjKlYHNsGT0UFK0S/Ycdw==","signatures":[{"sig":"MEUCIEL4RtNegmdPxX9ZIZ/eHAAGOcwgQtjBRuo07UplwYRxAiEAm9v5FZNgLjmilrMNdNpbLH1g/jy0fAm5DBvuQ/7norA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":50313},"main":"src/index.js","engines":{"node":">=16.0.0"},"gitHead":"3484425ad998020159b9adcc76c018502981ca6e","scripts":{"test":"vitest run","example":"node example/app.js","test:watch":"vitest"},"_npmUser":{"name":"alikhan-devs","email":"alikhandevs@gmail.com"},"_npmVersion":"11.8.0","description":"Zero-config Express.js middleware that automatically generates API documentation from runtime usage","directories":{},"_nodeVersion":"24.13.1","_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.1.0","express":"^4.21.0","supertest":"^7.0.0"},"peerDependencies":{"express":">=4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/docify_1.0.0_1777639050072_0.9580310680711697","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@alikhan-devs/docify","version":"1.2.0","keywords":["express","middleware","api","documentation","auto-docs","swagger-alternative","rest-api","developer-tools"],"author":"","license":"MIT","_id":"@alikhan-devs/docify@1.2.0","maintainers":[{"name":"alikhan-devs","email":"alikhandevs@gmail.com"}],"dist":{"shasum":"8766c1680329f8304f218f60ace46b59e63109f6","tarball":"https://registry.npmjs.org/@alikhan-devs/docify/-/docify-1.2.0.tgz","fileCount":9,"integrity":"sha512-qacuLzY2kd1FyhtiioHicdk3Sj2pfZLZ20CstybeqoelPIzGUCY3tqcNjd64xy4tDE7A5YTrPjVe0byqOT9MPA==","signatures":[{"sig":"MEYCIQDOfbM3qdFYfdtGh6uIF9C73oJW8wIfwhrPLZgVYiOtVQIhAMr8hkLUiLHHFXrSCUDDubN5FrY5wcHlQ/NQrMmxwv8+","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":67854},"main":"src/index.js","engines":{"node":">=16.0.0"},"gitHead":"05d766aad9eae59983e22e629242013238f5b888","scripts":{"test":"vitest run","example":"node example/app.js","test:watch":"vitest"},"_npmUser":{"name":"alikhan-devs","email":"alikhandevs@gmail.com"},"_npmVersion":"11.8.0","description":"Zero-config Express.js middleware that automatically generates API documentation from runtime usage","directories":{},"_nodeVersion":"24.13.1","_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.1.0","express":"^4.21.0","supertest":"^7.0.0"},"peerDependencies":{"express":">=4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/docify_1.2.0_1777649277388_0.9755816334390874","host":"s3://npm-registry-packages-npm-production"}},"1.3.0":{"name":"@alikhan-devs/docify","version":"1.3.0","description":"Zero-config Express.js middleware that automatically generates API documentation from runtime usage","main":"src/index.js","scripts":{"test":"vitest run","test:watch":"vitest","example":"node example/app.js"},"keywords":["express","middleware","api","documentation","auto-docs","swagger-alternative","rest-api","developer-tools"],"author":{"name":"Ali Khan"},"repository":{"type":"git","url":"git+https://github.com/AliKhan-Devs/Docify.git"},"license":"MIT","devDependencies":{"express":"^4.21.0","supertest":"^7.0.0","vitest":"^3.1.0"},"peerDependencies":{"express":">=4.0.0"},"engines":{"node":">=16.0.0"},"gitHead":"12d51c8a1c284de425a023b1bd6c7af0e1f24ff0","_id":"@alikhan-devs/docify@1.3.0","bugs":{"url":"https://github.com/AliKhan-Devs/Docify/issues"},"homepage":"https://github.com/AliKhan-Devs/Docify#readme","_nodeVersion":"24.13.1","_npmVersion":"11.8.0","dist":{"integrity":"sha512-9QLIY7ekHHfQW+s3QZ34oxVyVdc9pdI3O+O6OwE5JclkJYzRPdhkmXRq2y64rNjMZPSpXj2O4mp/6MZB904yCw==","shasum":"5b6cb01929ab79111960f5f5a6ee163c4b509f98","tarball":"https://registry.npmjs.org/@alikhan-devs/docify/-/docify-1.3.0.tgz","fileCount":9,"unpackedSize":68001,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIG1M9l7s5N1TJujY4xJrtr7hajBhKAAB/k4kUW+kW6qaAiEA+7FJ7f7noGuwzczbykihGyeTvhkFBIIEYPDHtLgYEVI="}]},"_npmUser":{"name":"alikhan-devs","email":"alikhandevs@gmail.com"},"directories":{},"maintainers":[{"name":"alikhan-devs","email":"alikhandevs@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/docify_1.3.0_1777651976402_0.2135393563788539"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-01T12:37:29.974Z","modified":"2026-05-01T16:12:56.649Z","1.0.0":"2026-05-01T12:37:30.262Z","1.2.0":"2026-05-01T15:27:57.550Z","1.3.0":"2026-05-01T16:12:56.547Z"},"license":"MIT","keywords":["express","middleware","api","documentation","auto-docs","swagger-alternative","rest-api","developer-tools"],"description":"Zero-config Express.js middleware that automatically generates API documentation from runtime usage","maintainers":[{"name":"alikhan-devs","email":"alikhandevs@gmail.com"}],"readme":"<p align=\"center\">\r\n  <img src=\"https://img.shields.io/badge/docify-v1.0.0-818cf8?style=for-the-badge&labelColor=0a0b0f\" alt=\"version\" />\r\n  <img src=\"https://img.shields.io/badge/express-4.x+-34d399?style=for-the-badge&labelColor=0a0b0f\" alt=\"express\" />\r\n  <img src=\"https://img.shields.io/badge/zero_config-✓-fbbf24?style=for-the-badge&labelColor=0a0b0f\" alt=\"zero config\" />\r\n  <img src=\"https://img.shields.io/badge/dependencies-0-c084fc?style=for-the-badge&labelColor=0a0b0f\" alt=\"deps\" />\r\n</p>\r\n\r\n<h1 align=\"center\">📄 Docify</h1>\r\n\r\n<<p align=\"center\">\r\n  <strong>Turn any Express API into live documentation in 2 lines.</strong>\r\n</p>\r\n\r\n<p align=\"center\">\r\n  No Swagger. No schemas. No setup.<br/>\r\n  Just run your API → docs generate themselves.\r\n</p>\r\n\r\n---\r\n\r\n<!-- dashboard image -->\r\n![Dashboard Image of Docify](./images/dashboard.png)\r\n\r\n## ⚡ Quick Start\r\n\r\n```bash\r\nnpm install docify\r\n```\r\n\r\n```js\r\nconst express = require('express');\r\nconst docify = require('@alikhan-devs/docify');\r\n\r\nconst app = express();\r\napp.use(express.json());\r\n\r\n// One line — that's it!\r\napp.use(docify());\r\n\r\n// Your existing routes work as before\r\napp.get('/api/users', (req, res) => { /* ... */ });\r\napp.post('/api/users', (req, res) => { /* ... */ });\r\n\r\napp.listen(3000);\r\n// Visit http://localhost:3000/docs to see your auto-generated API docs!\r\n```\r\n\r\n## 🎯 How It Works\r\n\r\n1. **You install Docify** and add it as Express middleware\r\n2. **You develop normally** — no annotations, no schemas, no changes to your code\r\n3. **Docify observes** every API request and response flowing through your app\r\n4. **Documentation is generated** automatically and served at `/docs`\r\n5. **Live updates** — as you make more API calls, docs update in real-time via SSE\r\n\r\n## 📋 Configuration\r\n\r\n```js\r\napp.use(docify({\r\n  docsPath: '/docs',          // URL path for documentation UI (default: '/docs')\r\n  sanitize: true,             // Mask sensitive fields like passwords/tokens (default: true)\r\n  enabled: true,              // Master switch (default: true)\r\n  maxExamples: 5,             // Max request/response examples per endpoint (default: 5)\r\n  sensitiveFields: [],        // Additional field names to redact (default: [])\r\n  ignorePaths: ['/health'],   // Paths to exclude from capture (default: [])\r\n  captureHeaders: false,      // Whether to capture req/res headers (default: false)\r\n  persist: true,              // Keep captured docs after server restarts (default: true)\r\n  storagePath: '.docify/docify.json', // Optional custom persistence file\r\n}));\r\n```\r\n\r\n### Environment Variables\r\n\r\n| Variable | Description |\r\n|---|---|\r\n| `DOCIFY_ENABLED=false` | Disable Docify entirely (useful for production) |\r\n| `DOCIFY_DEBUG=true` | Enable internal debug logging |\r\n\r\n## 🏗️ Architecture\r\n\r\n```\r\nExpress Request → Capture Middleware → Sanitizer → Route Registry → Doc Generator → UI\r\n```\r\n\r\n| Module | Responsibility |\r\n|---|---|\r\n| **Capture Middleware** | Intercepts `res.write`/`res.end` to capture response bodies non-destructively |\r\n| **Route Registry** | In-memory store that groups API calls by normalized routes, detects parameterized paths |\r\n| **Sanitizer** | Deep-scans objects and masks sensitive fields (`password`, `token`, `secret`, etc.) |\r\n| **Doc Generator** | Transforms registry data into structured, sorted, grouped JSON |\r\n| **UI Server** | Serves a self-contained HTML documentation page with SSE live updates |\r\n\r\n## Persistent Docs, Cleanup, and Try It\r\n\r\nDocify now stores captured documentation in `.docify/docify.json` by default, so restarting your backend does not wipe the generated docs. Set `persist: false` if you only want in-memory docs during tests or short-lived sessions.\r\n\r\nIf a wrong request is captured, such as `GET /users` when the endpoint should be `POST /users`, open the endpoint in the UI and use the delete button to remove only that captured route.\r\n\r\nEach endpoint page also includes a try panel. You can edit the method, path, query string, and JSON body, then run the request against the live backend and see the real response immediately.\r\n\r\n### Parameterized Route Detection\r\n\r\nDocify automatically detects dynamic URL segments:\r\n\r\n- `/users/123` → `/users/:id`\r\n- `/users/550e8400-e29b-41d4-a716-446655440000` → `/users/:id`\r\n- `/users/507f1f77bcf86cd799439011` → `/users/:id`\r\n\r\n## 🔒 Security\r\n\r\n- **Sensitive fields are masked by default** — passwords, tokens, API keys, secrets are replaced with `[REDACTED]`\r\n- **No external network calls** — all data stays in-process memory\r\n- **Response body size limit** — bodies >1MB are truncated\r\n- **Self-exclusion** — Docify's own routes are never captured\r\n- **Production disable** — set `DOCIFY_ENABLED=false` in production\r\n\r\n### Default Redacted Fields\r\n\r\n`password`, `token`, `access_token`, `refresh_token`, `api_key`, `secret`, `authorization`, `cookie`, `session`, `credit_card`, `card_number`, `cvv`, `ssn`, `private_key`, `x-api-key`\r\n\r\n## 📡 API Endpoints\r\n\r\nWhen Docify is mounted, these routes are available:\r\n\r\n| Route | Description |\r\n|---|---|\r\n| `GET /docs` | Documentation UI |\r\n| `GET /docs/api.json` | Raw JSON API catalog (SDK-friendly) |\r\n| `GET /docs/stream` | Server-Sent Events stream for live updates |\r\n| `DELETE /docs/api.json` | Clear all captured data |\r\n| `DELETE /docs/endpoint` | Delete one captured endpoint by `method` and `path` |\r\n| `POST /docs/try` | Run an endpoint against the live backend from the docs UI |\r\n\r\n## 🧪 Running the Example\r\n\r\n```bash\r\ncd example\r\nnpm install\r\nnpm start\r\n```\r\n\r\nThen make some API calls:\r\n\r\n```bash\r\ncurl http://localhost:3000/api/users\r\ncurl -X POST http://localhost:3000/api/users -H \"Content-Type: application/json\" -d '{\"name\":\"Alice\",\"email\":\"alice@test.com\"}'\r\ncurl http://localhost:3000/api/products?category=electronics\r\ncurl -X POST http://localhost:3000/api/auth/login -H \"Content-Type: application/json\" -d '{\"email\":\"alice@example.com\",\"password\":\"secret\"}'\r\n```\r\n\r\nVisit `http://localhost:3000/docs` to see the auto-generated documentation!\r\n\r\n## 📄 License\r\n\r\nMIT\r\n","readmeFilename":"README.md","homepage":"https://github.com/AliKhan-Devs/Docify#readme","repository":{"type":"git","url":"git+https://github.com/AliKhan-Devs/Docify.git"},"author":{"name":"Ali Khan"},"bugs":{"url":"https://github.com/AliKhan-Devs/Docify/issues"}}