Skip to content

sammy429b/UserAuthSys

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 

Repository files navigation

User Authentication System

The User Authentication System was built to provide a secure and scalable way to manage user access and authentication in web applications. In modern web development, protecting user data and ensuring secure login processes are crucial. This project aims to demonstrate a robust authentication mechanism using best practices.

Built with :

MongoDB Express.js React Node.js JWT TypeScript Redis Nodemailer Shadcn

Get Started

  1. Clone the Repository

    git clone https://github.com/sammy429b/UserAuthSys.git
    cd UserAuthSys
  2. Install Dependencies

    Frontend

    cd Client
    npm install

    Backend

    cd ../Server
    npm install
  3. Set Up Environment Variables

    Create .env files in both the client and server directories with the necessary environment variables. Refer .env.example files for required variables.

  4. Start the Application

    Backend

    cd Server
    npm run dev

    Frontend

    cd ../Client
    npm run dev

How I Did It?

Key Steps

  1. Project Setup:
    • Initialized the frontend with React.js and TypeScript.
    • Set up the backend with Node.js, Express.js, and TypeScript.
  2. Database Design:
    • Used MongoDB for storing user data.
    • Utilized Redis for managing OTPs.
  3. Authentication Service:
    • Implemented JWT for secure token-based authentication.
    • Created routes for user registration, login, OTP verification, and password management.
    • Used bcrypt for secure password hashing.
  4. Email Notifications:
    • Integrated Nodemailer for sending automated email notifications for password resets.
  5. API Integration:
    • Connected frontend to backend using Axios for API calls.
    • Managed authentication state in React using the context API.
  6. Responsive UI Design:
    • Developed a responsive UI with React.js and Shadcn.

Future Enhancements

  1. Role-Based Access Control (RBAC):
    • Implement different user roles (e.g., admin, user) with specific permissions.
  2. OAuth Integration:
    • Add support for third-party authentication providers like Google, Facebook, and GitHub.
  3. Rate Limiting:
    • Implement rate limiting to protect against brute-force attacks.
  4. Enhanced Security:
    • Add features like account lockout after multiple failed login attempts and email verification.
  5. Scalability Improvements:
    • Optimize the system for better performance under high load conditions, including horizontal scaling strategies.