https://github.com/limon00001/mern-auth
Live link
https://github.com/limon00001/mern-auth
authentication expressjs mongodb nodesjs reactjs
Last synced: 2 months ago
JSON representation
Live link
- Host: GitHub
- URL: https://github.com/limon00001/mern-auth
- Owner: Limon00001
- Created: 2025-01-16T17:51:56.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-26T17:06:43.000Z (over 1 year ago)
- Last Synced: 2025-12-27T19:25:10.030Z (6 months ago)
- Topics: authentication, expressjs, mongodb, nodesjs, reactjs
- Language: JavaScript
- Homepage: https://mern-auth-client-cv0j.onrender.com/
- Size: 1.13 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
      
     
# MERN Authentication System
## 📸 Project Screenshot

### 🔗 [Live Link](https://mern-auth-client-cv0j.onrender.com/)
## 📈 System Overview
A full-stack authentication system built with the MERN stack (MongoDB, Express.js, React.js, Node.js) featuring email verification and password reset functionality.
## 🚀 Features
- 🪪 User Registration & Login
- ✉️ Email Verification System
- 🔑 Password Reset Functionality
- 🔒 Protected Routes
- 🛡️ JWT Authentication
- 🎨 Modern UI with Tailwind CSS
- 🚀 Responsive Design
- 🍪 Cookie-based Authentication
- 🔔 Toast Notification
- ⚡ Fast and Lightweight
## 🛠️ Technologies Used
- **Frontend:**
- React.js with Vite
- Tailwind CSS
- Axios
- React Router DOM
- React Toastify
- **Backend:**
- Node.js
- Express.js
- MongoDB with Mongoose
- JWT for authentication
- Nodemailer for email services
- bcrypt for password hashing
## > API Endpoints
- **Auth Routes:**
- POST `/api/auth/register` - Register a new user
- POST `/api/auth/login` - Login user
- POST `/api/auth/logout` - Logout user
- POST `/api/auth/verify-account` - Verify email account
- POST `/api/auth/send-verify-otp` - Send verification OTP
- POST `/api/auth/send-reset-otp` - Send password reset OTP
- POST `/api/auth/reset-password` - Reset password
- GET `/api/auth/is-auth` - Authenticate user
- **User Routes:**
- GET `/api/users/get-user` - Get user profile
## 🧩 Project Structure
```
mern-auth/
├── client/ # Frontend React application
│ ├── src/
│ │ ├── assets/ # Static assets
│ │ ├── components/ # Reusable components
│ │ ├── context/ # Context providers
│ │ └── pages/ # Page components
│ └── ...
└── server/ # Backend Node.js/Express application
├── config/ # Configuration files
├── controllers/ # Request handlers
├── middleware/ # Custom middleware
├── models/ # Database models
├── routes/ # API routes
└── ...
```
## Prerequisites
- Node.js (v14 or higher)
- MongoDB
- npm or yarn
## Installation
1. **Clone the repository:**
```bash
git clone https://github.com/Limon00001/mern-auth.git
cd mern-auth
```
2. **Set up the backend:**
```bash
cd server
npm install
```
Create a `.env` file in the server directory:
```env
PORT=
MONGODB_URI=
JWT_SECRET=
SMTP_HOST=
SMTP_PORT=
SMTP_USER=
SMTP_PASS=
```
3. **Set up the frontend:**
```bash
cd ../client
npm install
```
Create a `.env` file in the client directory:
```env
VITE_BACKEND_URI=
```
4. **Run the application:**
In the server directory:
```bash
npm run dev
```
In the client directory:
```bash
npm run dev
```
## 👨💻 Author
[![LinkedIn][github-shield]][github-url]
[![LinkedIn][linkedin-shield]][linkedin-url]
[github-shield]: https://img.shields.io/badge/-GitHub-black.svg?style=flat-square&logo=github&color=555&logoColor=white
[github-url]: https://github.com/Limon00001
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=flat-square&logo=linkedin&colorB=555
[linkedin-url]: https://www.linkedin.com/in/monayem-hossain-limon/