mern-auth Tailwind Templates

Mern Auth

This is a secure authentication system built with MERN, TypeScript, and Tailwind CSS featuring email verification, password reset, and JWT authentication.

šŸ” MERN Authentication App with Email Verification

This is a secure authentication system built with MERN, TypeScript, and Tailwind CSS featuring email verification, password reset, and JWT authentication.

āœ… Email verification with Mailtrap šŸ“§
āœ… Secure password validation šŸ”‘
āœ… Zustand for state management ⚔
āœ… Smooth animations with Framer Motion šŸŽ­
āœ… JWT cookie authentication šŸŖ


šŸš€ Features

  • User Registration with Validation:
    • Password must have at least 6 characters, uppercase, lowercase, number, and special character.
  • Email Verification (Mailtrap):
    • A verification code is sent upon registration.
    • Includes an Account Verification Email Template.
    • āš ļø Note: Mailtrap only works for testing purposes and emails can only be received by addresses registered in your Mailtrap account. For production, consider using SendGrid, Mailgun, or AWS SES.
  • Automatic Login After Verification.
  • Dashboard with User Information:
    • Profile details (name, email).
    • Account activity (joined date, last login).
  • Forgot Password Feature:
    • Sends a password reset code via email.
    • Includes a Password Reset Email Template.
  • JWT Authentication with HTTP-only Cookies.
  • Logout Functionality.
  • Modern UI with Tailwind CSS and Framer Motion.

šŸ› ļø Tech Stack

Frontend

  • React (Vite) ⚔
  • TypeScript
  • Tailwind CSS šŸŽØ
  • Zustand (state management)
  • Framer Motion (animations)
  • React Hot Toast (notifications)
  • Fetch API (for API calls)
  • React Router DOM (client-side routing)

Backend

  • Node.js + Express.js
  • MongoDB + Mongoose
  • JWT Authentication
  • Mailtrap (email service)

šŸš€ Installation & Setup

1ļøāƒ£ Clone the Repository

git clone https://github.com/nnerb/mern-auth.git
cd auth-app

2ļøāƒ£ Install Dependencies

Backend

cd server
npm install

Frontend

cd client
npm install

3ļøāƒ£ Set Up Environment Variables

Create a .env file in the backend folder and add:

PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_secret_key
MAILTRAP_API_TOKEN=your_mailtrap_api_token
CLIENT_URL=your_client_url

4ļøāƒ£ Run the Application

Backend

cd server
npm run dev

Frontend

cd client
npm run dev

šŸ”„ Future Improvements

  • āœ… Google & GitHub OAuth login
  • āœ… Two-factor authentication (2FA)
  • āœ… Dark mode toggle

šŸ“ŗ Inspiration

This project was inspired by this YouTube tutorial with modifications and enhancements.


šŸ¤ Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.


šŸ“œ License

This project is licensed under the MIT License.

Top categories

Loading Svelte Themes