How to build microservices with Docker - Introduction
Gaurav Saini
Posted on June 25, 2023
Hello everyone,
Microservices are very popular these days, and rightly so. They offer a lot of flexibility and freedom to the developers. So, I decided to learn them and share my knowledge with you. I hope you know, in theory, what microservices are. If you're not familiar with the concept, this video is an excellent place to start.
I've decided to break my journey into a series of 3-4 posts, and this is the first part.
I'll add everything to Github, so you can check out the repo here.
Overview
Let's start with a brief summary of the entire project that we'll be building. We'll make a simple e-commerce application and the high level design will look like this:
As you can see, there are 4 main services:
- Products: Used to list and search for products.
- Orders: Used to place new orders. This is protected by the auth server so users can't place orders unless they're logged in.
- Notifications: Used to notify users when a new order is placed.
- Auth: Used to check user authentication before placing orders.
The other components in the architecture are:
- NGINX server: Acts as the API gateway, reverse proxy, and load balancer.
- NATS broker: Nats.io is a messaging platform used to build distributed systems. Here we'll use it to facilitate communication between different services by publishing messages.
I'll dive into each individual component in later parts of this series, but I've tried to keep the services as minimal and simple as possible and put the main focus on the organisation and orchestration part of the entire microservices application.
So, you'll notice that the functionality offered by each service is not very sophisticated, but it gets the idea across.
Tech Stack
- Node.js
- Python
- Docker, docker-compose
- Nginx
This is it for the introduction. The next part onwards we'll get our hands dirty with the code.
I hope you'll enjoy this series and learn something new.
Feel free to post any questions you have in the comments below.
Cheers!
Posted on June 25, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.