DEV Community

Cover image for How we designed and coded our Product Service
Lovepreet Singh
Lovepreet Singh

Posted on

How we designed and coded our Product Service

🚀 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.

Low level design meme

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.

📍 Let's start

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.

Product Entity

📌 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)

Product Manager

📌 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.

Product Strategy

So, our complete design of the service is:-

Product Service Design

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

You can follow this board to actively see who is working on which issue. And raise an issue to contribute or Join our Whatsapp group to join the focused community of contributors.

Progress Board

Top comments (0)