A modern, secure, and full-stack authentication system built using the MERN-inspired stack with React, Node.js, Express.js, Prisma ORM, PostgreSQL, JWT Authentication, and Resend Email API.
This project demonstrates a production-ready authentication workflow including User Registration, Login, Email Verification, Forgot Password, Password Reset, Protected Routes, User Profile Management, and JWT-based Authentication.
- User Registration
- User Login
- Secure Logout
- JWT Authentication
- Protected Routes
- Public Routes
- Persistent Login using Context API
- Authentication Middleware
- Email Verification using Resend API
- Secure Verification Token
- 24-hour Token Expiry
- Verification Link Validation
- Prevent Login Until Email Verification
- Automatic Token Removal After Verification
- Forgot Password
- Secure Password Reset Link
- 1-hour Expiry Token
- Password Reset Page
- Confirm Password Validation
- Secure Password Hashing using bcrypt
- Get Current User
- Update User Profile
- Duplicate Email Validation
- JWT Protected APIs
- Modern Responsive UI
- Professional Authentication Pages
- React Context API
- React Router DOM
- Axios API Integration
- Responsive Dashboard
- Clean Form Validation
- Loading States
- Password Hashing (bcryptjs)
- JWT Authentication
- Protected Backend Routes
- Authentication Middleware
- Email Verification
- Reset Token Expiry
- Token Cleanup After Use
- Secure API Validation
- React.js
- Vite
- React Router DOM
- Context API
- Axios
- CSS3
- Node.js
- Express.js
- Prisma ORM
- PostgreSQL
- JWT
- bcryptjs
- Crypto
- Resend API
SecureAuthentication
β
βββ client
β βββ src
β β βββ assets
β β βββ components
β β βββ context
β β βββ hooks
β β βββ layouts
β β βββ pages
β β βββ routes
β β βββ services
β β βββ styles
β β βββ utils
β β βββ App.jsx
β β βββ main.jsx
β βββ package.json
β
βββ server
β βββ prisma
β βββ src
β β βββ config
β β βββ controllers
β β βββ middleware
β β βββ routes
β β βββ services
β β βββ utils
β β βββ lib
β β βββ server.js
β βββ package.json
β
βββ README.md
git clone https://github.com/tarun0001g/SecureAuthentication.git
cd SecureAuthenticationcd server
npm installCreate .env
PORT=5000
DATABASE_URL=your_postgresql_database_url
JWT_SECRET=your_jwt_secret
RESEND_API_KEY=your_resend_api_key
SENDER_EMAIL=your_verified_sender_emailRun Prisma Migration
npx prisma migrate dev
npx prisma generateStart Backend
npm run devcd client
npm install
npm run devFrontend
http://localhost:5173
Backend
http://localhost:5000
User Register
β
βΌ
Verification Email Sent
β
βΌ
Verify Email
β
βΌ
Login
β
βΌ
JWT Generated
β
βΌ
Dashboard
β
βΌ
Protected Routes
Forgot Password
β
βΌ
Generate Reset Token
β
βΌ
Send Email
β
βΌ
Reset Password Link
β
βΌ
Create New Password
β
βΌ
Login Again
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/register |
Register User |
| POST | /api/auth/login |
Login User |
| GET | /api/auth/verify-email/:token |
Verify Email |
| POST | /api/auth/forgot-password |
Forgot Password |
| POST | /api/auth/reset-password/:token |
Reset Password |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/user/profile |
Get Current User |
| PATCH | /api/user/profile |
Update Profile |
This project helped me gain hands-on experience with:
- Full Stack Development
- React Context API
- JWT Authentication
- Protected Routes
- REST APIs
- Prisma ORM
- PostgreSQL
- Password Hashing
- Email Verification
- Password Reset Flow
- Authentication Middleware
- API Integration using Axios
- Production-Level Authentication Flow
- Profile Picture Upload
- Change Password
- Refresh Token Authentication
- Google OAuth Login
- GitHub OAuth Login
- Two-Factor Authentication (2FA)
- Role-Based Authentication
- Admin Dashboard
- Account Settings
- Session Management
Tarun Makavana
B.E. Information Technology
Shantilal Shah Engineering College, Bhavnagar
GitHub: https://github.com/tarun0001g
LinkedIn: https://www.linkedin.com/in/tarun-makavana-52601427a/
If you found this project helpful, consider giving it a β on GitHub.
It motivates me to build more open-source projects.
This project is created for educational and learning purposes.





