github.com/SinghCoder/ShoppingCart-Cloud ↗
Assignment done as part of course Cloud Computing. Implemented a distributed shopping cart system with leaderless replication
Open this visualization on its own page →
Contributors
3
Lines of Code
10,647
From
2020-11-26
To
2020-12-05
About SinghCoder/ShoppingCart-Cloud
This project implements a distributed shopping cart system built entirely in Python as part of a cloud computing course. It demonstrates key distributed systems concepts including leaderless replication, data partitioning, and eventual consistency. The system consists of database nodes that store shopping cart and product data using TinyDB, a gateway API layer that coordinates requests, and Zookeeper for managing node registration and discovery.
The architecture uses the CRUSH hash function to map products and users to database nodes, with read quorum operations to ensure data consistency across replicas. Version vectors track data versions across nodes, enabling read-repair mechanisms when stale data is detected. The gateway handles all client requests by routing them to the appropriate database nodes based on consistent hashing, then performing read-repair operations to reconcile inconsistencies—for products it takes the minimum quantity across latest versions, while for user carts it takes the maximum quantity per product. Flask provides the REST API endpoints for both the database nodes and the gateway.
The system is containerized using Docker Compose, allowing users to easily scale the number of database nodes. The implementation covers the full lifecycle of distributed data management including product and user creation, cart operations, and consistency guarantees across a leaderless replicated system with eventual consistency semantics.