Example – offline-first counter

This example demonstrates the essentials for storing and synchronizing data on the client side. I have kept the example simple to focus on the plumbing. The example is implemented as a React application that leverages an AWS Cognito Dataset to store a counter and the square of the counter. The user increments the counter and it is stored locally. When the user presses the synchronize button the counter-updated event is published to the event stream. The consumer of this event calculates a materialized view that is the square of the counter and stores the value on the cloud side for synchronization back to the client. This example can easily be mapped to an e-commerce application, which stores the cart (that ...

Get Cloud Native Development Patterns and Best Practices now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.