
Learn how to break a Laravel monolith into microservices using Kafka, with Docker, separate databases, and event-driven communication across admin, ambassador, checkout, and user services.
Set up the Laravel ambassador project by cloning backend and frontend, installing dependencies, configuring docker, generating an app key, and launching admin, ambassador, and checkout fronts on local ports.
Configure stripe publishable and secret keys for test checkout on localhost, then install mailhog to capture emails and prepare to break the monolith into microservices.
Explore the back-end api structure, admin and ambassador routes, and core models; see how users, products, orders, and links interact, use events and caching, then plan the email microservice.
Break a Laravel monolith into microservices by isolating email handling in a separate email microservice. Front-end apps trigger order emails via Kafka events, with Docker and MySQL in use.
Compare monoliths and microservices, showing how a single multi-function app differs from smaller, independently deployable services scaled via internal APIs or an event bus like Kafka.
Set up the email service in Laravel, install via composer, create and open the email project, move views and listeners, and prepare to send Kafka events for email delivery.
Set up a Google Cloud account with free credits to deploy containers, then configure Kafka on Confluent Cloud and create topics for publishing and consuming events.
Authenticate to Confluent Cloud via the CLI, configure environment and cluster, then run producer and consumer to send and receive messages on the default topic.
Set up Kafka inside a Dockerized Laravel environment and configure a Kafka consumer to subscribe to topics. Run an Artisan command to consume messages from Confluent Cloud and send emails.
Create a custom Kafka queue in Laravel by implementing the queue contract, building a Kafka connector, wiring config and service provider, and processing messages with artisan queue work.
Produce messages in a Laravel microservices setup by creating an artisan produce job, wiring a Kafka producer and topic, and dispatching queue work to send a message.
Discover how to produce and dispatch Laravel jobs for order completed events, serialize the job for messaging, and use a shared custom function approach to power email microservices.
Configure mailhog and docker to enable email delivery in the Laravel ambassador setup, validate queue-driven emails, and pass ambassador revenue data in order notifications.
Create a shared composer package for Kafka queue to be used by all microservices; initialize composer, configure Laravel, unify namespaces, set topic via env var, and publish to Git.
Learn to reuse a custom package across Laravel microservices by installing it via composer, configuring the Kafka service provider, and using jobs to produce messages and emails.
Create an email topic and route events to it, replacing the default topic. Dispatch messages by specifying the topic during production to ensure emails go to the email topic.
Create the user microservice, moving the user data from the main Laravel app to the new service, connect it with Kafka, and access only via EDP requests.
Create a Laravel users microservice, adjust docker and docker-compose, and configure the environment for a dedicated users database. Migrate the user table and install Sanctum for API tokens.
Import the exact users from the other microservice by adding a secondary database connection, pulling data from the old database, and seeding it into the new system.
Transfer the user management from the ambassador monolith to the user microservice by building an api service, a dedicated user service, and a new oauth controller with a register route.
Learn to isolate services with Docker networks, connect user and database containers to a users network, and expose the user microservice internally while using environment variables for endpoints.
Learn how to implement login in a Laravel microservices setup by generating a JWT with a scope, returning it as a cookie, and testing the login flow.
Refactor the API service by introducing a generic request helper that supports get, post, put, and delete methods, handles responses, and throws on errors.
Finish the auth controller by implementing logout that deletes jwt tokens in sanctum and coordinates with the user service via post and put requests for logout and user info/password updates.
Remove the user from controllers and use a user service to fetch all users and ambassadors, exposing a users index and a show endpoint (users/{id}) filtered by is_admin.
Remove the user model from controllers and services, update revenue calculations using orders data, and refactor factories and helpers to break the monolith into microservices in Laravel.
Implement scope based authentication middleware to guard admin and ambassador routes, using a scopeCan function and a user service to verify tokens and return unauthorized when needed.
Create a dedicated user service package in the laravel microservices setup, initialize a composer package, set the namespace to services, and prepare a repository workflow for future microservices.
Create the checkout microservice with its own database and Kafka integration. Integrate communication with the user service to enable checkout workflows.
Set up a Laravel microservices checkout project, configure Docker, and migrate tables—products, links, link, orders, and order items—using unsigned big integers, no auto increment, across services, via Docker Compose.
Import and seed the database by configuring the old MySQL connection, creating product and order seeders, importing old data, and refreshing the database to complete the import.
Move the controllers to microservices by extracting the link and order controllers, keeping only the necessary methods, and integrating the user and Kafka services by running composer update.
Configure Kafka by creating checkout topic with one partition, wire queues and config, and run a checkout queue service to consume product created events from Kafka, enabling cross-service data flow.
Develop the checkout microservice by wiring product events: product updated, product deleted, and creating a link created event with linked products; update, destroy, and publish data to the checkout topic.
Test the microservice checkout by updating front-end endpoints, switching to the next checkout and angular environments, and validating the flow from product selection to email notifications on localhost port 5000.
Split the remaining monolith into admin, car service, and ambassador service, starting with the ambassador service; each front line will have its own microservice, and all will communicate with users.
Set up the ambassador microservice, modify Docker and migration files, tailor the ambassador database schema, and run Docker Compose up with migrations to complete the split from the monolith.
Import data by copying and adjusting models and seed data, configuring the database, running fresh migrations, and validating order item totals before proceeding to controllers.
Move and consolidate controllers across microservices by copying controllers and services. Share a single scope for routes, remove unused parts, and update user and Cafcass services with composer update.
Refactor the auth controller in the ambassador micro service to scope to ambassadors and compute revenue from orders. Remove the store method, remove the tax controller, and reconfigure kafka.
Configure Kafka in a Laravel microservices setup, create ambassador and email topics in Confluent Cloud, set queue connections to Kafka and Redis, restart Docker, and dispatch events on order completion.
Set up the admin microservice for the Laravel monolith by adding docker files, configuring services and migrations, running docker compose up, and migrating and populating data.
Populate the database by copying seeds and models, configuring the old database connection in config and env, and running php artisan db:seed to seed data.
Move and refactor the controllers, transfer related services (user, weather, jobs), add resources and requests, update Composer and autoload configurations, and prepare Kafka integration for the microservices setup.
Integrate Kafka service provider, configure Kafka connections in the EMV file, and create admin and ambassador topics to publish product, link, and order events, with middleware scope adjustments.
Test and debug admin and ambassador microservices, fix credentials and imports, verify user creation and login, and validate product creation and order flow to ensure reliable inter-service operations.
Deploy microservices with Kubernetes on Google Cloud, exploiting container management, auto-healing, and replication to scale. Install Kubernetes via Docker Desktop and prepare a Kubernetes file for the email microservice.
Learn how to containerize a service with docker, build and tag images, deploy with docker compose and kubectl, and manage pods and containers that auto-restart.
Set up environment variables for the email microcircuits, include Kafka connection credentials and mailer credentials via Mailtrap for testing, and prepare these credentials for encryption and deployment.
Convert docker compose to kubernetes yaml with compose, fix version issues, and configure a deployment with a single replica, labels, environment variables, and plan to store credentials as secrets.
Create and manage secrets for Kafka credentials, including bootstrap servers, usernames, and passwords, and integrate them into YAML configurations before deploying to Google Cloud.
Deploy a YAML file to Google Cloud Platform with Google Kubernetes Engine autopilot in Europe, enable the API, create the cluster, and apply the deployment with kubectl.
Configure resource limits in YAML, push the docker image to Google Container Registry, and use Google Cloud SDK to authenticate and set the project for deployment.
Builds and pushes the application image to Google container registry using Docker Compose, tags the image, and updates the deployment after resolving Cafcass secrets and the Kafka-driven email queue.
Build a production docker compose for the users service, set the image and database environment variables, expose ports, and remove volumes and networks for a lean deployment.
Create a Google Cloud database instance for the users microservice, configure a minimal database in Europe West three, and run migrations with Docker Compose using Laravel Artisan.
Connect to a database, push users image to Google Cloud Registry, build with docker compose, deploy the users backend via yaml deployment and service, and prepare an ingress for testing.
Configure an ingress to expose multiple containerized Laravel services behind a single ip address for browser testing, using path based routing to map requests to each service.
Connect the database via a private IP by enabling private access and updating the YAML DB host, then compare with a proxy approach.
Refresh environment variables in a laravel monolith-to-microservices setup to fix database connection errors. Learn to clear and rebuild config cache, update docker-compose and yaml, and deploy new images.
Deploy the admin micro service by updating the docker compose YAML, configuring environment variables and DB credentials, cloning the user MICRA database to admin, and running migrations.
Create and deploy admin microservices by composing and refining YAML, updating versions and resources, configuring secret keys for Kafka, building and pushing images, and deploying the admin backend and queue.
Adjust the ingress to expose admin endpoints under admin, route admin traffic to the admin microservice, and configure the user service port for admin access via routes like admin/register.
Replace environment variable usage with a config-driven endpoint for the user service, enable config caching, update dependencies, rebuild docker images, and verify admin and ambassador microservices.
Deploy the ambassador microservice by cloning the database, configuring docker compose, setting environment values, enabling cache and Kafka, then running artisan migrate and seed.
Update ambassador kubernetes yaml files by removing annotations and adjusting resources, then create ambassador.yaml and ambassador-release.yaml for the Khubani cluster and prepare ingress deployment.
Deploy the ambassador and pods, configure yaml and environment variables, build and push the image to Google Cloud Registry, then verify Redis, database host, and checkout via the front end.
Deploy the checkout microservice by cloning the admin database, configuring docker compose with environment variables and credentials, and running migrations and seeds to complete the setup.
Configure the checkout Kubernetes files by creating and updating the Copernicus checkout file, wiring resources, bootstrap servers, and credentials, and updating the database host for the monolith-to-microservices transition.
Deploy the checkout microservice by building and pushing images to the Google container registry, updating docker compose with the user microservice, and configuring ingress to expose the endpoint.
Change service names across configuration files to use users backend and update ambassador and admin hosts. Test endpoints to confirm the front end and ambassador routes work.
Test the frontend across admin, ambassador, and checkout apps by updating endpoints to deployed microservices, verify products load, handle cookies for authentication, and prepare for frontend deployment.
Deploy your frontend by building docker images for admin, checkout, and ambassador front ends, tagging version 0.0.1, and pushing them to the Google Cloud registry.
Deploys the frontend microservices by creating deployments and services for admin, ambassador, and checkout frontends, configuring ports and ingress for external access.
Welcome to Laravel and Kafka: Breaking a Monolith to Microservices Course - the course that will take your Laravel development skills to the next level.
Here are some interesting facts:
The average Laravel developer salary in the US is $92,285
However:
The average Kafka developer salary in the US is $97,500
The average Microservices developer salary in the US is $134,546
This means if you are a Laravel developer you have the potential to increase your salary by up to 40% just by purchasing this course!
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 Laravel 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, Universal & Laravel: A Rapid Guide
React, Next.js and Laravel: A Rapid Guide - Advanced
Vue 3, Nuxt.js and Laravel: 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 PHP
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 Laravel Queues
Create Custom Composer Packages
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.