
Introduce breaking a monolith into five microservices with Node.js and TypeScript, using Kafka events for inter-service communication, and deploying with Docker while each microservice maintains its own database.
Clone the monolith and prepare microservices by selecting a frontend. Run via docker compose, seed the database, and explore admin and ambassador flows with products and orders.
Configure stripe publishable and secret keys in test mode for frontend and backend, then use mailhog to test email delivery and verify the ambassador earnings.
Explore the codebase as the project moves from monolith to microservices, wiring database and Redis connections, defining admin and ambassador roles, and implementing auth endpoints, products, links, and orders.
Compare monoliths and microservices, illustrating how many functionalities can be split into independent services. Learn how internal api calls and an event bus enable scaling.
Create the microservice (the email microservice) that communicates with mean up via Kafka events and Docker. Remove email functionality from mean up and ensure this microservice has no database.
Set up the email microservice within a monolith-to-microservices migration by creating the email folder, initializing npm, installing TypeScript and types, and configuring core files for the order controller.
Set up Google Cloud and Confluent Cloud Kafka to deploy microservices, create a Europe-based cluster named microservices, define a default topic, and generate API credentials to publish and consume events.
Learn to connect NodeJS microservices to Confluent Cloud using the Confluent Cloud CLI, configure environments and API keys, create topics, and run producer and consumer workflows.
Learn to connect a KafkaJS client to Confluent Cloud, configure SSL and SASL, create a consumer and producer, subscribe to the default topic, and log and publish messages.
Produce Kafka JS messages with a Kafka JS producer: configure, connect, and send the order as a JSON string to the default topic, then test by creating an order.
Develop and test the email microservice by sending emails via a transport using the order, admin revenue, and ambassador revenue values, with Kafka messages and docker compose.
Build the user microservice, operating without kafka and communicating through internal sgp requests. It maintains its own database to support user registration and scope-based authorization.
Initialize the users microservice by scaffolding the project and installing essential packages like express and cookie parser. Configure docker compose for a redis-backed database and seed the user entity.
Import data from the ambassador microservice into the user microservice by creating an old connection, mapping users, and seeding them via docker compose.
Create a register endpoint in a microservice, relay requests to a user service via axios on port 8000, and handle password hashing and ambassador/admin roles.
Outline the login flow in a NodeJS microservice, generate and return a jwt, set a cookie, and validate user scope as admin or ambassador across services.
Send the JWT cookie in request headers to the user microservice, verify the JWT with middleware, and fetch the authenticated user data including revenue for ambassador and admin roles.
Store JWT tokens in a database via a token entity to invalidate sessions; save tokens on login and delete them on logout, with middleware validating tokens.
Update user info and password via put requests to the users interface, sending JWT for /users/info and /users/password. Prepare for testing, error handling, and refactoring into a dedicated user service.
Refactor the user service to consolidate requests via a static async request method, streamline axios calls, and expose get, post, and put wrappers for authenticated communication with the user microservice.
Set up a general users microservice by creating a user controller and a get ambassadors endpoint using Express. Retrieve and filter users to return ambassadors (and admins) efficiently.
Remove user entity across controllers, replacing it with a user id reference, update link handling and add a user service endpoint, enabling the app to work without the user entity.
Configure docker containers to communicate via external networks instead of host ports. Define explicit container names and networks for microservices, such as monolith and users.
Explore how scopes control access between admin and ambassador routes by passing scope through authentication, validating token payload, and enforcing authorization with middleware.
Build the admin microservice, ensuring the admin frontend communicates only with it and no other microservices, and prepare its own database and Kafka integration for the next material.
Set up the admin directory, copy necessary files, and keep only the user microservice. Update Docker Compose, database credentials, and networks, then run Docker Compose up to create tables.
Import data by running seeders and connecting to the old database to seed products, links, and orders, preserving their many-to-many relationships with order items.
Import the admin roads controllers and middleware, remove unused routes, and simplify admin and ambassador paths to streamline the monolith-to-microservices migration.
Configure Kafka in the admin microservice, set brokers and credentials, introduce topics for admin, ambassador, and email, and implement producer and consumer flows for product changes.
Create a TypeScript Kafka consumer, connect to Kafka, subscribe to the ambassador topic, and log message keys, values, and actions (product created or updated).
Develop a dynamic kafka-based subscriber that maps keys 'product created', 'product updated', and 'product deleted' to corresponding methods to update the product repository in response to events.
Create the ambassador and checkout microservices, enabling each to communicate with its own microservice and with the users microservice via Kafka, and explore data synchronization across all microservices.
Set up a microservices project by creating the directory, importing docker files, and trimming dependencies. Configure ambassador service with simplified entities and Redis, resolve port conflicts, then run docker compose.
Import data from the admin microservice to populate the new order and order item entities, rename conflicting fields, and compute the total from order items during seeding.
Move and simplify controllers across microservices, especially ambassador flows, by computing revenue from user orders with reduce and exposing a Redis-backed rankings view.
Configure Kafka in the ambassador microservice by setting environment values, wiring the producer and consumer, and enabling a link created event to be published to the admin topic.
Configure Kafka consumers for the admin and ambassador topics, export the config, and run the consume command to process link created events.
Configure an automatic docker service by adding a second consumer with a different command (npm start) to run the Kafka consumer in the background while serving endpoints.
Create a kafka error entity to store key, value, and the error, save it via a repository in a try-catch, then restart docker compose and clear the Redis cache.
Set up the final microservice by updating the project structure, removing unused components, configuring docker compose, kafka integration, and database for checkout, and seeding products before starting the services.
Move controllers and routes to the new microservice layer, configure Kafka producers and Redis values, and route events to email, admin, and ambassador topics, ahead of the next Kafka tutorial.
Configure Kafka by importing the old code, setting environment variables, creating the checkout topic, and wiring a checkout producer and consumer in Docker Compose to publish events.
explains producing to multiple kafka topics at once by batching messages for order completed, sending to admin, ambassador, and email topics to ensure consistency across microservices.
Test the frontend with all microservices—admin, ambassador, and user—verifying Kafka events, product creation, checkout, and email flows, then prepare deployment to Google Cloud.
Deploy and manage containerised microservices with Kubernetes on Google Cloud, simplifying deployment, scaling, and management of Docker containers. Install Kubernetes via Docker Desktop and prepare for creating your first pod.
Create a Kubernetes pod manifest for the email microservice, build a local image named username/project:version, and deploy with kubectl; Kubernetes manages containers across pods.
Learn to configure environment variables in Docker Compose for NodeJS microservices, including Kafka client and mailer settings, and prepare for Kubernetes migration.
Convert a Docker Compose file to Kubernetes YAML with Kompose, fix version 3.9 to 3, and deploy via a Kubernetes deployment with replicas, managing pods and planning service exposure.
Store and manage sensitive credentials with Kubernetes secrets, creating secrets via kubectl to keep passwords secure. Reuse secrets across files for kafka and mail credentials and verify pods.
Set up Google Cloud and create a new project, enable the Kubernetes Engine API, and create an Autopilot cluster in Europe to deploy the email microservice.
Learn to deploy a Kubernetes YAML file using Google Cloud Cloud Shell, configuring gcloud, obtaining cluster credentials, and applying the file to a Google Kubernetes Engine cluster.
Install the Google Cloud SDK, log in with gcloud, and set your active project to prepare pushing the image to Google Container Registry for Kubernetes deployment.
Push and manage your Docker image to Google Container Registry, tag and push, then deploy via Kubernetes, addressing secrets and resource constraints.
Deploy the microservice and set up a Cloud SQL database for the users service, configuring Docker Compose and credentials to connect with Google Cloud, while testing and noting production issues.
Authorize Google Cloud SQL access by adding your network IP to allowed networks, restart docker, and confirm port 8000. Seed the users microservice and rebuild volumes to apply changes.
Generate Kubernetes deployment and service files for the users microservice, configure container port and port mappings including external and target ports (8000), and apply with kubectl to deploy.
Deploy the users microservice to Google Cloud by pushing the image to the container registry, using Docker Compose and Kubernetes, and expose a public API /user via a load balancer.
Establish a private ip address to connect the users database, configure ip access, allocate an ip range, update the Kubernetes config, and verify the endpoint returns all users.
Expose microservices with a Kubernetes ingress, using Ambassador ingress and Google Cloud annotations to route API/users to the users service, validating paths and testing endpoints.
Set up and deploy an admin microservice by cloning databases, adapting Docker Compose, wiring env vars for the admin database and users, and preparing Kubernetes-ready config to seed data.
Create and configure Kubernetes files for the admin microservice, adjust docker compose, remove annotations, deploy admin and consumer services, push images to Google Container Registry, and test endpoints.
Deploy the admin microservice behind an ingress, restrict public access to user data, configure admin routes, and test by registering and authenticating an admin user before deploying the ambassador microservice.
Deploy and configure the ambassador microservice by cloning the database, adjusting docker compose, setting kafka client and topic, and preparing environment variables, test locally, then transition to kubernetes.
Convert a docker compose file to Kubernetes configurations, creating Ambassador and Redis YAML files, and deploy the images from Docker Hub to Google Cloud.
Deploy the ambassador microservice with Docker Compose, push images to Google Cloud Registry, and configure ingress and manifests; then verify user creation and product data access across services.
Set up the checkout microservice by cloning a dedicated database, configuring docker compose with the checkout backend, seeds, and environment values, and verifying the setup before moving to Kubernetes.
Convert your docker compose setup into Kubernetes YAMLs for the checkout service, database, and users microservice. Adjust resources and annotations, test with localhost, and prepare deployment to Google Cloud.
Push docker image with docker compose, build and push to Google Cloud Registry version 0.0.1, and observe API gateway routing three microservices through single API via ingress on port 8004.
Test the frontend across a microservices setup by using a single endpoint, validating product creation, checkout, and order flow with ambassador services, Kafka configuration, and Stripe payment on Google Cloud.
Welcome to NodeJS and Kafka: Breaking a Monolith to Microservices Course - the course that will take your Javascript development skills to the next level.
How this course works
This course will start with a pre-built monolith, the building of the starting app won't be covered in this course. So in this course, you will start immediately with Microservices Architecture, this course is intended for people that have a solid understanding of Javascript and want to learn in a short amount of time more advanced concepts. I am very clear and precise in my way of teaching so this course won't have unnecessary explanations on my part, I will explain what is needed when it is needed.
If you are interested in learning how the Monolith is created you can check my other courses:
Angular Material & NodeJS: A Rapid Guide - Advanced
React, Next.js and NodeJS: A Rapid Guide - Advanced
Vue 3, Nuxt.js and NodeJS: A Rapid Guide - Advanced
In those courses, you will learn how to build a SPA with your favorite frontend framework.
What you will learn in this course
In this course, you will start with a pre-built monolith and you will learn:
What is the Microservices Architecture
How to Configure Kafka with NodeJS
Internal Http Requests
How to make a Microservice only for Authentication Purposes
Run Docker with multiple networks
Produce Kafka Events to multiple topics
Create Custom Middlewares & Services
Import Data from multiple databases
About Me
I'm a FullStack Developer with 10+ years of experience. I'm obsessed with clean code and I try my best that my courses have the cleanest code possible.
My teaching style is very straightforward, I will not waste too much time explaining all the ways you can create something or other unnecessary information to increase the length of my lectures. If you want to learn things rapidly then this course is for you.
If you have any coding problems I will offer my support within 12 hours when you post the question. I'm very active when trying to help my students.
So what are you waiting for, give this course a try and you won't get disappointed.