Java Archetypes Overview
Enterprise-grade Java archetypes built on Spring Boot with comprehensive tooling and best practices
The Java ecosystem in P6M Archetypes provides production-ready templates for building robust, scalable microservices and enterprise applications using Spring Boot and modern Java patterns.
Available Archetypes
Microservices & API Services
Spring Boot gRPC Service
Production-ready gRPC microservice with Hibernate, Liquibase, comprehensive testing, and observability.
GraphQL Domain Gateway
Enterprise GraphQL federation gateway for coordinating domain services with advanced routing and composition.
REST Domain Gateway
REST API gateway with advanced routing, circuit breakers, and resilience patterns for enterprise environments.
gRPC Assessor (Drools)
Business rules engine with Drools integration for complex decision services and business logic evaluation.
Libraries & Shared Components
Platform Libraries
Comprehensive multi-module library project for shared utilities, enterprise patterns, and reusable components.
Persistence Model
Shared data models, repositories, and persistence patterns for cross-service data consistency.
Project Attributes
Common Java project configuration, naming conventions, and structural patterns for consistency.
Technology Stack
Core Technologies
Framework Stack
- Spring Boot 3.x
- Spring Data JPA
- Spring Security
- Spring Cloud Gateway
- Maven 3.8+
Communication
- gRPC with Protocol Buffers
- GraphQL with Federation
- REST APIs with OpenAPI
- Message queues (Kafka, RabbitMQ)
Persistence & Data
- Hibernate ORM
- Liquibase migrations
- CockroachDB, PostgreSQL
- Connection pooling
- JPA auditing
Production Features
Observability & Monitoring
- Spring Boot Actuator endpoints
- Micrometer metrics with Prometheus
- OpenTelemetry distributed tracing
- Structured logging with Logback
Testing & Quality
- JUnit 5 with Spring Boot Test
- TestContainers for integration testing
- Mockito for unit testing
- k6 load testing scripts
DevOps & Deployment
- Docker multi-stage builds
- Kubernetes manifests and Helm charts
- GitLab CI/CD pipelines
- Tilt for local Kubernetes development
Quick Start
Generate a Java Service
# Generate a gRPC microservice
archetect render git@github.com:p6m-archetypes/java-spring-boot-grpc-service.archetype.git my-service
# Generate a GraphQL gateway
archetect render git@github.com:p6m-archetypes/java-spring-boot-graphql-domain-gateway.archetype.git my-gateway
# Generate platform libraries
archetect render git@github.com:p6m-archetypes/java-platform-libs.archetype.git platform-libs
Development Workflow
cd my-service
# Build with Maven
mvn clean install
# Run locally
mvn spring-boot:run -pl my-service-server
# Run integration tests
mvn test -pl my-service-integration-tests
# Start with Tilt for Kubernetes
tilt up
Best Practices
Architecture Guidelines
Service Design
- Hexagonal architecture with clear boundaries
- Domain-driven design principles
- Event sourcing and CQRS patterns
- Microservice coordination strategies
Code Quality
- Test-driven development practices
- Comprehensive integration testing
- Code coverage and quality gates
- Static analysis with SonarQube
Performance & Scalability
- Stateless service design for horizontal scaling
- Connection pooling and resource management
- Caching strategies with Redis/Hazelcast
- Circuit breakers and resilience patterns
- Load balancing and service mesh integration
These Java archetypes provide a comprehensive foundation for building enterprise-grade microservices and applications with modern Spring Boot patterns, production-ready features, and scalable architecture designs.