DEV Community

Marko
Marko

Posted on

Spring CRUD Generator (v1.0.0): Generate Spring Boot CRUD, Flyway, tests & more from YAML/JSON

I just open-sourced Spring CRUD Generator (v1.0.0) — a Maven plugin that generates a production-ready Spring Boot backend from a single YAML/JSON spec.

The goal: less boilerplate, consistent structure, and faster iteration.

What it can generate (depending on configuration)

  • CRUD stack: entities, repositories, services, mappers, REST controllers
  • Flyway migrations (incremental change detection via state files)
  • OpenAPI specs + optional resource generation
  • Dockerfile + docker-compose
  • Unit tests + test data generation (Instancio/Podam)
  • Caching (Redis/Caffeine)
  • GraphQL

Maven coordinates

dev.markozivkovic:spring-crud-generator:1.0.0

GitHub: https://github.com/mzivkovicdev/spring-crud-generator

Tiny spec example

configuration:
  database: postgresql
  migrationScripts: true
  errorResponse: MINIMAL
  openApi:
    apiSpec: true
    generateResources: true
  docker:
    dockerfile: true
    dockerCompose: true
  tests:
    unit: true
    dataGenerator: instancio

entities:
  - name: Product
    storageName: product_table
    audit:
      enabled: true
      type: LocalDate
    fields:
      - name: id
        type: Long
        id:
          strategy: IDENTITY
      - name: name
        type: String
      - name: tags
        type: List<String>
Enter fullscreen mode Exit fullscreen mode

Quick start

Add a Maven profile and run the generator goal (see README for the full setup and configuration reference).

mvn clean install -Pgenerate-resources -DskipTests
Enter fullscreen mode Exit fullscreen mode

Feedback

I'd love to hear your feedback, if you have ideas for additional features or improvements, that is highly appreciated!

Top comments (0)