The shopping cart
The functionality
The Dometrain API contains functionality for the Shopping Cart. The logic is like any other cart:
- Students can add courses in their cart
- Students can remove courses from their cart
- Students can retrieve their cart
- Students can clear their cart
The main idea is that the cart will be used with the payment gateway integration to create checkout sessions containing the courses in the cart.
Nick will now demonstrate
Upon successful payment, the enrollment endpoints will be used to enroll students on the courses that they purchased.
The problem
We can have X amount of students in the platform and students can have Y amount of courses in their cart. This means that the amount of items in carts can scale exponentially with the amount of courses that the platform has. Even though Postgres is very optimised and all the lookups will happen with primary keys, we still add pressure to a database that doesn't need it.
The plan
We will migrate the cart functionality to Azure Cosmos DB!
Azure Cosmos DB will allow our cart feature to scale infinitely* without having to worry about our main Postgres database.