{"_id":"@arbajit_sen/backend-pod-cli","_rev":"2-2c757ac1b90ecd0cdbd5008d330c9c37","name":"@arbajit_sen/backend-pod-cli","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@arbajit_sen/backend-pod-cli","version":"1.0.0","keywords":["node","express","typescript","backend","cli","scaffold"],"author":"","license":"ISC","_id":"@arbajit_sen/backend-pod-cli@1.0.0","maintainers":[{"name":"arbajit_sen","email":"arbajitsen.freelancer@gmail.com"}],"bin":{"node-pod":"dist/index.js"},"dist":{"shasum":"e5410f0b375e548d8a26a257a98f52e9cd05dd2b","tarball":"https://registry.npmjs.org/@arbajit_sen/backend-pod-cli/-/backend-pod-cli-1.0.0.tgz","fileCount":6373,"integrity":"sha512-CNkEBML1o8yWHyMru1f3WfbrbErlpw1yAmJesXypLpzvhHiYoGD9q6F6pvzGoHpB11MlHmMHo5TZRvC+AX/q+g==","signatures":[{"sig":"MEQCIB94L5MEY9s35+WaF0NxdMskNPlR+4KutmO9HNKgb8YtAiBOey9oT1KuvGoGQYkBDeDLGQdhCjNAB9mPue6VFXeuSQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":66095278},"main":"index.js","gitHead":"c3b8e2279fcedd3205fe7ebcf248412f7fa02b1f","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"tsc"},"_npmUser":{"name":"arbajit_sen","email":"arbajitsen.freelancer@gmail.com"},"_npmVersion":"10.9.7","description":"","directories":{},"_nodeVersion":"22.22.2","dependencies":{"ora":"^9.4.1","chalk":"^5.6.2","execa":"^9.6.1","fs-extra":"^11.3.5","inquirer":"^14.0.2"},"_hasShrinkwrap":false,"devDependencies":{"ts-node":"^10.9.2","typescript":"^6.0.3","@types/node":"^26.0.0","@types/fs-extra":"^11.0.4"},"_npmOperationalInternal":{"tmp":"tmp/backend-pod-cli_1.0.0_1782320599142_0.35755406166217907","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@arbajit_sen/backend-pod-cli","version":"1.0.1","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"tsc"},"bin":{"node-pod":"dist/index.js"},"keywords":["node","express","typescript","backend","cli","scaffold"],"author":"","license":"ISC","description":"[![npm version](https://img.shields.io/npm/v/@arbajit_sen/backend-pod-cli.svg?style=flat-square)](https://www.npmjs.com/package/@arbajit_sen/backend-pod-cli) [![npm downloads](https://img.shields.io/npm/dm/@arbajit_sen/backend-pod-cli.svg?style=flat-squar","dependencies":{"chalk":"^5.6.2","execa":"^9.6.1","fs-extra":"^11.3.5","inquirer":"^14.0.2","ora":"^9.4.1"},"devDependencies":{"@types/fs-extra":"^11.0.4","@types/node":"^26.0.0","ts-node":"^10.9.2","typescript":"^6.0.3"},"_id":"@arbajit_sen/backend-pod-cli@1.0.1","gitHead":"369eba3ac10c26f4b5c5810f06201388154636ca","_nodeVersion":"22.22.2","_npmVersion":"10.9.7","dist":{"integrity":"sha512-Vo6k0ixPuK6xPR8xJKFZoN0NnTGINEJXgsQp0C8w7cD6DgWc7ZMFjOf9nMQ5VKMFWC4og029Z7G6X/b1QsK6Og==","shasum":"498f7fe163d9b2f1368763a1e6c338a22ac989d5","tarball":"https://registry.npmjs.org/@arbajit_sen/backend-pod-cli/-/backend-pod-cli-1.0.1.tgz","fileCount":6374,"unpackedSize":66102416,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIEwss+gTty0MGlSjI7C7IIdrrX1vklhNsJz1iR9Xt7HyAiEA+hqDlBhPi5CKUpzTe2gWB8V8jGUMIGrgVjStSbm/WlA="}]},"_npmUser":{"name":"arbajit_sen","email":"arbajitsen.freelancer@gmail.com"},"directories":{},"maintainers":[{"name":"arbajit_sen","email":"arbajitsen.freelancer@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/backend-pod-cli_1.0.1_1782322557524_0.24790758265970392"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-24T17:03:19.000Z","modified":"2026-06-24T17:35:58.092Z","1.0.0":"2026-06-24T17:03:19.542Z","1.0.1":"2026-06-24T17:35:57.982Z"},"license":"ISC","keywords":["node","express","typescript","backend","cli","scaffold"],"maintainers":[{"name":"arbajit_sen","email":"arbajitsen.freelancer@gmail.com"}],"readme":"# Backend Pod CLI (`node-pod`)\n\n[![npm version](https://img.shields.io/npm/v/@arbajit_sen/backend-pod-cli.svg?style=flat-square)](https://www.npmjs.com/package/@arbajit_sen/backend-pod-cli)\n[![npm downloads](https://img.shields.io/npm/dm/@arbajit_sen/backend-pod-cli.svg?style=flat-square)](https://www.npmjs.com/package/@arbajit_sen/backend-pod-cli)\n[![license](https://img.shields.io/npm/l/@arbajit_sen/backend-pod-cli.svg?style=flat-square)](https://github.com/arbajit-sen/node-pod/blob/main/LICENSE)\n\nA powerful, lightweight scaffolding CLI to spin up a fully-configured, production-ready **Node.js, Express, and TypeScript** application in seconds.\n\nThe generated project comes pre-equipped with essential architectural utilities like a custom memory-optimized rate limiter, global async controller wrappers, standardized JSON response handlers, security middleware, and a structured logging setup.\n\n---\n\n## 🚀 Quick Start\n\nYou can scaffold a new project instantly using `npx` without installing the package globally:\n\n```bash\nnpx @arbajit_sen/backend-pod-cli <project-name>\n```\n\nFor example:\n```bash\nnpx @arbajit_sen/backend-pod-cli my-awesome-api\n```\n\n---\n\n## 📦 Global Installation\n\nAlternatively, you can install the CLI globally on your system to use the `node-pod` command anytime:\n\n```bash\nnpm install -g @arbajit_sen/backend-pod-cli\n```\n\nOnce installed, simply run:\n```bash\nnode-pod my-awesome-api\n```\n\n---\n\n## ✨ Features Included in the Template\n\nEvery project generated by `node-pod` includes:\n\n- **TypeScript Core**: Strict mode configurations, paths, and build scripts.\n- **Custom Optimized Rate Limiter**: \n  - An in-memory, fixed-window rate limiter designed to work out-of-the-box.\n  - Automatically appends standard rate limit headers (`X-RateLimit-Limit`, `X-RateLimit-Remaining`, and `X-RateLimit-Reset`).\n  - Proactive background cleanup sweeps to automatically prune expired entries, avoiding memory leaks.\n- **Global Controller Wrapper**:\n  - Eliminates the need to write `try-catch` blocks inside every route handler.\n  - Handles synchronous and asynchronous controller errors, automatically routing them to the global error middleware.\n- **Standardized API Responses**:\n  - `successResponse` and `errorResponse` helpers that guarantee a predictable payload structure across all endpoints.\n- **Structured Error Handling**:\n  - A centralized error middleware that formats and logs exceptions.\n- **Advanced Security & Middleware**:\n  - Pre-configured `helmet` (security headers), `cors` (Cross-Origin Resource Sharing), and `cookie-parser`.\n- **Winston Logger**:\n  - Pre-configured for daily rolling files and console output with distinct formatting for development and production environments.\n\n---\n\n## 📁 Generated Project Structure\n\n```text\n├── .husky/              # Git hooks configuration\n├── src/\n│   ├── configs/\n│   │   └── wrappers/\n│   │       ├── controllerWrapper.ts   # Error-catching controller wrapper\n│   │       └── responseWrapper.ts     # Standardized JSON success/error response helpers\n│   ├── controllers/\n│   │   └── healthController.ts        # Sample health controller demonstrating wrappers\n│   ├── middleware/\n│   │   ├── errorHandler.ts            # Global express error handler using response wrapper\n│   │   ├── rateLimiter.ts             # Custom memory-safe rate limiter middleware\n│   │   └── requestLogger.ts           # HTTP request logger middleware\n│   ├── routes/\n│   │   ├── healthRoutes.ts            # Routes for healthcheck\n│   │   └── index.ts                   # Router registry\n│   ├── services/\n│   │   └── healthService.ts           # Health check business logic\n│   ├── utils/\n│   │   └── logger.ts                  # Winston rolling file logger setup\n│   ├── app.ts                         # Express application setup and global middleware mounts\n│   └── server.ts                      # Server bootstrap & graceful shutdown handler\n├── .env.example                       # Base environment variables\n├── .eslintrc.json                     # Code quality configuration\n├── .prettierrc                        # Code formatting configuration\n├── nodemon.json                       # Live-reloading configuration\n├── tsconfig.json                      # Compiler configurations\n└── package.json                       # Scripts and project dependencies\n```\n\n---\n\n## 🛠️ Developed Scripts\n\nAfter generating the project and navigating into its directory (`cd <project-name>`), you can run the following scripts:\n\n| Command | Description |\n| :--- | :--- |\n| `npm run dev` | Starts the server in development mode with active file-watching and hot-reloads via `nodemon`. |\n| `npm run build` | Compiles the TypeScript source files inside `/src` to JavaScript files inside `/dist`. |\n| `npm run start` | Boots the compiled production application located in the `/dist` directory. |\n| `npm run lint` | Runs ESLint check across all TypeScript source files. |\n| `npm run lint:fix` | Audits the codebase and automatically fixes all auto-repairable ESLint issues. |\n| `npm run format` | Enforces unified styling by formatting all files with Prettier. |\n\n---\n\n## 💡 How the Architecture Works\n\n### 1. Global Controller Wrapper (`controllerWrapper`)\nAvoid adding try-catch blocks to every async controller function. Wrap your handler with `controllerWrapper`, and any rejected Promise will automatically be caught and passed to the Express error middleware:\n\n```typescript\nimport { Request, Response } from \"express\";\nimport { controllerWrapper } from \"../configs/wrappers/controllerWrapper\";\nimport { successResponse } from \"../configs/wrappers/responseWrapper\";\n\nexport const getUserProfile = controllerWrapper(async (req: Request, res: Response) => {\n  const user = await database.findUser(req.params.id);\n  \n  if (!user) {\n    throw { statusCode: 404, message: \"User not found\" };\n  }\n  \n  successResponse(res, user, \"User profile retrieved successfully\");\n});\n```\n\n### 2. Standardized Response Format\nSuccess payloads conform to:\n```json\n{\n  \"success\": true,\n  \"message\": \"User profile retrieved successfully\",\n  \"data\": { ... }\n}\n```\n\nError payloads (including global 404s and unhandled server errors) conform to:\n```json\n{\n  \"success\": false,\n  \"message\": \"User not found\"\n}\n```\n\n### 3. Custom Rate Limiter\nThe rate limiter operates without external dependencies (no `express-rate-limit` or Redis package required). Memory leaks are prevented via a periodic background cleanup routine:\n\n```typescript\nimport { CustomRateLimiter } from \"./middleware/rateLimiter\";\n\n// Create custom threshold\nconst limiter = new CustomRateLimiter({\n  windowMs: 15 * 60 * 1000, // 15 minutes\n  max: 100, // Limit each IP to 100 requests per window\n  message: \"Too many requests, please try again later.\"\n});\n\napp.use(limiter.middleware());\n```\n\n---\n\n## 📄 License\n\nThis CLI and scaffolded codebase is open-source and licensed under the **ISC License**.\n","readmeFilename":"README.md","description":"[![npm version](https://img.shields.io/npm/v/@arbajit_sen/backend-pod-cli.svg?style=flat-square)](https://www.npmjs.com/package/@arbajit_sen/backend-pod-cli) [![npm downloads](https://img.shields.io/npm/dm/@arbajit_sen/backend-pod-cli.svg?style=flat-squar"}