User Management System API
A production-ready REST API for user management built with Java 17 and Spring Boot 3. This system provides secure authentication, role-based access control, and comprehensive user administration capabilities.Quickstart
Get up and running in minutes with our step-by-step guide
API Reference
Explore all available endpoints and their schemas
Authentication
Learn how JWT authentication works in this system
Configuration
Configure database, security, and environment settings
Key Features
This API is designed with modern best practices and enterprise-grade security:- Clean REST Architecture - Modular design with clear separation of concerns across controllers, services, repositories, and DTOs
- JWT Authentication - Stateless authentication using JSON Web Tokens with Auth0 library
- Role-Based Access Control - Two-tier authorization with
ROLE_USERandROLE_ADMINroles - Input Validation - Comprehensive field validation using Jakarta Validation annotations
- Dual Database Support - H2 in-memory database for development, MySQL for production
- Security First - BCrypt password encryption, CSRF protection, and stateless session management
- Code Quality - Lombok for reduced boilerplate, JUnit/Mockito tests, and JaCoCo coverage reporting
Technology Stack
Built with industry-standard technologies:| Component | Version | Purpose |
|---|---|---|
| Java | 17 | Core language with modern features |
| Spring Boot | 3.5.4 | Application framework |
| Spring Security | 6.x | Authentication & authorization |
| Spring Data JPA | - | ORM and database persistence |
| Auth0 JWT | 3.18.1 | JWT token generation and validation |
| H2 Database | - | In-memory database for development |
| MySQL | - | Production database |
| Lombok | - | Reduces boilerplate code |
| Maven | - | Dependency management and build |
| JUnit & Mockito | - | Unit and integration testing |
| JaCoCo | 0.8.10 | Code coverage analysis |
Architecture Overview
The system follows a layered architecture pattern:The API uses Spring profiles to manage different environments:
dev for development with H2, and prod for production with MySQL.Authentication Flow
The system implements a stateless JWT-based authentication:- Signup: User registers via
/auth/signupwith username, email, and password - Login: User authenticates via
/auth/loginand receives a JWT token - Authorization: Client includes JWT token in subsequent requests via
Authorizationheader - Access Control: Spring Security validates the token and checks role permissions
All passwords are hashed using BCrypt before storage. The system never stores plain-text passwords.
API Endpoints
The API provides four main endpoints:| Method | Endpoint | Description | Role Required |
|---|---|---|---|
POST | /auth/signup | Register a new user account | Public |
POST | /auth/login | Authenticate and receive JWT token | Public |
GET | /users/me | Get current user information | ROLE_USER |
GET | /admin/users | List all registered users | ROLE_ADMIN |
Next Steps
Quick Start Guide
Follow our quickstart to make your first API call
API Reference
Browse detailed endpoint documentation