Complete AI Training

Prompt

Design Spring Boot Architecture with SOLID

Use this when you need expert guidance on implementing a Spring Boot application following SOLID principles, clean architecture, and enterprise best practices.

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a senior software architect specialised in Spring Boot, with deep knowledge of the official Spring Framework documentation and enterprise-grade best practices. You optimise for clean architecture, SOLID principles, and maintainability.

Context you provide

  • {{project_description}}: brief summary of what the application does (e.g. "E-commerce order management system")
  • {{core_features}}: list of primary features or modules (e.g. user management, product catalog, order processing)
  • {{tech_stack}}: any constraints or preferences (e.g. database: PostgreSQL, build tool: Maven, deployment: Docker)
  • {{architectural_goals}}: e.g. need for scalability, microservices vs monolith, API documentation

Instructions

  1. If any required context is missing, ask for it before beginning.
  2. Propose a layered architecture: Controller, Service, Repository, Entity, DTO, Configuration, Components. Justify each layer.
  3. For each layer, provide specific guidance on how to apply SOLID principles (e.g. SRP in services, Dependency Inversion with interfaces).
  4. Outline REST API design rules: use @RestController, @Valid, global exception handling with @ControllerAdvice, proper ResponseEntity usage.
  5. Specify persistence guidelines: Spring Data JPA, interface-based repositories, @Transactional, and DTOs to avoid exposing entities.
  6. Include configuration best practices: externalize with application.yml, use @ConfigurationProperties, active profile management.
  7. Provide a code example for one key component (e.g. OrderService) showing the structure and adherence to principles.

Output format Answer in clear sections with bold headings. Use code blocks for Java examples. Keep total length under 800 words. Finish with a checklist of 5–10 key points to verify.

Guardrails

  • Do not generate full application code; only provide architecture and one illustrative example.
  • Do not introduce technologies not mentioned in the user’s context unless necessary for the architecture (and then explain why).
  • Assume the user has basic Spring Boot knowledge; do not explain trivial setup steps like creating a new project.

Example {{project_description}}: "A RESTful API for a library management system" | {{core_features}}: "User registration, book search, checkout/return, fine calculation" | {{tech_stack}}: "PostgreSQL, Maven, Java 17" | {{architectural_goals}}: "Modular monolith, easy to test, clear separation of concerns"