{"_id":"@avhishek_nandi/roleadmin","_rev":"2-4723e7392bf786371c4f55b7b8cc6302","name":"@avhishek_nandi/roleadmin","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"@avhishek_nandi/roleadmin","version":"1.0.0","keywords":["role"],"author":{"name":"Avhishek Nandi"},"license":"ISC","_id":"@avhishek_nandi/roleadmin@1.0.0","maintainers":[{"name":"avhishek_nandi","email":"avhisheknandi03@gmail.com"}],"homepage":"https://github.com/AvHai/roleAuth-npmPackage#readme","bugs":{"url":"https://github.com/AvHai/roleAuth-npmPackage/issues"},"dist":{"shasum":"2a3b379fe2d6425d6fc57920a60a9577d7dd196e","tarball":"https://registry.npmjs.org/@avhishek_nandi/roleadmin/-/roleadmin-1.0.0.tgz","fileCount":1960,"integrity":"sha512-xpv1F2nfsQxqp+/EzuJYbsnBA/C9TrL7fyvLDVMx5gsKqIXsNTpDVrli4WZ4hz7lKHc+M21OfUmKOIBJMVKJcg==","signatures":[{"sig":"MEYCIQC3GfcL91zY4u6gKWKLDOCJcAzoFCCkrZ4Vd2a0YoVzLgIhAMfblHvoHwtOJKCSS/+kJes6wR7Sm76Yzqq73Tv7b7W5","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15808677},"main":"src/index.js","gitHead":"7f1fa34b7f21087c2f97c3d8bf74c5386b618fff","scripts":{"test":"echo \"Error: no test specified\" && exit 1","start":"nodemon src/index.js"},"_npmUser":{"name":"avhishek_nandi","actor":{"name":"avhishek_nandi","type":"user","email":"avhisheknandi03@gmail.com"},"email":"avhisheknandi03@gmail.com"},"repository":{"url":"git+https://github.com/AvHai/roleAuth-npmPackage.git","type":"git"},"_npmVersion":"10.9.2","description":"Role-Based Authentication NPM Package","directories":{},"_nodeVersion":"22.16.0","dependencies":{"bcrypt":"^6.0.0","dotenv":"^17.0.1","express":"^5.1.0","mongoose":"^8.16.1","jsonwebtoken":"^9.0.2"},"_hasShrinkwrap":false,"devDependencies":{"nodemon":"^3.1.10"},"_npmOperationalInternal":{"tmp":"tmp/roleadmin_1.0.0_1751969639171_0.39614490730767216","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"name":"@avhishek_nandi/roleadmin","version":"2.0.1","description":"Role-Based Authentication NPM Package","main":"src/index.js","scripts":{"start":"nodemon src/index.js","test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/AvHai/roleAuth-npmPackage.git"},"keywords":["role"],"author":{"name":"Avhishek Nandi"},"license":"ISC","bugs":{"url":"https://github.com/AvHai/roleAuth-npmPackage/issues"},"homepage":"https://github.com/AvHai/roleAuth-npmPackage#readme","dependencies":{"bcrypt":"^6.0.0","dotenv":"^17.0.1","express":"^5.1.0","jsonwebtoken":"^9.0.2","mongoose":"^8.16.1"},"devDependencies":{"nodemon":"^3.1.10"},"_id":"@avhishek_nandi/roleadmin@2.0.1","gitHead":"729613c778248c163b551973c06cacd6daaeb7a0","_nodeVersion":"22.13.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-KwrUrreCnIDL5/VfNQ6vtD/lvTgVIlibu84UMOoyOG5t+vhtm3JNkGSS3eWxzD3SBODoJWC42E4+VoHhnIeYMw==","shasum":"ba18f5d39b1f6babffab849445178b37256edea0","tarball":"https://registry.npmjs.org/@avhishek_nandi/roleadmin/-/roleadmin-2.0.1.tgz","fileCount":1960,"unpackedSize":16132911,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHIywFl19v+nZAYlvgbeaMsKy8oGSmyM5Rv5PZj0BQhNAiBS12SpFOrTxtak3vpiBNrh3paO1btIrGBoccuZjNUczQ=="}]},"_npmUser":{"name":"avhishek_nandi","email":"avhisheknandi03@gmail.com"},"directories":{},"maintainers":[{"name":"avhishek_nandi","email":"avhisheknandi03@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/roleadmin_2.0.1_1752315661324_0.3963835929715256"},"_hasShrinkwrap":false}},"time":{"created":"2025-07-08T10:13:59.112Z","modified":"2025-07-12T10:21:01.836Z","1.0.0":"2025-07-08T10:13:59.449Z","2.0.1":"2025-07-12T10:21:01.659Z"},"bugs":{"url":"https://github.com/AvHai/roleAuth-npmPackage/issues"},"author":{"name":"Avhishek Nandi"},"license":"ISC","homepage":"https://github.com/AvHai/roleAuth-npmPackage#readme","keywords":["role"],"repository":{"type":"git","url":"git+https://github.com/AvHai/roleAuth-npmPackage.git"},"description":"Role-Based Authentication NPM Package","maintainers":[{"name":"avhishek_nandi","email":"avhisheknandi03@gmail.com"}],"readme":"# roleAuth\r\n\r\nA reusable role-based authentication package for Express + MongoDB.\r\n\r\n## 🌟 Features\r\n- ✅ User registration\r\n- ✅ Login with JWT tokens\r\n- ✅ Dynamic role configuration\r\n- ✅ Middleware for auth & role checks\r\n- ✅ Prebuilt routes (plug-and-play)\r\n\r\n## 📦 Install\r\n```bash\r\nnpm install roleadmin\r\n```\r\n\r\n## 🚀 Usage\r\n```js\r\nconst express = require('express');\r\nconst { initAuth } = require('roleadmin');\r\n\r\nconst app = express();\r\napp.use('/api/auth', initAuth());\r\n\r\napp.listen(5000, () => {\r\n  console.log('Auth server running on http://localhost:5000');\r\n});\r\n```\r\n\r\n## ⚙ Endpoints\r\n- `POST /api/auth/register`\r\n- `POST /api/auth/login`\r\n- `GET  /api/auth/user` (protected)\r\n- `GET  /api/auth/admin` (admin only)\r\n\r\n## 🔒 Environment Variables\r\n```env\r\nMONGO_URI=mongodb://localhost:27017/roleauth\r\nJWT_SECRET=your_secret\r\nJWT_EXPIRATION=1d\r\nDEFAULT_ROLES=user,moderator,admin\r\n```\r\n\r\n## 📝 Notes\r\n- Make sure MongoDB is running and accessible at the URI you provide.\r\n- The middleware auto-registers\r\n","readmeFilename":"README.md"}