Long, long ago, way back in 2025, QuantaSneaks 900π was launched. At that time, the architect decided to use an event-driven system for the shopping functionality.
In this blog post, we will understand how event-driven systems can be used to create an e-commerce application and implement it with the help of AWS CDK.
Requirements for QuantaSneaks e-commerce.
Payments are processed with Stripe. Once a payment starts, the product is reserved, so if only one item is left, others canβt pay for it at the same time, similar to a movie booking site. Also, order data is recorded for analytics purposes.
After successful payment at Stripeβs end, the order moves to the shipping service. A notification is sent to the user, and analytics are recorded.
And all of this should be done in an event-driven way using AWS EventBridge for choreography.
Choreography π vs Orchestration πΌ
In the choreography way of doing things, services (these days, AI agents) act based on what other services are doing. It's analogous to how a dance is choreographed, where the action or reaction of one entity depends on another.
In AWS, we use EventBridge to as a medium of communication (using events) for choreography.
In orchestration, there is a single entity that is controlling the workflow. It calls other entities or services, and those services return their responses to the central coordinator, which manages the workflow. It's analogous to an orchestra where one person orchestrates the workflow of the orchestra.
Quantasneaks 900 Event-Driven Architecture

When an order is placed, the createOrder lambda function is triggered and creates a unique orderId. This orderId is stored in DynamoDB and will act as a common thread (unique token or identifier) for subsequent events. Also, an event with type OrderCreated (with id and necessary details) is posted to EventBridge.
orderId is returned to the frontend and used to poll DynamoDB to get the status of the order. For now, status can be either reserving inventory or initiating payment.
On the AWS side, the OrderCreated event is fanned out to the inventory service, payment processor service, and analytics service. The inventory service blocks the item in inventory. The payment processor service creates a Stripe session URL and stores it in DynamoDB for that particular orderId.
While polling, when the frontend finds the URL, it redirects to that Stripe payment page, and the user completes the payment.
Now Stripe can either post payment information to a webhook (lambda) or to the partner Eventbrite bridge for Stripe. Either way, a PaymentSucceeded event is created in EventBridge and fanned out to the notification service, shipping service, and the analytics service.
Letβs Buildπ
I have created infrastructure as code using AWS CDK, which means you can play with the project in minutes.
First of all, clone the repository from here: https://github.com/TrickSumo/Serverless-Introduction/tree/main/eventdriven
Then create a Stripe account (a dev account will do the work) and get the Stripe key and Stripe webhook key. Then export it in the terminal:
export STRIPE_SECRET_KEY=sk_test_...
export STRIPE_WEBHOOK_SECRET=whsec_...
After that, just run CDK and deploy. As simple as that!
npm install
npx cdk bootstrap # one-time per account/region
npx cdk deploy
Use the Stripe CLI to register the webhook URL that you got after successful deployment:
stripe listen --forward-to <WebhookUrl>
stripe trigger checkout.session.completed
To test, subscribe to SNS topic:
aws sns subscribe --topic-arn <NotificationTopicArn> --protocol email --notification-endpoint you@example.com
# then confirm the email
Time to testπ
# Create an order (prices are in cents)
curl -X POST "<ApiUrl>orders" \
-H "content-type: application/json" \
-d '{"currency":"usd","customerEmail":"you@example.com","items":[{"name":"T-Shirt","price":2500,"qty":2}]}'
# β { "orderId": "...", "status": "CREATED" }
# Poll until checkoutUrl appears, then open it to pay
curl "<ApiUrl>orders/<orderId>"
Conclusion
In this post, we walked through the requirements for the QuantaSneaks e-commerce app and discussed why an event-driven approach with EventBridge fits the choreography style.
Do try the AWS CDK, and if you like, feel free to contribute the frontend for the project. Would love the collaboration π
Curious how to build an event-driven e-commerce application using orchestration? Check out Building Human-in-the-Loop E-Commerce Workflows with AWS Durable Lambda Functions
Thanks, and Enjoy Building!


Top comments (0)