微服务每服务独立数据库架构
Architecture
每服务独立数据库架构图,每个微服务拥有其专用数据存储,通过 Kafka 进行事件驱动同步以实现跨服务数据一致性。该模板展示了微服务数据隔离的核心原则,展示 PostgreSQL 和 MongoDB 如何在多语言持久化策略中共存。对于在保持最终一致性的同时强制服务自治的架构师至关重要。
Architecture
微服务 API 网关架构图,展示请求路由、JWT 身份验证、速率限制、服务发现以及跨分布式后端服务的响应聚合。该模板模拟微服务生态系统中所有客户端流量的入口点,在请求到达内部服务之前执行安全策略。适合设计具有集中式横切关注点的可扩展 API 基础设施的平台工程师。
Client { # Client Application
n1: circle label:"Incoming Request"
n2: rectangle label:"Load Balancer"
n3: rectangle label:"Receive API Response"
n4: circle label:"End"
n1.handle(right) -> n2.handle(left)
n2.handle(bottom) -> Gateway.n5.handle(top) [label="Route Request"]
n3.handle(right) -> n4.handle(left)
}
Gateway { # API Gateway
n5: rectangle label:"Authenticate JWT Token"
n6: diamond label:"Token Valid?"
n7: rectangle label:"Apply Rate Limiting"
n8: rectangle label:"Return 401 Unauthorized"
n9: diamond label:"Rate Limit OK?"
n10: rectangle label:"Route to Microservice"
n11: rectangle label:"Return 429 Throttled"
n12: rectangle label:"Aggregate Responses"
n5.handle(right) -> n6.handle(left)
n6.handle(right) -> n7.handle(left) [label="Yes"]
n6.handle(bottom) -> n8.handle(top) [label="No"]
n7.handle(right) -> n9.handle(left)
n8.handle(top) -> Client.n3.handle(bottom) [label="401"]
n9.handle(right) -> n10.handle(left) [label="Yes"]
n9.handle(bottom) -> n11.handle(top) [label="No"]
n10.handle(bottom) -> Services.n13.handle(top) [label="Forward"]
n11.handle(top) -> Client.n3.handle(bottom) [label="429"]
n12.handle(top) -> Client.n3.handle(bottom) [label="Response"]
}
Services { # Microservices Cluster
n13: rectangle label:"Service Discovery Lookup"
n14: rectangle label:"User Service"
n15: rectangle label:"Order Service"
n16: rectangle label:"Inventory Service"
n17: rectangle label:"Compose Response"
n13.handle(right) -> n14.handle(left) [label="Users"]
n13.handle(bottom) -> n15.handle(top) [label="Orders"]
n14.handle(right) -> n17.handle(left)
n15.handle(right) -> n16.handle(left) [label="Check Stock"]
n16.handle(right) -> n17.handle(left)
n17.handle(top) -> Gateway.n12.handle(bottom) [label="Aggregated"]
}
Without a centralized API gateway, every microservice must independently handle authentication, rate limiting, and request routing—leading to duplicated logic, inconsistent security policies, and operational complexity. An API gateway provides a single entry point that enforces cross-cutting concerns before requests reach backend services, reducing attack surface and simplifying client integration.
Building authentication and rate limiting into each service leads to inconsistency and maintenance burden. Commercial API gateways like Kong or Apigee cost $10K-100K+/year. This FlowZap template helps teams visualize their gateway architecture before implementation.
| Template Name | 微服务 API 网关架构 |
| Category | Architecture |
| Steps | 6 workflow steps |
| Format | FlowZap Code (.fz file) |
Architecture
每服务独立数据库架构图,每个微服务拥有其专用数据存储,通过 Kafka 进行事件驱动同步以实现跨服务数据一致性。该模板展示了微服务数据隔离的核心原则,展示 PostgreSQL 和 MongoDB 如何在多语言持久化策略中共存。对于在保持最终一致性的同时强制服务自治的架构师至关重要。
Architecture
Backend-for-Frontend 架构图,为 Web 和移动客户端提供独立的 BFF 层,每层针对其特定平台优化 API 响应,同时共享通用后端微服务。该模板展示如何通过按客户端类型定制数据聚合和负载优化来避免一刀切的 API。推荐给从共享微服务后端服务多个前端平台的团队。
Architecture
无服务器 API 后端架构图,展示 API 网关、Lambda 授权函数、业务逻辑函数以及包括 DynamoDB、S3、SQS 和 SNS 在内的托管云服务,实现完全托管、自动扩展的后端。该模板模拟无服务器优先方法,完全消除基础设施管理,按调用付费并自动缩放至零。对于构建经济高效的事件驱动 API 后端的初创公司和团队至关重要。
Architecture
Saga 编排架构图,中央编排器协调跨订单、库存和支付服务的多步骤分布式事务,具有专用的补偿链用于失败时的回滚。该模板模拟基于编排的 Saga 模式,单个协调器管理事务生命周期并在任何步骤失败时触发补偿操作。对于实施不使用两阶段提交的可靠分布式事务的架构师至关重要。