Click badges for detailed analysis and metrics on SonarCloud
From SQL to Service - Eliminating microservices boilerplate, one API at a time π
MSG transforms a single SQL statement into a complete, production-ready Spring Boot microservice with REST APIs, DTOs, DAOs, and configuration in seconds.
Modern microservices development involves repetitive boilerplate code creation. MSG eliminates this by generating complete Spring Boot microservices directly from SQL statements using a metadata-driven approach.
- SELECT β GET APIs with query parameters
- INSERT β POST APIs with validated request bodies
- UPDATE β PUT APIs with path variables and request bodies
- DELETE β DELETE APIs with query parameters
- Complete Projects β Maven structure, dependencies, and configuration
- Metadata-driven: Uses database metadata, not SQL parsing
- Type-safe: Generates strongly-typed DTOs with validation
- Production-ready: Includes error handling and proper HTTP semantics
- Enterprise standards: Follows Spring Boot and clean code conventions
- Java 21 or later
- Maven 3.8+
- SQL Server database
- Docker (recommended for database setup)
# Linux/Mac
./setup-db.sh
# Windows
setup-db.bat
# Manual
docker-compose up -d --buildThis sets up SQL Server with sample Sakila database (599 customers, 1000 films, 16k+ rentals).
# Clone and compile
git clone <repository-url>
cd MSG
mvn clean compile
# Generate SELECT API
mvn exec:java -Dexec.mainClass="com.jfeatures.msg.codegen.MicroServiceGenerator" \
-Dexec.args="--name Customer --destination ./output --sql-file sample_parameterized_sql.sql"
# Test the generated service
cd ./output
mvn spring-boot:run# Test GET endpoint
curl "http://localhost:8080/api/customer?active=Y&customerId=123"# SELECT API (GET endpoints)
mvn exec:java -Dexec.mainClass="com.jfeatures.msg.codegen.MicroServiceGenerator" \
-Dexec.args="--name Customer --destination ./output --sql-file sample_parameterized_sql.sql"
# INSERT API (POST endpoints)
mvn exec:java -Dexec.mainClass="com.jfeatures.msg.codegen.MicroServiceGenerator" \
-Dexec.args="--name Customer --destination ./output --sql-file sample_insert_parameterized.sql"
# UPDATE API (PUT endpoints)
mvn exec:java -Dexec.mainClass="com.jfeatures.msg.codegen.MicroServiceGenerator" \
-Dexec.args="--name Customer --destination ./output --sql-file sample_update_parameterized.sql"
# DELETE API (DELETE endpoints)
mvn exec:java -Dexec.mainClass="com.jfeatures.msg.codegen.MicroServiceGenerator" \
-Dexec.args="--name Customer --destination ./output --sql-file sample_delete_parameterized.sql"Place SQL files in src/main/resources/ with parameterized queries:
-- sample_parameterized_sql.sql (SELECT)
SELECT c.customer_id, c.first_name, c.last_name
FROM customer c
WHERE c.active = ? AND c.created_date >= ?
-- sample_insert_parameterized.sql (INSERT)
INSERT INTO customer (first_name, last_name, email)
VALUES (?, ?, ?)
-- sample_update_parameterized.sql (UPDATE)
UPDATE customer SET first_name = ?, email = ?
WHERE customer_id = ?
-- sample_delete_parameterized.sql (DELETE)
DELETE FROM customer WHERE customer_id = ? AND active = ?generated-microservice/
βββ pom.xml
βββ src/main/java/com/jfeatures/msg/{domain}/
β βββ Application.java
β βββ controller/{Domain}Controller.java
β βββ dao/{Domain}DAO.java
β βββ dto/{Domain}DTO.java
β βββ config/DatabaseConfig.java
βββ src/main/resources/application.properties
- User Guide - Complete usage instructions and examples
- Developer Guide - Architecture and contribution guide
- Security Guide - Security best practices and known issues
- Troubleshooting - Common issues and solutions
MSG transforms microservices development by:
- 90% Less Boilerplate: Eliminates repetitive CRUD code writing
- Type-Safe APIs: Generates strongly-typed DTOs and controllers
- Production Ready: Includes validation, error handling, and proper HTTP semantics
- Rapid Prototyping: From SQL to running service in minutes
We welcome contributions! Please see our Developer Guide for:
- Development setup and workflow
- Architecture overview and design principles
- Adding new features and SQL statement types
- Code standards and pull request process
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
Created with clean code principles and architectural excellence in mind.
MSG - Building the future of microservices generation π