{"_id":"@amarpreetbhatia/api-generator","name":"@amarpreetbhatia/api-generator","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@amarpreetbhatia/api-generator","version":"0.1.0","description":"CLI to scaffold a lightweight Node.js + TypeScript + Express microservice with Winston logging and config.","bin":{"api-generator":"dist/index.js"},"main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc -p tsconfig.json","dev":"ts-node-dev --transpile-only --respawn src/index.ts","prepare":"npm run build"},"keywords":["cli","generator","express","typescript","winston","microservice"],"author":{"name":"Amarpreet Bhatia"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/amarpreetbhatia/api-generator.git"},"bugs":{"url":"https://github.com/amarpreetbhatia/api-generator/issues"},"homepage":"https://github.com/amarpreetbhatia/api-generator#readme","dependencies":{"chalk":"^5.3.0","commander":"^12.1.0","inquirer":"^9.2.23"},"devDependencies":{"@types/node":"^20.12.12","ts-node-dev":"^2.0.0","typescript":"^5.5.4"},"engines":{"node":">=18"},"publishConfig":{"access":"public"},"_id":"@amarpreetbhatia/api-generator@0.1.0","gitHead":"747bbd4855712c431357f26c102fe25eb31bdad7","_nodeVersion":"22.11.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-qM8jhmcRhkCZ4w0WPLXn5F1RZnElim8MQOLrBsg84DMz2mhhI8k7hueoKx4syeXl8K7ykRhVB0Fc1fizJ22C+Q==","shasum":"3cbde83357ce1def51bce4c049d4d1d073a49f0a","tarball":"https://registry.npmjs.org/@amarpreetbhatia/api-generator/-/api-generator-0.1.0.tgz","fileCount":29,"unpackedSize":27626,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC/HwHw3KFvCN//U22O4i9ABBTJBROPVi7K+UmDTv7mHgIhAI3+Q4Xy4OmdnSMXH8LRgxbYpy2SrtAkgKSghbl1M4U8"}]},"_npmUser":{"name":"amarpreetbhatia","email":"amarpreetbhatia@gmail.com"},"directories":{},"maintainers":[{"name":"amarpreetbhatia","email":"amarpreetbhatia@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/api-generator_0.1.0_1757337807152_0.9366799456515629"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-08T13:23:27.081Z","0.1.0":"2025-09-08T13:23:27.350Z","modified":"2025-09-08T13:23:27.594Z"},"maintainers":[{"name":"amarpreetbhatia","email":"amarpreetbhatia@gmail.com"}],"description":"CLI to scaffold a lightweight Node.js + TypeScript + Express microservice with Winston logging and config.","homepage":"https://github.com/amarpreetbhatia/api-generator#readme","keywords":["cli","generator","express","typescript","winston","microservice"],"repository":{"type":"git","url":"git+https://github.com/amarpreetbhatia/api-generator.git"},"author":{"name":"Amarpreet Bhatia"},"bugs":{"url":"https://github.com/amarpreetbhatia/api-generator/issues"},"license":"MIT","readme":"# api-generator\r\n\r\nScaffold a production-minded Node.js + TypeScript + Express microservice with logging, health, metrics, tracing, tests, and Docker.\r\n\r\n## Install\r\n\r\n```bash\r\nnpm install -g api-generator\r\n```\r\n\r\n## Usage\r\n\r\n```bash\r\n# create in current directory, with hello endpoint\r\napi-generator\r\n\r\n# create in provided directory with users endpoint\r\napi-generator users --dir ./users-service\r\n\r\n# choose package manager\r\napi-generator products --dir ./products-service --package-manager pnpm\r\n```\r\n\r\n## Features\r\n- Express + TypeScript boilerplate with versioned routes (`/api/v1`)\r\n- Logging with Winston, request-id correlation\r\n- Health endpoints: `/healthz`, `/readyz`\r\n- Prometheus metrics at `/metrics`\r\n- OpenTelemetry tracing (gated via env)\r\n- Zod env validation and request validation helper\r\n- Vitest + MSW + Supertest tests\r\n- Dockerfile (multi-stage, non-root, HEALTHCHECK) + .dockerignore\r\n- Config via `config/` and `.env` (dotenv prewired)\r\n\r\n## How to use\r\n\r\n### 1) Generate a service\r\n```bash\r\n# hello default\r\napi-generator --dir ./hello-service\r\n\r\n# custom endpoint\r\napi-generator users --dir ./users-service\r\n```\r\n\r\n### 2) Install and run\r\n```bash\r\ncd ./users-service\r\nnpm install\r\ncp env.example .env\r\nnpm run dev\r\n```\r\n\r\nTest endpoints:\r\n```bash\r\ncurl http://localhost:3000/healthz\r\ncurl http://localhost:3000/readyz\r\ncurl http://localhost:3000/metrics\r\ncurl \"http://localhost:3000/api/v1/users?limit=5\"\r\n```\r\n\r\n### 3) Add a database (optional)\r\nSee the generated service `README.md` for Postgres integration using Prisma, TypeORM, or Sequelize, plus docker-compose.\r\n\r\n### 4) Run tests\r\n```bash\r\nnpm test\r\n```\r\n\r\n### 5) Build and publish Docker image\r\n```bash\r\n# build image (from generated service directory)\r\ndocker build -t myorg/users-service:0.1.0 .\r\n\r\n# run locally\r\ndocker run --rm -p 3000:3000 --env-file ./.env myorg/users-service:0.1.0\r\n\r\n# push to registry\r\ndocker tag myorg/users-service:0.1.0 ghcr.io/myorg/users-service:0.1.0\r\ndocker push ghcr.io/myorg/users-service:0.1.0\r\n```\r\n\r\nNotes:\r\n- Container runs as non-root and exposes `/healthz` for HEALTHCHECK.\r\n- Enable tracing by setting `OTEL_ENABLED=true` and optionally `OTEL_EXPORTER_OTLP_ENDPOINT`.\r\n\r\n## License\r\nMIT\r\n","readmeFilename":"README.md","_rev":"1-f259c76693f3bbee4c939a600285e078"}