Loading repository dataβ¦
Loading repository dataβ¦
ososuna / repository
π A production-ready Spring Boot 3.5.6 template with JWT authentication using Spring Security 6+. Built with Clean Architecture. MySQL database integration, and comprehensive security configuration. This template provides a solid foundation for building secure REST APIs with user authentication and authorization.
A production-ready Spring Boot 3.5.6 template with JWT authentication using Spring Security 6+. Built with Clean Architecture. MySQL database integration, and comprehensive security configuration. This template provides a solid foundation for building secure REST APIs with user authentication and authorization.
# Clone the repository
git clone https://github.com/ososuna/spring-security-template.git
cd spring-security-template
chmod +x up-dev.sh
./up-dev.sh
# Start MySQL database only
docker-compose up -d db
# Run the Spring Boot application
mvn spring-boot:run
application.yml with your database credentialsmvn clean install
mvn spring-boot:run
| Method | Endpoint | Description | Authentication |
|---|---|---|---|
POST | /api/v1/auth/register | Register a new user | No |
POST | /api/v1/auth/login | Login user | No |
| Method | Endpoint | Description | Authentication |
|---|---|---|---|
GET | /api/v1/user | Get current user profile | Yes (JWT) |
| Method | Endpoint | Description | Authentication |
|---|---|---|---|
GET | /api/v1/swagger-ui | Swagger UI | No |
curl -X POST http://localhost:8080/api/v1/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "securePassword123"
}'
curl -X POST http://localhost:8080/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "securePassword123"
}'
curl -X GET http://localhost:8080/api/v1/user \
-H "Authorization: Bearer <your-jwt-token>"
The application supports environment-based configuration:
| Variable | Description | Default Value |
|---|---|---|
DATASOURCE_URL | Database connection URL | jdbc:mysql://localhost:3306/template |
DATASOURCE_USERNAME | Database username | template |
DATASOURCE_PASSWORD | Database password | 123456 |
JWT_SECRET | JWT signing secret key | replace_with_a_very_long_random_secret_key_1234567890 |
JWT_EXPIRATION | Token expiration time (ms) | 3600000 (1 hour) |
APP_PORT | Application port | 8080 |
DDL_AUTO | Hibernate DDL mode | update |
./up-test.sh
# Run all tests
mvn test
# Run integration tests only
mvn test -Dtest="**/*IT"
# Run with coverage
mvn test jacoco:report
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)This project is open source and available under the MIT License.
Perfect for: Microservices, REST APIs, Authentication services, Spring Boot learning, Production applications
Keywords: spring-boot spring-security jwt mysql rest-api authentication docker java maven template
Made with β€οΈ by Oswaldo Osuna, for developers. Star β this repository if you find it helpful!