Spring-boot-box

Spring Boot Box

A modular Spring Boot project designed to explore, implement, and master various functionalities and database integrations. Each module is self-contained and focuses on a specific feature, built with Test-Driven Development (TDD) at its core. This project serves as a learning and demonstration platform for best practices in Spring Boot development.


Project Structure

spring-boot-box/
├── settings.gradle.kts          # Gradle settings for module management
├── Makefile                     # Build, test, and run commands using Makefile
├── gradlew                      # Gradle wrapper script
├── gradlew.bat                  # Gradle wrapper for Windows
├── build.gradle.kts             # Root Gradle configuration
├── README.md                    # Project documentation
├── app-db-h2-connection/            # Module for H2 database integration
├── app-db-postgres-connection/      # Module for PostgreSQL integration
├── app-db-mysql-connection/         # Module for MySQL integration
├── app-db-mongo-connection/         # Module for MongoDB integration
├── app-spring-security-basic        # Module for Spring security (RBAC)
├── app-reactive-webflux-basic       # Module for Spring Reactive webflux basic
├── app-(future modules...)          # Additional modules for extended functionalities

Purpose and Philosophy

Key Goals:

  1. Modular Design:
    • Each module is independent and focuses on a specific feature or database.
    • Enables easy experimentation and integration of new ideas.
  2. TDD-Driven Development:
    • Writing tests first to drive the implementation.
    • Ensures reliable, maintainable, and bug-free code.
  3. Learning-Focused:
    • A sandbox for learning Spring Boot features, database integrations, and advanced concepts.

Makefile Integration

This project uses a Makefile to simplify build, test, run, and other operations. The Makefile provides a consistent interface for managing project tasks across different environments. For Windows users, you can install make using Chocolatey by running the following command:

choco install make

Current Modules

1. app-db-h2-connection

2. app-db-postgres-connection

3. app-db-mysql-connection

4. app-db-mongodb-connection

5. app-spring-security-basic

6. app-reactive-webflux-basic


Future Plans

Planned Modules:

  1. Spring Security Integration 2.0:
    • Implement basic authentication and authorization.
    • Secure endpoints using Spring Security features.
  2. Reactive Programming with WebFlux 2.0:
    • Add R2DBC for reactive database operations with other databases and with increase level complexity.
  3. Advanced Functionalities:
    • Explore Spring Cloud for microservices.
    • Build inter-service communication and monitoring.

Testing Enhancements:


Getting Started

Prerequisites

Using the Makefile

  1. Build and Test All Modules:
     make all
    
  2. Build Modules:
     make
    
  3. Clean All Build Files:
     make clean
    
  4. Run the Root Spring Boot Application: (by default it runs h2 application)
     make run
    
  5. Run the Specific Application: (e.g. h2 application)
     make run-h2
    
  6. Build and Test a Specific Module:
     make run-module
    
  7. Testing Run all tests for the module:
     make test
    
  8. Help
     make help
    

OpenAPI Integration

The project leverages OpenAPI to provide interactive API documentation. This makes it easy to explore and test the REST APIs for each module.

How to Access OpenAPI Documentation:

  1. Start the Spring Boot application.
  2. Navigate to the following URL in your browser
         http://localhost:8080/swagger-ui/index.html
    
    • Replace 8080 with the appropriate port if a different one is configured.
  3. Explore the API endpoints, input parameters, and responses in an interactive interface.

Note: In Case of Reactive WebFlux projects navigate to below URL:

    http://localhost:8080/swagger-ui.html

Contributions

Contributions are welcome! Feel free to fork the repository, create a new module, or enhance the existing ones.

Author

Vishwajeet Kotkar

Connect on LinkedIn or explore my other projects on GitHub.