{"_id":"@deshrajverma/api-response-kit","name":"@deshrajverma/api-response-kit","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@deshrajverma/api-response-kit","version":"1.0.0","description":"A lightweight TypeScript utility for creating consistent API responses.","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"build":"tsc","test":"npm run build && node test/index.js","prepublishOnly":"npm run test"},"keywords":["api","response","typescript","nodejs","express","nextjs","backend"],"author":{"name":"Deshraj Verma"},"license":"MIT","type":"commonjs","engines":{"node":">=18"},"devDependencies":{"typescript":"^7.0.2"},"repository":{"type":"git","url":"git+https://github.com/deshrajvermay9517-png/api-response-kit.git"},"homepage":"https://github.com/deshrajvermay9517-png/api-response-kit#readme","bugs":{"url":"https://github.com/deshrajvermay9517-png/api-response-kit/issues"},"gitHead":"08c96fb2b0ba7e39f9222afaf6ef354bd251463f","_id":"@deshrajverma/api-response-kit@1.0.0","_nodeVersion":"24.15.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-83FzfaxF65e1E6odLolQwCWr3j1vfMVYJN+yYrQa/fRRqiPHdlGv3Ekzw88KDygVdM+Ij5sNMWDgNuLo8yCnJw==","shasum":"3133993ac8543550bd14205512107764e70b5fa3","tarball":"https://registry.npmjs.org/@deshrajverma/api-response-kit/-/api-response-kit-1.0.0.tgz","fileCount":7,"unpackedSize":5660,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFOIi4sQ4+l5LGYlQahcz40dcla4zcEAAqe/lOyetmikAiAekqYeuY4/4W1MZXROS0v+q2/GluzkBUlfye8uT4QyAA=="}]},"_npmUser":{"name":"deshrajverma","email":"deshrajvermay9517@gmail.com"},"directories":{},"maintainers":[{"name":"deshrajverma","email":"deshrajvermay9517@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/api-response-kit_1.0.0_1788506578672_0.04330291764369765"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-04T07:22:58.388Z","1.0.0":"2026-09-04T07:22:58.812Z","modified":"2026-09-04T07:22:59.020Z"},"maintainers":[{"name":"deshrajverma","email":"deshrajvermay9517@gmail.com"}],"description":"A lightweight TypeScript utility for creating consistent API responses.","homepage":"https://github.com/deshrajvermay9517-png/api-response-kit#readme","keywords":["api","response","typescript","nodejs","express","nextjs","backend"],"repository":{"type":"git","url":"git+https://github.com/deshrajvermay9517-png/api-response-kit.git"},"author":{"name":"Deshraj Verma"},"bugs":{"url":"https://github.com/deshrajvermay9517-png/api-response-kit/issues"},"license":"MIT","readme":"# API Response Kit\r\n\r\nA lightweight TypeScript utility for creating consistent API responses in Node.js, Express, Next.js, and JavaScript/TypeScript applications.\r\n\r\n## Features\r\n\r\n- Simple and consistent API responses\r\n- Built-in TypeScript types\r\n- Generic response types\r\n- Success and error helpers\r\n- Zero runtime dependencies\r\n- Works with Node.js, Express, and Next.js\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install @deshrajverma/api-response-kit\r\n```\r\n\r\n## Usage\r\n\r\n```typescript\r\nimport { successResponse, errorResponse } from \"@deshrajverma/api-response-kit\";\r\n\r\n// Success response\r\nconst success = successResponse({ id: 1, name: \"Deshraj\" }, \"User fetched\");\r\nconsole.log(success);\r\n// {\r\n//   success: true,\r\n//   message: \"User fetched\",\r\n//   data: { id: 1, name: \"Deshraj\" }\r\n// }\r\n\r\n// Error response\r\nconst error = errorResponse(\"User not found\");\r\nconsole.log(error);\r\n// {\r\n//   success: false,\r\n//   message: \"User not found\"\r\n// }\r\n```\r\n\r\n## TypeScript\r\n\r\n```typescript\r\nimport type { ApiResponse } from \"@deshrajverma/api-response-kit\";\r\n\r\ntype User = {\r\n  id: number;\r\n  name: string;\r\n};\r\n\r\nconst response: ApiResponse<User> = successResponse({ id: 1, name: \"Deshraj\" });\r\n```\r\n\r\n## API\r\n\r\n### `successResponse<T>(data, message?)`\r\n\r\nCreates a standardized success response object.\r\n\r\n- `data`: The payload/data to return (`T`).\r\n- `message` *(optional)*: Success message string (default: `\"Request successful\"`).\r\n\r\n### `errorResponse(message?, errors?)`\r\n\r\nCreates a standardized error response object.\r\n\r\n- `message` *(optional)*: Error message string (default: `\"Something went wrong\"`).\r\n- `errors` *(optional)*: Error details or validation errors (`unknown`).\r\n\r\n## License\r\n\r\nMIT\r","readmeFilename":"README.md","_rev":"1-0d3a92c3368984752af222ec13824087"}