Transform your current application into a more testable, maintainable, and scalable system by applying hexagonal architecture principles. Also known as the **Ports and Adapters** pattern, it separates business logic from infrastructure (databases, UI, APIs).
Legacy monolith refactoring
Clean architecture introduction
Domain-driven design alignment
Preparing for microservice split
Modular structure with isolated business logic
Clearly defined input/output interfaces
Testable code with dependency inversion principles
Architecture ready for evolution and scaling
This is the base template with placeholders. Replace the placeholders with your specific information:
Refactor the following codebase towards a hexagonal (ports and adapters) architecture. Separate business logic from infrastructure (databases, frameworks, APIs), and create clearly defined input/output interfaces. Keep the code testable and modular. {{language_block}} {{framework_block}} {{focus_area_block}} {{additional_details_block}}
{{language}}
Programming language{{framework}}
Current framework{{focus_area}}
Refactor focus area{{additional_details}}
Additional details or constraints (optional) - ex: legacy dependencies, test strategy, naming conventionsHere's an example with filled-in values:
Refactor the following codebase towards a hexagonal (ports and adapters) architecture. Separate business logic from infrastructure (databases, frameworks, APIs), and create clearly defined input/output interfaces. Keep the code testable and modular. The framework used is: FastAPI. Focus on: Business logic only. Additional considerations: avoid changing the database schema for now.
Help others discover this useful prompt by sharing it on social media