Quickstart Guide
This guide will help you set up the User Management System API locally and make your first authenticated requests. You’ll be up and running in less than 10 minutes.Prerequisites
Before you begin, ensure you have:- Java 17 or higher installed
- Maven 3.6+ for dependency management
- Git to clone the repository
- A REST client like cURL, Postman, or HTTPie
For production deployment, you’ll also need MySQL 8.0+. For development, the system uses an in-memory H2 database with no setup required.
Installation
Configure the environment profile
The system supports two profiles:
dev (H2 database) and prod (MySQL). For quickstart, use the development profile.Open src/main/resources/application.properties and verify the active profile:The
dev profile uses an in-memory H2 database that’s automatically created on startup with pre-loaded test users.Development Profile (H2)
No configuration needed! The development profile (application-dev.properties) comes pre-configured:Production Profile (MySQL)
For production deployment, setspring.profiles.active=prod and configure MySQL in application-prod.properties:Start the application
Run the application using Maven:You should see output indicating the application has started:The API is now running at
http://localhost:8080Make Your First API Call
Now that the API is running, let’s create a user account and authenticate.1. Register a New User
Create a new user account by sending a POST request to/auth/signup:
CreateUserDTO.java:10):
username: 3-20 characters, requiredemail: Valid email format, requiredpassword: 8-16 characters, must contain at least one number, one lowercase letter, and one uppercase letter
The password is automatically hashed using BCrypt before storage (configured in
SecurityConfig.java:38).2. Login and Get JWT Token
Authenticate with your credentials to receive a JWT token:Save the
token value - you’ll need it to authenticate subsequent requests to protected endpoints.3. Access Protected Endpoints
Use the JWT token to access protected resources. Include it in theAuthorization header:
cURL
Pre-loaded Test Users
In development mode, the system comes with two pre-loaded users (defined indata.sql):
| Username | Password | Role | |
|---|---|---|---|
admin-user | [email protected] | Admin1234 | ROLE_ADMIN |
normal-user | [email protected] | NorUs1234 | ROLE_USER |
Common Validation Errors
The API validates all inputs. Here are common errors you might encounter: Invalid Email Format:Next Steps
Now that you have the API running, explore these resources:API Reference
Explore all endpoints, request schemas, and response formats
Authentication Guide
Deep dive into JWT authentication and authorization
Configuration
Learn about environment variables, database setup, and security config
Error Handling
Understand error responses and how to handle them
Need Help?
If you encounter issues:- Check that Java 17+ is installed:
java -version - Verify Maven is available:
mvn -version - Ensure port 8080 is not in use
- Review application logs for detailed error messages
- For production MySQL setup, verify database connectivity and credentials