Create a Java API
Create a Java API with Spring Boot, Spring Security, Spring Data JPA, Flyway, Gradle, JUnit 5, and Testcontainers.
Updated 2026-05-21
javaspring-bootspring-securityjpatestcontainers
Use the Java API pack when you want a Spring service with security, persistence, migrations, and tests included from the start.
Generate the Java API starter
Open the Java API pack in the Stack Builder, or run:
bun create better-fullstack@latest my-java-api \
--ecosystem java \
--java-web-framework spring-boot \
--java-build-tool gradle \
--java-orm spring-data-jpa \
--java-auth spring-security \
--java-libraries spring-actuator flyway \
--java-testing-libraries junit5 testcontainersWhat the pack includes
- Spring Boot for the API application.
- Spring Security for protected routes.
- Spring Data JPA for persistence.
- Flyway for database migrations.
- Gradle for builds.
- JUnit 5 and Testcontainers for tests.
First things to customize
- Replace sample entities with your aggregate roots and repositories.
- Configure Spring Security around your real authentication model.
- Add Flyway migrations before relying on generated schema behavior.
- Keep Testcontainers close to the API contract tests.
When this is the right pack
Choose this for enterprise APIs, team-owned backend services, secure admin systems, and projects where the Java/Spring ecosystem is the expected production foundation.
For the stack-level walkthrough, read Secure Spring Boot API.