Dev Microservices Architecture Plan =================================== Create a microservices architecture plan for [application name]. Application details: - Current state: [monolith/partial microservices/greenfield] - Domain: [ecommerce/fintech/healthcare/SaaS] - Team size: [number] - Scale requirement: [users/requests] - Tech stack preference: [languages/cloud] MICROSERVICES ARCHITECTURE PLAN 1. SERVICE DECOMPOSITION DOMAIN-DRIVEN DESIGN APPROACH Identify bounded contexts: - Context 1: [User Management] Service: user-service Owns: [user data/auth/profiles] Team: [team name] - Context 2: [Order Processing] Service: order-service Owns: [orders/cart/checkout] Team: [team name] [Continue for each service] 2. SERVICE COMMUNICATION SYNCHRONOUS (REST/gRPC) Use when: [real-time response needed] - REST: [external APIs/simple CRUD] - gRPC: [internal service-to-service/performance critical] ASYNCHRONOUS (Message Queue) Use when: [eventual consistency acceptable] - Tool: [Kafka/RabbitMQ/SQS] - Events: [OrderPlaced/UserCreated/PaymentProcessed] - Pattern: [event sourcing/pub-sub/saga] 3. DATA MANAGEMENT - Each service owns its database: [principle] - Database per service: [PostgreSQL/MongoDB by service] - No shared databases between services - Data consistency: [eventual via events] - Distributed transactions: [saga pattern] 4. API GATEWAY - Tool: [Kong/AWS API Gateway/custom] - Responsibilities: * Authentication/authorization * Rate limiting * Request routing * Load balancing * SSL termination * Request/response transformation 5. SERVICE DISCOVERY - Tool: [Kubernetes/Consul/Eureka] - Health checks: [endpoint and frequency] - Load balancing: [strategy] 6. OBSERVABILITY - Logging: [ELK/CloudWatch/Datadog] - Metrics: [Prometheus/Grafana] - Tracing: [Jaeger/Zipkin/AWS X-Ray] - Correlation ID: [propagate through all services] 7. DEPLOYMENT - Containerization: [Docker] - Orchestration: [Kubernetes/ECS] - CI/CD: [per service pipeline] - Blue-green deployment: [zero-downtime] 8. WHEN NOT TO USE MICROSERVICES - Small team (under 5 developers) - Simple domain - Early stage startup - Tight deadline - Start with modular monolith instead Source: https://promptzyo.com/prompt/dev-microservices-architecture-plan