shaonu-authkit 1.0.1 โ†’ 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Shaonu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,133 @@
1
+ # ๐Ÿ” shaonu-authkit
2
+
3
+ A CLI tool to instantly scaffold a full **Express + MongoDB** Authentication Service.
4
+
5
+ Just one command and your auth backend is ready!
6
+
7
+ ## ๐Ÿš€ Quick Start
8
+
9
+ ```bash
10
+ npx shaonu-authkit
11
+ ```
12
+
13
+ ## ๐Ÿ“‹ What It Does
14
+
15
+ When you run the command, it will ask you:
16
+
17
+ - ๐Ÿ“ Project name
18
+ - ๐Ÿƒ MongoDB URI
19
+ - ๐Ÿ”‘ JWT Secret
20
+ - ๐Ÿš€ Port number
21
+ - ๐Ÿ“ฆ Package manager (npm / yarn / pnpm)
22
+
23
+ Then it will:
24
+
25
+ - โœ… Create your project folder
26
+ - โœ… Create the full auth service template
27
+ - โœ… Generate `.env` file with your values
28
+ - โœ… Install all dependencies automatically
29
+
30
+ ## ๐Ÿ“ก API Routes
31
+
32
+ | Method | Route | Description | Protected |
33
+ |--------|-------|-------------|-----------|
34
+ | POST | `/api/auth/register` | Register new user | โŒ |
35
+ | POST | `/api/auth/login` | Login user | โŒ |
36
+ | POST | `/api/auth/logout` | Logout user | โœ… |
37
+
38
+ ## ๐Ÿ“‚ Project Structure
39
+
40
+ ```
41
+ your-project/
42
+ โ”œโ”€โ”€ src/
43
+ โ”‚ โ”œโ”€โ”€ config/
44
+ โ”‚ โ”‚ โ””โ”€โ”€ db.js โ†’ MongoDB connection
45
+ โ”‚ โ”œโ”€โ”€ controllers/
46
+ โ”‚ โ”‚ โ””โ”€โ”€ auth.controller.js โ†’ Register, Login, Logout logic
47
+ โ”‚ โ”œโ”€โ”€ models/
48
+ โ”‚ โ”‚ โ””โ”€โ”€ user.model.js โ†’ User schema
49
+ โ”‚ โ”œโ”€โ”€ routes/
50
+ โ”‚ โ””โ”€โ”€ auth.routes.js โ†’ API routes
51
+ โ”‚
52
+ โ”œโ”€โ”€ app.js โ†’ Express app entry point
53
+ โ”œโ”€โ”€ .env โ†’ Your environment variables
54
+ โ””โ”€โ”€ package.json
55
+ ```
56
+
57
+ ## โš™๏ธ Environment Variables
58
+
59
+ After setup, your `.env` file will look like:
60
+
61
+ ```env
62
+ PORT=5000
63
+ MONGO_URI=mongodb://localhost:27017/authkit
64
+ JWT_SECRET=your-secret-key
65
+ JWT_EXPIRE=7d
66
+ NODE_ENV=development
67
+ ```
68
+
69
+ ## ๐Ÿ“ฆ Dependencies Used
70
+
71
+ | Package | Purpose |
72
+ |---------|---------|
73
+ | `express` | Web framework |
74
+ | `mongoose` | MongoDB ODM |
75
+ | `bcryptjs` | Password hashing |
76
+ | `jsonwebtoken` | JWT tokens |
77
+ | `cookie-parser` | Cookie handling |
78
+ | `dotenv` | Environment variables |
79
+ | `nodemon` | Auto restart in dev |
80
+
81
+ ## ๐Ÿงช Test Your API
82
+
83
+ ### Register
84
+ ```bash
85
+ curl -X POST http://localhost:3000/api/auth/register \
86
+ -H "Content-Type: application/json" \
87
+ -d '{"name": "John", "email": "john@example.com", "password": "123456"}'
88
+ ```
89
+
90
+ ### Login
91
+ ```bash
92
+ curl -X POST http://localhost:3000/api/auth/login \
93
+ -H "Content-Type: application/json" \
94
+ -d '{"email": "john@example.com", "password": "123456"}'
95
+ ```
96
+
97
+ ### Logout
98
+ ```bash
99
+ curl -X POST http://localhost:3000/api/auth/logout \
100
+ -H "Authorization: Bearer YOUR_TOKEN_HERE"
101
+ ```
102
+
103
+ ## ๐Ÿ” Security Features
104
+
105
+ - โœ… Passwords hashed with **bcryptjs** (12 salt rounds)
106
+ - โœ… JWT stored in **httpOnly cookie** (XSS protection)
107
+ - โœ… **sameSite: strict** cookie (CSRF protection)
108
+ - โœ… Password never returned in API responses
109
+ - โœ… Token invalidated on logout
110
+
111
+
112
+ ## ๐Ÿ”„ Get Started After Setup
113
+
114
+ ```bash
115
+ cd your-project-name
116
+ npm run dev
117
+ ```
118
+
119
+ Server runs on:
120
+ ```
121
+ http://localhost:3000
122
+ ```
123
+
124
+ ## ๐Ÿ‘จโ€๐Ÿ’ป Author
125
+
126
+ Made with โค๏ธ by **Shaonu**
127
+
128
+ - GitHub: [@shaonu](https://github.com/mrsaxena01)
129
+ - NPM: [shaonu-authkit](https://www.npmjs.com/package/shaonu-authkit)
130
+
131
+ ## ๐Ÿ“„ License
132
+
133
+ MIT License โ€” free to use in any project!
package/bin/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env node
2
-
3
2
  import chalk from 'chalk';
4
3
  import inquirer from 'inquirer';
5
4
  import ora from 'ora';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shaonu-authkit",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "CLI to scaffold a full Express + MongoDB Auth Service",
5
5
  "type": "module",
6
6
  "bin": {
@@ -17,6 +17,7 @@
17
17
  "cli",
18
18
  "scaffold"
19
19
  ],
20
+ "license": "MIT",
20
21
  "dependencies": {
21
22
  "chalk": "^5.3.0",
22
23
  "inquirer": "^9.2.0",