AI Context: This is the single source of truth for project overview. For current status: see
docs/status/progress.yamlFor implementation details: seedocs/architecture/overview.md
A production-ready Java Spring Boot boilerplate for building scalable REST APIs with enterprise-grade patterns, comprehensive security, and AI-friendly architecture principles.
Provide a robust, maintainable foundation for Java Spring Boot REST API development that follows best practices, implements proven architectural patterns, and accelerates time-to-market for enterprise applications.
- Backend developers building REST APIs
- Development teams adopting Spring Boot
- Organizations requiring enterprise-grade API infrastructure
- Developers learning Spring Boot best practices
- Setup: See
docs/guides/getting-started.mdfor environment setup - Status: Check
docs/status/progress.yamlfor current progress - Getting Started: Review
docs/guides/getting-started.mdfor quick start guide - Standards: Follow
standards/coding.mdfor development guidelines
- Runtime: Java 21 LTS
- Framework: Spring Boot 3.x
- Build Tool: Maven
- Database: PostgreSQL (default), configurable for MySQL/H2
- ORM: Spring Data JPA with Hibernate
- Authentication: Spring Security with JWT
- API Documentation: Springdoc OpenAPI (Swagger)
- Caching: Redis (distributed), Caffeine (local)
- Messaging: Apache Kafka, RabbitMQ
- Testing: JUnit 5, Mockito, Spring Boot Test
- Deployment: Docker, Kubernetes
- Monitoring: Spring Boot Actuator, Micrometer
backend-java-spring-boot/
├── .ai/ # AI-specific configuration
│ ├── context.yaml # Master context file
│ ├── mcp-config.json # MCP server configuration
│ └── agent-instructions.md # AI behavior guidelines
├── docs/ # Project documentation
│ ├── index.md # This file - single entry point
│ ├── status/ # Current state only
│ │ ├── progress.yaml # Machine-readable status
│ │ └── priorities.md # Current priorities only
│ ├── architecture/ # Technical implementation (planned)
│ │ ├── overview.md # System architecture (planned)
│ │ ├── database.md # Data model (planned)
│ │ ├── api.md # API specifications (planned)
│ │ └── security.md # Security architecture (planned)
│ ├── guides/ # How-to documentation
│ │ ├── getting-started.md # Getting started guide
│ │ ├── setup.md # Environment setup (planned)
│ │ └── deployment.md # Deployment processes (planned)
│ ├── templates/ # Documentation templates
│ ├── session-management/ # AI session management
│ └── _working/ # Temporary work files
├── standards/ # Immutable standards
│ ├── coding.md # Code conventions
│ ├── patterns.md # Architectural patterns
│ ├── business-rules.md # Domain logic
│ └── documentation.md # Documentation standards
├── rules/ # Spring Boot specific rules
│ ├── java-spring-boot-rules.md
│ └── questions.md
└── src/ # Application source code
├── main/
│ ├── java/
│ │ └── com/company/project/
│ │ ├── config/
│ │ ├── controller/
│ │ ├── service/
│ │ ├── repository/
│ │ ├── model/
│ │ ├── exception/
│ │ ├── security/
│ │ └── util/
│ └── resources/
│ ├── application.yml
│ ├── application-dev.yml
│ ├── application-prod.yml
│ └── db/migration/
└── test/
└── java/
- Phase: Boilerplate Setup
- Completion: 20%
- Last Updated: 2025-10-08
- Next Priority: Core project structure and example implementations
- ✅ Documentation architecture established
- ✅ Standards and patterns defined
- ✅ AI-friendly structure implemented
- 🔄 Core Maven project setup
- 🔄 Example controller/service/repository implementations
- 🔄 Security configuration with JWT
- Layered Architecture: Clean separation with Controller/Service/Repository/Model layers
- RESTful API: Complete REST API implementation with best practices
- Security: Spring Security with JWT authentication and role-based authorization
- Data Persistence: Spring Data JPA with PostgreSQL, migration support with Flyway
- API Documentation: Interactive Swagger UI with Springdoc OpenAPI
- Validation: Bean Validation with custom validators
- Exception Handling: Global exception handling with @ControllerAdvice
- Logging: SLF4J with Logback, structured logging patterns
- Caching: Multi-level caching with Redis and Caffeine
- Async Processing: @Async support with custom thread pools
- Message Queuing: Kafka and RabbitMQ integration patterns
- Scheduled Tasks: @Scheduled tasks with configuration
- File Upload/Download: File handling with validation
- Email Service: Async email sending with templates
- WebSockets: Real-time communication patterns
- Event-Driven: Spring Events for decoupled communication
- Testing: Comprehensive test patterns (unit, integration, e2e)
- Monitoring: Spring Boot Actuator with custom metrics
- Docker Support: Docker and Docker Compose configurations
- Database Migrations: Flyway for version-controlled schema changes
- Environment Profiles: Dev, staging, production configurations
- Code Quality: Checkstyle, SpotBugs, PMD configurations
- Single Source of Truth: Each piece of information exists in exactly one location
- AI-First Design: Structure optimized for AI agent consumption
- Progressive Disclosure: Information layers from high-level to implementation details
- Machine-Readable Data: Status and progress in structured formats
- SOLID Principles: Clean architecture with high cohesion, low coupling
- Layered Architecture: Clear separation of concerns
-
Layered Architecture Pattern
- Rationale: Clear separation of concerns, maintainability, testability
- Layers: Controller → Service → Repository → Model
- Benefits: Easy to understand, test, and modify
-
DTO Pattern for API Contracts
- Rationale: Decouple internal entities from API contracts
- Implementation: Separate request/response DTOs with MapStruct
- Benefits: API versioning, security, flexibility
-
JWT for Authentication
- Rationale: Stateless authentication for scalability
- Implementation: Spring Security with JWT tokens
- Benefits: Scalable, mobile-friendly, microservices-ready
-
PostgreSQL as Primary Database
- Rationale: Enterprise-grade features, excellent Spring Boot support
- Implementation: Spring Data JPA with Hibernate
- Benefits: ACID compliance, JSON support, extensibility
- Java 21 LTS: Latest long-term support with modern features (records, pattern matching, text blocks)
- Spring Boot 3.x: Latest stable version with improved performance and native compilation support
- Maven: Industry-standard build tool with excellent Spring Boot integration
- Springdoc OpenAPI: Modern, actively maintained OpenAPI/Swagger implementation
- JUnit 5: Modern testing framework with improved features
- Docker: Containerization for consistent deployment
# Clone repository
git clone [repository-url]
# Navigate to project
cd backend-java-spring-boot
# Install dependencies
mvn clean install
# Run application
mvn spring-boot:run
# Access API documentation
# http://localhost:8080/swagger-ui.html- Code Style: Follow
standards/coding.md - Architecture: Follow
standards/patterns.md - Testing: Maintain 80%+ test coverage
- Documentation: Update docs with code changes
- Code Review: All changes require review
mvn spring-boot:run # Run application
mvn clean install # Build project
mvn test # Run tests
mvn verify # Run tests with coverage
mvn javadoc:javadoc # Generate JavaDoc
mvn checkstyle:check # Check code style
mvn package # Build JAR fileThis project uses Model Context Protocol (MCP) for enhanced AI development assistance:
- Documentation Server: Access to all project documentation
- Standards Server: Access to coding standards and patterns
- Rules Server: Access to Java/Spring Boot specific rules
- Master Context:
.ai/context.yaml- Project metadata and status - Agent Instructions:
.ai/agent-instructions.md- AI behavior guidelines - MCP Configuration:
.ai/mcp-config.json- Server setup - Rules:
rules/java-spring-boot-rules.md- Framework-specific rules
- Single Source of Truth: No duplicate information across files
- Machine-Readable Status: YAML-based progress tracking
- Context Injection: AI instructions embedded in relevant sections
- Progressive Disclosure: Information organized by detail level
- Layered Architecture: Clear structure for AI understanding
- Response Time: < 200ms for 95th percentile
- Throughput: 1000+ requests/second
- Database Connection Pool: 20 connections
- JVM Heap: 512MB-2GB (configurable)
- Test Coverage: 80%+ code coverage
- Code Quality: A-grade SonarQube rating
- Security: OWASP Top 10 compliance
- API Documentation: 100% endpoint coverage
- JWT Tokens: Stateless authentication with configurable expiration
- Role-Based Access: ADMIN, CLIENT, AGENCY roles
- Password Security: BCrypt hashing with salt
- Session Management: Stateless with JWT
- Input Validation: Bean Validation on all endpoints
- SQL Injection Prevention: Parameterized queries with JPA
- XSS Prevention: Output encoding
- CORS: Configurable cross-origin policies
- OWASP Top 10: Protection against common vulnerabilities
- GDPR: Data privacy and user rights support
- Audit Logging: Complete audit trail
- Development: H2 in-memory database, debug logging
- Staging: PostgreSQL, info logging, similar to production
- Production: PostgreSQL, optimized settings, error logging
- Docker: Containerized application
- Kubernetes: Orchestration with deployment manifests
- CI/CD: GitHub Actions / Jenkins pipeline
- Blue-Green: Zero-downtime deployments
- Hosting: Cloud-agnostic (AWS, Azure, GCP)
- Database: Managed PostgreSQL (RDS, Cloud SQL, etc.)
- Caching: Managed Redis (ElastiCache, etc.)
- Messaging: Managed Kafka/RabbitMQ
- Metrics: Micrometer with Prometheus
- Health Checks: Spring Boot Actuator endpoints
- Logging: Structured logging with correlation IDs
- Tracing: Distributed tracing with Sleuth/Zipkin
- JVM Metrics: Memory, CPU, garbage collection
- Database Metrics: Connection pool, query performance
- API Metrics: Request count, response times, error rates
- Critical: System down, database unreachable
- High: Error rate > 5%, response time > 1s
- Medium: CPU > 80%, memory > 80%
- Building REST APIs for web/mobile applications
- Microservices architecture
- Enterprise backend systems
- SaaS platform backends
- Developer Productivity: Reduce API development time by 50%
- Code Quality: Maintain 80%+ test coverage
- Performance: < 200ms average response time
- Reliability: 99.9% uptime
- Current Status - Machine-readable project status
- Getting Started Guide - Quick start instructions
- Coding Standards - Development guidelines
- Business Rules - Domain logic
- Architectural Patterns - Design patterns
- System Architecture - Technical architecture details (planned)
- API Documentation - API specifications (planned)
- Database Schema - Data model details (planned)
- Security Architecture - Security implementation (planned)
- Setup Guide - Environment setup instructions (planned)
- Deployment Guide - Deployment instructions (planned)
- Start with this file for project overview
- Check status files for current progress
- Refer to
docs/guides/getting-started.mdfor implementation details - Follow coding standards for development
- Check rules files for Java/Spring Boot specifics
- Check
docs/status/progress.yamlfor current status - Refer to
standards/coding.mdfor code generation - Use
rules/java-spring-boot-rules.mdfor framework specifics - Use context injection patterns for consistency
- Review this overview for project understanding
- Check status files for progress updates
- Refer to architecture docs for technical decisions
- Contact development team for specific questions
- Fork Repository: Create your own copy
- Create Branch: Use feature branch naming (
feature/user-authentication) - Follow Standards: Adhere to coding standards
- Write Tests: Maintain test coverage (80%+)
- Update Documentation: Keep docs current
- Submit PR: Request code review
- Code follows standards/coding.md
- Tests added/updated with 80%+ coverage
- JavaDoc updated for public APIs
- OpenAPI annotations complete
- No security vulnerabilities
- Performance impact considered
- Documentation updated
This documentation follows AI-friendly architecture principles with single source of truth, machine-readable data, and context injection patterns for optimal AI development assistance.
Last Updated: 2025-10-08