Baraza SACCO The Saga Pattern (Distributed Transaction Management)

Step Functions orchestrates ledger updates and M-Pesa payment via API Gateway/Lambda. On failure it runs compensating tr...

32 views
Viewed 32 times
0
Get Started Free

Takes 30 seconds • No credit card required

Baraza SACCO The Saga Pattern (Distributed Transaction Management)

Step Functions orchestrates ledger updates and M-Pesa payment via API Gateway/Lambda. On failure it runs compensating transactions to prevent inconsistent balances.

advanced
AWS

Tags

#serverless
#saga
#payments
#step-functions
#consistency

Architecture Description

This diagram shows how you ensure financial integrity. Instead of a single, risky transaction, the "Orchestrator" (the brain) manages a sequence of steps. If the payment fails at the final gate, the orchestrator triggers a "Compensating Transaction" to reverse the previous steps, ensuring no member's money is lost in "transit." • Key Services: AWS Step Functions (Orchestrator), Lambda (Ledger Service), API Gateway (M-Pesa Integration). • Architectural Value: Prevents data inconsistency in high-concurrency mobile money environments.

Community Reviews(1)

AI Review
Tradeoff

6 days ago

I appreciate the approach you've taken with the Saga Pattern to manage distributed transactions and ensure financial integrity within Baraza SACCO. However, I see a significant concern with your reliance on AWS Step Functions as the orchestrator. While they provide a robust solution for managing workflows, they can introduce latency and complexity, especially when handling high volumes of concurrent requests typical in mobile money environments. If the orchestrator encounters performance bottlenecks or failures, it could lead to delayed compensating transactions, risking money loss during peak times. Additionally, the use of multiple Lambda functions for the ledger and compensating transactions raises concerns about monitoring and debugging. Each function's failure could cascade and complicate the debugging process. Ensure you have comprehensive logging and monitoring in place, particularly for payment failures through the dead-letter queue (DLQ) and alert alerts via SNS. Lastly, consider the implications of idempotency in your design. While it helps prevent duplicate transactions, there should be a clear strategy for handling scenarios where an operation might be retried multiple times, risking inconsistent state. Addressing these issues will enhance the overall robustness of your architecture.

Sign in to share your review on this architecture

Sign in to review
Try it in the Playground

Open an interactive version — fork it, generate AI variants, or share it with your team.

What You'll Get

Editable diagram in your workspace
Interactive cost estimates
AI-powered customization
Save and share your version

Start Customizing

Make this template your own

Get Started Free

Takes 30 seconds • No credit card required

Share

Statistics

Views
32
Clones
0
Likes
0

Creator

Andrew Mwangi

Details

Category
serverless

Estimated monthly cost

$63.48/month

Published
1/28/2026

Services Used

17 cloud services in this architecture

RouteTable
SecurityGroup
APIGateway
Lambda
StepFunctions
DynamoDB
SQS
SNS
SecretsManager
KMS
CloudTrail
GuardDuty
SecurityHub
CloudWatchAlarm
InternetGateway
WAF
NATGateway

Ready to build this?

Clone this architecture into your workspace and deploy it to your cloud account.

Deploy This Architecture
Get Started Free

Takes 30 seconds • No credit card required