A framework for static decomposition of modular monolithic applications into microservice deployments.
- Overview
- Prerequisites
- Quick Install and Build
- Generate Services
- Start Generated Services
- Test Endpoints
- Common Problems and Fixes
- Git Tag Commands
- Frontend Integration
- Contributing
- License
FractalX analyzes a monolith and generates modular microservice projects. This repository contains the plugin and an example app fractalx-test-app that demonstrates generation and local service execution.
- Java 17+ on
PATH - Maven 3.8+
- Git
- Optional: MySQL if you want to run MySQL-specific SQL scripts instead of H2
Build framework modules:
cd fractalx-parent
mvn clean install -DskipTestsGenerate services from example app:
cd fractalx-test-app
mvn com.fractalx:fractalx-maven-plugin:0.2.0-SNAPSHOT:decomposeOr, after configuring settings.xml and a plugin alias:
mvn fractalx:decomposeAfter running the plugin, generated services appear under:
cd fractalx-test-app/target/generated-services
ls -laExpected output:
order-service/
payment-service/
Start each service in its own terminal.
Payment service:
cd fractalx-test-app/target/generated-services/payment-service
mvn clean spring-boot:runOrder service:
cd fractalx-test-app/target/generated-services/order-service
mvn clean spring-boot:runFor Spring Boot debug output:
mvn spring-boot:run -Dspring-boot.run.arguments="--debug"Example curl requests:
Payment health:
curl http://localhost:8082/api/payments/healthOrder health:
curl http://localhost:8081/api/orders/healthProcess payment:
curl -X POST http://localhost:8082/api/payments/process \
-H "Content-Type: application/json" \
-d '{"customerId":"CUST001","amount":100.50}'Create order (calls payment service):
curl -X POST http://localhost:8081/api/orders \
-H "Content-Type: application/json" \
-d '{"customerId":"CUST001","amount":100.50}'Application fails at startup with an error referencing SET FOREIGN_KEY_CHECKS = 0 and an H2 syntax error.
Generated schema.sql contains MySQL-specific statements that H2 does not support.
Choose one of the following.
Edit src/main/resources/application.properties or application.yml in the generated service:
spring.datasource.url=jdbc:mysql://localhost:3306/yourdb
spring.datasource.username=youruser
spring.datasource.password=yourpass
spring.datasource.driver-class-name=com.mysql.cj.jdbc.DriverEnsure the MySQL server and database exist before starting the service.
- Rename MySQL scripts to
schema-mysql.sql - Provide
schema-h2.sqlif needed - Set the platform:
spring.sql.init.platform=mysqlRemove or guard MySQL-only statements such as SET FOREIGN_KEY_CHECKS from schema.sql.
Not recommended for production.
Ignore unsupported statements:
spring.sql.init.continue-on-error=trueDisable automatic SQL initialization:
spring.sql.init.enabled=false- Re-run Maven with
-eor-Xfor full stack traces - Start with
--debugto see Spring Boot condition evaluation output
Create an annotated tag:
git tag -a v1.0.0 -m "release v1.0.0"Push a single tag:
git push origin v1.0.0Push all tags:
git push --tagsDelete a remote tag:
git push --delete origin v1.0.0Delete a local tag:
git tag -d v1.0.0A React or Next.js frontend should be a separate project that calls the generated services' REST APIs.
Scaffold frontend:
npx create-react-app frontendOr:
npx create-next-app frontendConfigure API base URLs using environment variables, for example:
REACT_APP_API_BASE=http://localhost:8081
Implement UI pages that call:
POST /api/ordersPOST /api/payments/process
Enable cross-origin access in generated services.
Example Java configuration:
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/api/**")
.allowedOrigins("http://localhost:3000")
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS");
}
}- Fork the repository
- Create a branch for your change
- Run
mvn clean install -DskipTests - Open a pull request with a clear description
This project is licensed under the APACHE LICENSE 2.0. See the LICENSE file for details.
