| Login Screen | Email Verification |
|
|
A modern full-stack authentication and user management platform with secure login, email verification, password reset via OTP, and JWT-based session handling.
Built with Spring Boot, Spring Security, JWT, MySQL, and React (Vite), following clean architecture and real-world authentication best practices.
This project was designed for learning, production-like implementation, and as a reusable authentication foundation for scalable web applications.
- Authify 🔐✨
Authify is a complete authentication system designed for modern web applications.
It provides:
- Secure login with JWT stored in HTTP-only cookies
- Email verification using OTP
- Password reset via OTP email
- User registration with welcome email
- Stateless authentication with Spring Security
- React frontend with protected routes
- Email templates with Thymeleaf
- Secure CORS configuration
The backend follows stateless security architecture, and the frontend communicates through authenticated API requests.
- 🔐 JWT-based authentication
- 🍪 HTTP-only cookie session storage
- 👤 User registration
- 📧 Welcome email on signup
- ✉️ Email verification via OTP
- 🔑 Password reset with OTP
- 🧠 Secure Spring Security configuration
- 🛡️ Custom authentication entry point
- 🌐 CORS configured for frontend integration
- 🧾 Thymeleaf HTML email templates
- ⚡ React frontend with routing
- 🧪 Clean layered backend architecture
Authify uses Spring Security + JWT + HTTP-only cookies.
- Users authenticate via
/login - JWT is generated after successful authentication
- Token is stored in:
- HTTP-only cookie (primary session mechanism)
- Response body (optional usage)
This prevents JavaScript access and improves security against XSS.
- Authenticated users request a verification OTP
- OTP is sent via email
- User submits OTP to verify account
Verification emails are sent using HTML templates rendered with Thymeleaf.
- User requests reset OTP via email
- OTP expires after a limited time
- User submits OTP + new password
- Password is securely updated
- Java 21
- Spring Boot 4
- Spring Security
- JWT (jjwt)
- Spring Data JPA / Hibernate
- MySQL
- Spring Mail
- Thymeleaf (email templates)
- Jakarta Validation
- Lombok
- Maven
- React 19
- Vite
- React Router
- Axios
- React Toastify
- Bootstrap
- Secure authentication with JWT and cookies
- Stateless backend architecture
- Email-based verification and password recovery
- Full-stack integration (Spring Boot + React)
- Production-style authentication flows
- Clean security configuration with custom filters
Example .env:
# database
DB_URL=jdbc:mysql://localhost:3306/authify_app
DB_USER=root
DB_PASSWORD=root
# jwt
JWT_SECRET_KEY=your_super_secret_jwt_key_here_change_this
# frontend
FRONTEND_URL=http://localhost:5173
# mail (smtp)
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USER=your_email@gmail.com
MAIL_PASSWORD=your_email_app_password
MAIL_FROM=your_email@gmail.commvn spring-boot:runBackend runs at:
http://localhost:8080
npm installnpm run devFrontend runs at:
http://localhost:5173
| Method | Endpoint | Description |
|---|---|---|
| POST | /login |
Authenticate and receive JWT cookie |
| GET | /is-authenticated |
Check authentication status |
| POST | /logout |
Clear JWT cookie |
| POST | /send-reset-otp |
Send password reset OTP |
| POST | /reset-password |
Reset password using OTP |
| POST | /send-verify-otp |
Send email verification OTP |
| POST | /verify-otp |
Verify email with OTP |
| Method | Endpoint | Description |
|---|---|---|
| POST | /register |
Register new user |
| GET | /profile |
Get authenticated user profile |
Contributions are welcome!
Feel free to open issues or submit pull requests to improve the project.
For any inquiries or collaboration opportunities, feel free to reach out via:

