Shopping Cart example architecture

This tutorial shows how to build the functionality for a Shopping Cart system. When complete, end users will be able to add items to a cart and checkout, creating an order. As shown in the following illustration, the system includes three services that use Akka gRPC and Kafka as transport mechanisms: Cart, Order, and Analytics.

Example overview

Each user’s cart is represented by a Cart Entity. Cart state is persisted using Event Sourcing: When a user updates their cart, the Entity persists events in an Event Journal database. Using Command Query Responsibility Segregation (CQRS), which separates read and write responsibility, Akka Projections new tab provide the data necessary for the Order and Analytics services.

The PopularityProjection uses the events from all shopping carts to store a representation in the database to answer queries of how popular the items are.

Follow the steps in the tutorial to build functionality a bit at a time and try running it as you go.