This project is a cloud native microservice that provides RESTful APIs to manage the registration of users, authentication and password management using JWT tokens. It provides APIs to create the user account, confirm the registration of the user account via email, change the user's account password, authenticate the user (e.g., during sign in), and display the user account information.
For AI-GENERATED CONTENT, please refer to DISCLAIMER
The project is using two branches:
- main: which is used as the Trunk-Based Development (TBD) with tagging for new releases.
- release: which contains the most recently released code. That is, every time a release is made, this branch is updated.
The CI/CD build pipeline is using the GitHub Workflow Actions. The built artifact package is deployed to the following GitHub Package:
- Java 25 - Programming language
- Spring Boot 4.x - Application framework
- Gradle 9.1.x - Build tool
- MariaDB 11.8.x - Production database
- H2 Database - Development/testing database
- Spring Security - Authentication and authorization
- Spring Data JPA - Database access layer
- Lombok - Boilerplate code reduction
- OpenAPI 3.1 - API documentation specification
- Swagger UI - Interactive API documentation
- JUnit 5 - Unit testing framework
- Mockito - Mocking framework for tests
- JWT - Token-based authentication
com.rubensgomes.userms/
├── controller/ # REST controllers
├── service/ # Business logic
├── repository/ # Data access layer
├── model/ # Entity classes
├── dto/ # Data transfer objects
└── security/ # Security configuration
| Field | Type | Description |
|---|---|---|
| VARCHAR(100) | User email address | |
| password | VARCHAR(255) | Encrypted password |
| created_at | TIMESTAMP | User creation timestamp |
| password_changed_at | TIMESTAMP | Last password change timestamp |
- Java 25
- Gradle 9.1.x
- MariaDB 11.8.x (for production)
- H2 Database (included for development)
- Clone the repository
- Start the application with H2 database:
./gradlew bootRun --args='--spring.profiles.active=dev' - Access H2 Console: http://localhost:8080/h2-console
- JDBC URL:
jdbc:h2:mem:userms - Username:
sa - Password: (leave empty)
- JDBC URL:
- Clone the repository
- Install and configure MariaDB 11.8.x
- Configure database connection in
application.yml - Run database migrations
- Start the application:
./gradlew bootRun
# application.yml
spring:
datasource:
url: jdbc:mariadb://localhost:3306/userms
username: ${DB_USER:userms}
password: ${DB_PASSWORD:password}
jwt:
secret: ${JWT_SECRET:your-secret-key}
expiration: ${JWT_EXPIRATION:86400000}Comprehensive API documentation is available in API.md.
- Swagger UI: http://localhost:8080/swagger-ui.html
- OpenAPI JSON: http://localhost:8080/v3/api-docs
- OpenAPI YAML: http://localhost:8080/v3/api-docs.yaml
# Display Java version installed
./gradlew -q javaToolchains# Lint and unit tests
./gradlew check -i# Build the project
./gradlew build# Only Rubens can release
./gradlew release -i# Run application with H2 database (development)
./gradlew bootRun --args='--spring.profiles.active=dev'# Run application with MariaDB (production)
./gradlew bootRunps aux | grep java | grep user-ms # Find the process ID kill # Replace with actual process ID
docker-compose up -d- Passwords are encrypted using bcrypt
- JWT tokens for stateless authentication
- CORS configuration for cross-origin requests
- Input validation and sanitization
- Follow Java coding standards
- Write unit tests for new features
- Update API documentation
- Ensure all tests pass before submitting
Apache License 2.0