| name | software-architecture-microservices |
| description | Implements strategies for designing, developing, and deploying microservices architecture. Offers guidance on best practices, patterns, and anti-patterns for microservices. |
| license | MIT |
| compatibility | opencode |
| metadata | {"version":"1.0.0","domain":"coding","triggers":"microservices, service-oriented architecture, microservices design, microservices patterns","archetypes":["tactical","generation"],"anti_triggers":["brainstorming","vague ideation","code golf","over-engineering"],"response_profile":{"verbosity":"low","directive_strength":"high","abstraction_level":"operational"},"role":"implementation","scope":"implementation","output-format":"code","related-skills":"software-architecture-monolith, software-architecture-event-driven, software-architecture-hexagonal"} |
Microservices Architecture
archetypes: tactical, educational
anti_triggers: monolithic solutions
response_profile:
verbosity: medium
directive_strength: high
abstraction_level: tactical
Implements strategies for designing, developing, and deploying microservices architecture. Offers guidance on best practices, patterns, and anti-patterns for microservices.
When to Use
- When you need to build a system that can scale independently.
- When teams need to deploy code at different rates.
- For systems requiring resilience and flexibility.
Core Workflow
- Define Service Boundaries – Identify domain-driven boundaries for services.
- Choose Communication Protocol – Decide between REST, gRPC, etc.
- Implement Service Discovery – Use tools like Consul or Eureka.
Implementation Patterns
Enhanced Examples
-
Defining Service Boundaries: Use DDD concepts to clearly delineate service responsibilities:
class Account:
def __init__(self, id, owner):
self.id = id
self.owner = owner
class AccountService:
def create_account(self, id, owner):
account = Account(id, owner)
return account
-
Service Discovery Integration Using service discovery tools like Consul or Eureka is essential for dynamic service management:
service:
name: account-service
port: 8080
-
Event-Driven Messaging:
Utilizing messaging for loose coupling between services:
package main
import (
"fmt"
"github.com/streadway/amqp"
)
func publishMessage(message string) {
conn, err := amqp.Dial("amqp://guest:guest@localhost:5672/")
defer conn.Close()
}
These enhancements provide practical examples representing various aspects of microservices architecture, thus increasing both the content quality and file size.
Pattern 1: Managing State
class OrderService:
def __init__(self):
self.orders = []
def add_order(self, order):
self.orders.append(order)
Constraints
MUST DO
- Maintain a CI/CD pipeline for each service.
- Monitor performance of each service using tools like Prometheus.
MUST NOT DO
- Create tightly coupled services.
- Use synchronous communication for everything, leading to bottlenecks.
Live References
Authoritative documentation links for this domain. The model follows markdown links at load time to resolve external references and inline content.