User-Authentication-System

πŸ” User Authentication System

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.


✨ Features


πŸ“‚ Folder Structure

User-Authentication-System/ │── routes/ β”‚ β”œβ”€β”€ auth.js β”‚ β”œβ”€β”€ middleware/ β”‚ └── models/ β”‚ │── server.js │── package.json │── package-lock.json │── .gitignore │── example.env


πŸ›  Tech Stack


βš™οΈ Installation & Setup

1️⃣ Clone the Repository

```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