A secure and professional-grade backend authentication system built using Spring Boot, Spring Security, and JWT (JSON Web Token). Designed to demonstrate best practices in stateless REST API development with token-based authentication and email verification.
✅ User registration and login with validation
✅ JWT-based stateless authentication
✅ Secure profile access using token
✅ Email verification with OTP
✅ Reset password via OTP
✅ Modular and clean project structure
✅ MySQL integration
✅ CORS enabled for frontend access
#🛠️ Tech Stack
- Java 17
- Spring Boot 3
- Spring Security
- JWT (jjwt)
- MySQL
- Maven
- Postman (for testing)
📦 Project Structure
src/
├── configurations/ # Security and JWT filter configs
├── controller/ # REST Controllers (Auth, Profile)
├── entity/ # User entity
├── repository/ # Spring Data JPA repositories
├── services/ # Business logic
├── userdto/ # DTOs: Login, Register, AuthResponse, etc.
├── jwt/ # JWT token utility classes
└── resources/ # application.properties
POST /api/v1.0/auth/registerPOST /loginGET /is-authenticatedReturns true if user is authenticated using JWT.
GET /api/v1.0/profileHeaders
| Key | Value |
|---|---|
| Authorization | Bearer JWT_TOKEN_HERE |
POST /send-otpHeaders
| Key | Value |
|---|---|
| Authorization | Bearer JWT_TOKEN_HERE |
POST /verify-emailHeaders
| Key | Value |
|---|---|
| Authorization | Bearer JWT_TOKEN_HERE |
Body
{
"otp": "123456"
}POST /send-reset-otp?email=user@example.comPOST /reset-passwordBody
{
"email": "user@example.com",
"otp": "123456",
"newPassword": "newSecurePassword"
}spring.datasource.url=jdbc:mysql://localhost:3306/authx_db
spring.datasource.username=root
spring.datasource.password=yourpassword
jwt.secret=your_jwt_secret
jwt.expiration=86400000- Register →
/auth/register - Login →
/login→ copytoken - Access
/profilewith header:Authorization: Bearer <JWT_TOKEN> - Email Verification →
/send-otp,/verify-email - Forgot Password →
/send-reset-otp,/reset-password
- 🔄 Refresh token endpoint
- 🔓 Logout endpoint (client-side JWT destroy)
- 👮 Admin-specific role-based routes
Rustam – Final Year B.Tech Student
🔗 GitHub: @RustamPoonia
This project is released under the MIT License. Feel free to use and contribute.
🟦🟩🟨🟧🟥🟪 Thanks for checking out AuthX!