In this blog post, you will get a very basic idea of what is microservice and how it plays playing a big role in the development of web applications.
Let’s understand in a very basic way. Earlier, we made a website that had a bunch of code in one place. But if you are using microservice that means your projects get physically divided into smaller sections/units with separate databases as well. In short, instead of creating a simple monolithic application, divide your project.
Pre-requisites to learn Microservice
- You should have minimum knowledge of coding.
- Make sure Docker is installed.
- Make sure NodeJS is installed.
- As I am guiding you through .NET, make sure .NET SDK is installed in your system; if you are using VS 2022, then it is best, but you can use Visual Studio code as well.
- Make sure Postman is installed.
How Microservice works?
In the programming world, when you plan to work with microservice, the first important point to note down is.

- Microservice is an architectural style that can be achieved by Domain Driven Design. Yes, you can write code in your own way, but DDD is the best way.
- Your team is autonomous: All the members indeed work on one BIG project, but when we use microservice, then the team is split in a way like when we have a meeting with, say, for example, the HR Dev team, then there is no need to call the Inventory Dev team in it. Both are working parallel but not that much included.
- Now, this individual small chunk of the project can communicate with each other using HTTP gRPC.
- You can see in the image if Services 1 goes down, then it should not affect Service 2 or 3.
- We mostly talk through a service bus. This lets us send messages without waiting for an answer right away. It’s like saying something and not needing to hear back immediately.
- The microservices are deployed independently.
- As we deploy them independently, it is easy for us to scale up them.
- Each service has its database, so data integrity is now shifted onto the application layer rather than the database layer.
- The services and our front end communicate with each other using Gateway.
- Note:- Microservice believes in duplicating the code, which means a student class can exist in Service 1, Service 2 and Service 3. If the context is different, then keep the class different. Otherwise, what happens at the end, is you have one Big class referred by all of them. (Students in the classroom will study while Students in the fees window pay the amount. Both the Classroom and Payment windows behave differently with the student, so that the good practice to keep the class separate).
- To communicate between two microservices we can use mostly Queue, Web API (Open Host Service).
Create first Microservice | What is Microservice
- To create a microservice, you need to point that which one is your core domain, generic domain, subdomain etc. So before start working on the microservice identify your domain.
- My YouTube video playlist in different languages helps you learn how to start writing code for your first microservice. It’s a starting point for coding.
Create Project
Create a new folder in your specific location where you wish to place your code; inside that, create a new solution file.
dotnet new webapi -o src/ProductAuctionService --use-controllers

Add the project into solution file.
dotnet sln add src/ProductAuctionService

Other blog post: – How to clone git repository: A Simple Guide for Beginners
You tube :- Learn C# Step by Step in ENGLISH