A robust application with user authentication, role-based access control, and secure API endpoints using jwt for authentication, and bcrypt for secure password storage.
Collect basic details (email, phone number, name, profile image, password) during the signup process. Ensure at least one of the phone numbers or email is provided during signup. Implement encryption for passwords using bycrpt library.
Allow users to log in using email/phone and password.
Using JSON web token to generate a unique token for the user
Users can view their details using userId
Users can only modify their own name and profile image. Phone number and email, once entered, cannot be changed.
Users can delete their accounts.
There are two roles defined Admin and User.
Admins can view, modify, and delete all user details.
Users can only view, modify, and delete their details.
To create admin accounts.
Implemented an authentication system using JSON Web Tokens (JWT).
Used bcrypt to securely encrypt user passwords.
Saves the profile images in the local system.
Used Express.js for API development.
Used MongoDB for the database.
-
Clone the repository:
git clone https://github.com/Ritish134/User-Management.git
-
Install dependencies:
cd your-project npm install -
Set up environment variables:
Create a .env file and add the configuration variablesMONGO_URI,JWT_SECRET -
Run the application:
node index