A secure and modular authentication system built using Node.js, Express, JWT, and bcrypt.
It provides secure user registration, login, password hashing, token-based authentication, and protected routes.
User-Authentication-System/ βββ routes/ β βββ auth.js β βββ middleware/ β βββ models/ β βββ server.js βββ package.json βββ package-lock.json βββ .gitignore βββ example.env
```bash git clone https://github.com/YOUR_USERNAME/User-Authentication-System.git
2οΈβ£ Install Dependencies npm install
3οΈβ£ Create .env JWT_SECRET=your_secret_key MONGO_URI=your_mongodb_url
4οΈβ£ Start Server node server.js
Server will run at: π http://localhost:5000
π‘ API Endpoints β€ Register User POST /register
{ βnameβ: βSumairaβ, βemailβ: βsumaira@example.comβ, βpasswordβ: β123456β }
β€ Login User POST /login
β€ Protected Route GET /protected-route
Accessible only with valid JWT token.
π Security Notes
.env file is never uploaded
Passwords are encrypted using bcrypt
JWT ensures secure, stateless authentication
π License
This project is proprietary & protected. Unauthorized copying, distribution, or modification is strictly prohibited. Β© 2025 Sumaira