A production-style Spring Boot REST API built as part of a
30 Days Backend Development Challenge, focusing on real-world backend concepts.
- Java 17
- Spring Boot
- Spring Security
- JWT (JSON Web Token)
- Spring Data JPA
- MySQL
- Hibernate
- Maven
- JWT-based authentication
- Login & token generation
- Custom
UserDetailsService JwtFilterfor request validation- Secure password storage using BCrypt
- Role-based access control:
- ADMIN
- USER
- API-level restrictions using roles
- Users can update only their own data
- Admin has full access
- Create user
- Update user
- Get user by ID
- Get all users (Admin only)
- Bulk user creation
- Secure email-based authentication
- Pagination (
page,size) - Sorting (
sortBy,sortDir) - Keyword-based search:
- Search by name
- Search by email
- Database indexes added on:
emailname
- Optimized queries for faster search & pagination
- Centralized exception handling
- Custom exceptions
- Proper HTTP status codes
- Clean error responses
src/main/java/com/backend/demo │ ├── controller ├── service ├── repository ├── security ├── filter ├── mapper ├── entity ├── exception └── dto
-
User logs in with email & password
-
Server generates JWT token
-
Token sent in header: Authorization: Bearer
-
JwtFilter validates token
-
Access granted based on role
GET /users?page=0&size=5&sortBy=id&sortDir=asc&keyword=san
CREATE INDEX idx_user_email ON users(email);
CREATE INDEX idx_user_name ON users(name);
🧪 Testing
Tested using Postman
JWT & role-based access verified
Unauthorized access handled properly
📈 Status
✅ Completed till Day 29
🚧 Day 30: Final polish & interview prep
👤 Author
Sanketh Reddy
Backend Developer | Java | Spring Boot
Learning in public 🚀