🚀 This is our third blog in the series of Low Level Design. Today we are going to design and see the sample code of our Product Service for an E-commerce company.
For the people who don't know, we are running an Open Source Project named NoMise (An E-Commerce customizable store) which is started for the people (Beginner friendly) to jump into the world of Open-Source.
So, here is how we designed our Product Service.
📌 For any E-Commerce app, one thing that they are most focused on are Products. So, we'll see How to design a Product Service which is capable of:-
- Create, Update a Product
- Get Products by Offer, Festival Sale etc
- Giving products to the frontend based on various strategies
- Acquiring a lock to make sure if two admins are working on the same product then a lock will ensure only one atomic operation
So, to achieve these functionalities we should start from the Product itself.
📌 Now, to manage the Products we have Product Manager and to get API requests we have ProductResource which will request ProductService Component to do all the things. ProductService will consume ProductRepository class which will have only one function to perform and that is to do CRUD to Database (We are using AWS RDS Database here in our project)
📌 Now, to get Products on the frontend we can have different strategies like Get Product by 25% Off, Get Product by festival sale etc. We are using Strategy pattern here.
So, our complete design of the service is:-
For a clear picture, click here
To code this service, you can use any Programming language. We are using Java alongwith SpringBoot so that in future we can scale our application easily.
Code can be found here in this repo. Feel free to contribute.
Note: To contribute in NoMise's Frontend, Follow this Repo