
Explore microservices powered by Spring Boot, learn clean and hexagonal architectures, domain-driven design, and event-driven patterns with Kafka, Saga pattern, outbox, and CQRS, then deploy with Docker, Kubernetes, and GKE.
Present a food ordering system with four microservices that communicate via Kafka, coordinating payments and approvals in a saga pattern.
Explore hexagonal architecture and domain-driven design, with ports, adapters, aggregates, domain events, saga and outbox patterns, plus dockerized deployment to Kubernetes and GKE.
Install and configure Java 17, Maven, IntelliJ, Git, Docker, and Docker Compose; verify installations, and set up PostgreSQL and Kafka tools to prepare the local microservices environment.
The source code provided as GitHub links and zip files!
Explore clean and hexagonal architectures, centering the domain layer to ensure a testable, independent software with ports and adapters, dependency inversion, and clearly defined entities and use cases.
Designs the order service with clean and hexagonal architecture, introducing domain and data layer interfaces. Illustrates dependency inversion with an API layer and REST controllers in a runtime-wired container.
Add an AI port and an AI layer adapter to the order service, enabling a remote LLM call via Spring AI with OpenAI, while preserving clean architecture and DDD.
Create a multi-module food ordering system using clean and hexagonal architecture: build an order service with domain, application, dataaccess, and messaging modules, plus order-container and order-domain-core wired to Kafka.
Define and connect order-service submodules using clean architecture, linking order-domain-core to the application service, managing versions in the base pom.xml, and verifying dependencies with a depgraph visualization.
Explore domain-driven design from strategic boundaries and ubiquitous language to tactical concepts such as entities, aggregates, value objects, domain events, and domain services, with kafka event logs guiding order-service.
Designs the order service domain using tactical domain-driven design patterns, building the order processing aggregate with value objects, entities, and domain events such as created, paid, and canceled.
Implement the order service domain logic by building the order aggregate with value objects and items, and enforce domain rules for initialize, pay, approve, and cancel.
Explore adding state changing methods to the order entity to form a simple state machine, transitioning from pending to paid, then approved, with cancel paths and saga-based rollback.
Implement domain events in the order service domain layer by creating order created, paid, and cancelled events, a shared domain event interface, and a domain service.
Implement the order application service module by adding dependencies and defining DTOs for create order command and response, track order query and response, and payment and restaurant approval messages.
Set up the OpenAI API key for Spring AI applications by logging into OpenAI, creating a project, generating the key, and configuring environment variables.
Update the order service domain to support ai integration by adding the orderPreferences value object, spice level enum, and an orderNoteInterpreter port, to be implemented by a future ai module.
Update and test the order service by mocking OrderNoteInterpreter, injecting via autowired, and converting raw notes to structured order preferences with a large language model.
Discover Apache Kafka basics: brokers, topics, partitions, replication, and offsets. Learn how producers, consumers, and consumer groups use append-only logs for resilient, scalable streaming with schema registry and K table.
Build a generic kafka producer and consumer in a new infrastructure module, with four sub-modules, a base pom, and config data mapped by kafka-config prefixes for confluent avro serializer.
Implement the Kafka model module by generating Avro Java classes from Avro schemas with the avro-maven-plugin, and configure Maven to create sources during install, including UUID, decimal, and timestamp-millis fields.
Implement a generic Kafka producer module with Spring configuration, producer config, factory, and template to send data to Kafka brokers using asynchronous callbacks and proper cleanup.
Implement a Spring global exception handler with controller advice and Slf4j, returning error DTOs for order domain and validation errors with 400, 404, and 500 responses.
Develop the data access adapter by adding JPA entities and repositories for orders, customers, and restaurants, with one-to-one and one-to-many mappings, address and order items, plus Lombok builders.
Create OrderJpaRepository extending JPA repository for OrderEntity with UUID and an OrderDataAccessMapper to convert between domain objects and entities, enabling findByTrackingId via Spring.
Develop the order messaging mapper to convert order created and canceled events into payment request Avro models, with pending or canceled statuses, and define configuration data for four Kafka topics.
Develop publisher implementations for create, cancel, and pay order events using Kafka, Avor models, and a generic callback helper within hexagonal architecture, with domain mappers and config-driven topics.
Implement payment and restaurant approval listeners, using PaymentResponseKafkaListener and RestaurantApprovalResponseKafkaListener to convert PaymentResponseAvroModel to PaymentResponse and ApprovalResponseAvroModel to approvalResponse via the messaging data mapper, triggering saga actions.
Implement the order container module by adding Spring Boot starter, building a jar and docker image, and configure multi-module support with scanBasePackages, entity scan, and JPA repositories, Postgres, and Kafka.
Configure a Kafka consumer with string key and Avro value deserialization, and tune consumer group id, auto offset reset, Avro reader, bench listener, and poll settings for optimal throughput.
Create the order service PostgreSQL schema with UUID support, including orders, order items, and address tables, cascade deletes, and enum order status values for testing.
Implements the order notes interpreter with OpenAI API, using a system prompt and prompt template to extract order preferences into OrderPreferences, with retry logic and AIOrderNotesInterpreterException for failures.
Upgrade Java to 25 and Spring Boot to 3.5.8, configure Lombok, migrate to Jakarta, and switch to KRaft mode Kafka without ZooKeeper for the order AI module.
Update the order service data access layer to persist LLM-populated order preferences as a JSONB column using JDBC type mapping; synchronize domain and JPA entities and prepare end-to-end AI testing.
Create a Spring Boot customer service module with a PostgreSQL schema, a materialized view of customer data for the order service, and run the end-to-end order workflow via Kafka.
Explore running a local LLM with Ollama for the order AI module, switching between local mistral 7B and OpenAI via spring AI, using an OpenAI-compatible Ollama API, with logging.
Develop the payment domain core by adding an aggregate root, payment entity, and value objects, including payment id, credit entry id, and credit history id, using money value objects.
Extend the domain exception framework with a payments domain exception and not found variant, then define abstract payment events (completed, canceled, failed) using a generic payment entity and super constructors.
Implement payment domain service with validate and initiate, and validate and cancel methods; enforce credit entry checks, update credit history, and emit payment completed or failed events using UTC time.
Implement the payment application service input port by building the payment request listener and persisting data via the data mapper, repositories, and domain events.
Refactor the fireEvent process by adding a domain event interface with a generic fire method and wiring domain event publishers to publish payment and order events.
Implement a complete payment data access module with adapters for payments, credit entry, and credit history, mapping between domain objects and JPA entities using repositories.
Implement a spring kafka listener for payment requests, wiring a payment request message listener and messaging data mapper to handle pending and cancel payments under the saga pattern.
Finish the restaurant domain core by adding exception classes and domain events for order approval and rejection, then implement the domain service and publish approved or rejected events.
Explore building the application service domain module by adding a mapper, DTOs, and ports, configuring dependencies, Kafka topics, domain events, and repository interfaces for restaurant approval.
Implement the application service input port for restaurant approval requests, using slf4j and spring annotations, and persist approvals transactionally via a data mapper and repositories.
Implement the restaurant service data access module by configuring dependencies, creating common data access components, and implementing JPA entities, repositories, and mappers for data access across services.
Implements the restaurant service container module by wiring domain core, application service, data access, and messaging with spring boot, and builds docker images and Kafka topics.
Explain and implement the order payment saga and order approval saga in a microservices architecture. Utilize transactional processing, domain events, and a shared saga helper for persisting orders.
Explore failure scenarios in a microservices food order system using saga and compensating transactions, with kafka-based communication across order, payment, and restaurant services, and introducing all sparks pattern for resilience.
update the order service to implement the outbox pattern by adding saga and outbox tables for payment and restaurant events, with json payloads, enums, indexes, and scheduler config.
Refactor the order domain to add outbox models and update ports, introducing order payments and approvals outbox messages with JSON payloads and saga status tracking via Kafka.
Refactor the order domain to add an outbox scheduler using spring scheduling. Implement a payment outbox scheduler with a helper and saga constants to publish messages and update outbox statuses.
Refactor the order domain to add approval outbox schedulers, including an approval outbox helper and restaurant scheduler, plus a daily outbox cleaner for completed and processing saga statuses.
Refactor the order domain layer to implement the outbox pattern by persisting events locally, removing direct publish calls, and using a payment outbox helper with transactional saves and json payloads.
Refactor the order payment saga to use the outbox pattern instead of direct event firing. Update saga steps and outbox handling for payment and approval to ensure idempotent processing.
Refactor the order payment saga by moving complete payments to a new private method, and apply optimistic locking on outbox messages to safely handle concurrent updates in Kafka.
Refactors the order domain to update the order approval saga, injects order data mapper and outbox helpers, and enables idempotent processing with optimistic locking and Kafka outbox flows.
Refactors the order messaging module to implement the outbox pattern for payment request events via a Kafka publisher, Avro model payloads, saga ID, and robust error handling.
Refactor the order messaging module to outbox-based Kafka publishing, introducing restaurant approval Avro payloads, saga tracing, and robust error handling for optimistic locking scenarios.
Develop and validate an integration test for the order payment saga using Spring Boot, SQL test data, and the outbox pattern, including concurrency and optimistic locking checks.
Refactors the payment domain to use an outbox pattern with schedulers, order outbox messages, saga integration, and read-only versus transactional operations for reliable event persistence.
Add the Outbox repository adapters to the payment data access module, implementing entity, mapper, and repository components for order outbox messages using the Outbox pattern.
Refactor the payment messaging module to the outbox pattern with a Kafka payment response publisher and Avro models. Log saga IDs, configure topics, and enable Spring managed components.
Test the payment request message listener in a Spring Boot context, ensuring outbox persistence and handling of double payments. Validate single- and multi-thread executions and log PostgreSQL unique constraint violations.
Refactor the restaurant service to implement the outbox pattern, adding order_outbox, status fields, data access, and mappers, with a scheduled 10-second delay to publish Kafka messages.
Hi there! My name is Ali Gelenler. I'm here to help you learn microservices architecture while applying Clean and Hexagonal Architectures and using Domain Driven Design.
In this course, you will focus on architectural aspects of Microservices architecture and Software Architecture using Clean & Hexagonal Architecture principles while developing each service. In the implementation of the domain layer you will also apply Domain Driven Design principles.
The course also includes a new section on adding AI functionality into the existing Order Service while still following Clean Architecture and Domain Driven Design principles. In this section, you will implement an AI-powered Order Note Interpreter that transforms raw customer order notes into structured order preferences. You will use Spring AI with both OpenAI and Ollama, apply system prompts as guardrails, use prompt templates for controlled and repeatable LLM calls, and connect LLM responses to business logic more safely using structured output.
You can always use the latest versions for spring boot, and other dependencies in this course. I will be constantly updating the dependency version in the last section's lectures. You may check that to see the required code and configuration changes for updated versions. Also if you would like to use subtitles during the course, you can turn on the captions on videos as all lectures are updated with hand-written subtitles. You may choose among over 20 different languages. I suggest using subtitles to make it easier to follow the lectures.
Scott Knox: "As a working professional, I can already tell this is the holy grail of understanding modern architectures. If your company is struggling to grasp certain concepts, this course will help you help them. Thanks Ali for the excellent explanations!"
You will implement SAGA, Outbox and CQRS patterns using the 4 Spring boot Java microservices that you will develop using Clean and Hexagonal architecture principles.
Nick Goupinets: "Great course - gives a deep-dive into microservice development experience with Spring Boot. As an added bonus shows how to deploy it with Kubernetes. At times it felt too detailed, sort of making it hard to see the forest behind the trees. Also Hex. architecture resulted in what looked like an over-engineered overall solution. With that said, Ali did a fantastic job explaining all of the design decisions with clear architecture diagrams that offset that complexity!"
You will also learn and use Apache Kafka as the event store, and use events to communicate between services, and to implement the architectural patterns.
Nischal Jadhav: "If u are looking to become an high level developer or an architect, then this is the best course.!"
The concepts that you will be learning and implementing are:
Spring boot microservices
Clean Architecture
Hexagonal Architecture
Software Architecture
Domain Driven Design
AI integration using Clean Architecture, Ports and Adapters, and Domain Driven Design principles
Order Note Interpreter AI assistant using Spring AI, OpenAI, Ollama, LLMs, prompt templates, system prompts, guardrails, and structured output
Event-driven services using Apache Kafka
SAGA Architecture Pattern
Outbox Architecture Pattern
CQRS Architecture Pattern
Kubernetes on local using Docker desktop
Kubernetes on Google Cloud using Google Kubernetes Engine(GKE)
Ali Aminian: "I really like this course. Thanks Ali for complete description and professional coding. I really enjoy to participate this course."
To communicate with the data stores in microservices you will use Spring Data JPA for PostgreSQL, and Spring Kafka for Kafka.
You will be following a hands-on approach and developing a project from scratch. You will have 4 microservices that communicate using events with Kafka as the event store.
r j: "This is an amazing course. An architect from my team recommended this to me and he's implemented something similar but bigger in our company, the biggest retailer on the planet."
You will also have multiple choice quizzes in each section to check your progress throughout the course.
Arindam Majumdar: "This course helped me immensely to understand the Domain Driven Design approach on Microservices. Its so far the best hands on course I have come across in Udemy so far. Many thanks to Ali. Great job!! :)"
At the end of the course you will understand how to run an event-driven microservices architecture with Clean and Hexagonal Architecture principles and with Domain Driven Design concepts. You will use Spring boot and Java to develop the microservices. You will also learn implementing architectural microservices patterns such as SAGA, Outbox and CQRS. In the end you will be able to deploy your application to Kubernetes on Google Cloud using Google Kubernetes Engine. You will also learn how to add AI functionality effectively into an existing microservice using Ports and Adapters architecture. You will use Spring AI with OpenAI and Ollama and implement an AI assistant as a secondary adapter in Clean Architecture while using modern techniques such as prompt templates, system prompts, guardrails, and structured output.
Anurag tiwari: "Just started the course but i can already tell that this a good one Ali explains all the concepts like out box ,saga pattern so well. I would highly recommend this course for anyone who wants to take their knowledge about microservices to the next level using different patterns like hexagonal ,saga pattern. I would also recommend this course for beginners as youll learn a ton of stuff regarding microservices and patterns to create agile services as this course is very hands on"
I have followed the same clean & hexagonal architectures and domain driven design principles in the implementation of each microservice. If you feel like you want to skip some repeating parts, you may download the source code that I provide in the first lecture of each section starting from section-3 or using the github links that I provided in the course resources. You can then use the provided source code to continue with the section.
Narendra Kumar A: "Its awesome course, I have ever come across in Udemy explaining the DDD, Clean architecture and usage of patterns concepts so cleanly."
For more detailed information on the progress of this course, you can check the introductory video and free lessons, and if you decide to enroll in this course, you are always welcome to ask and discuss the concepts and implementation details on Q/A and messages sections. I will guide you from start to finish to help you successfully complete the course and gain as much knowledge and experience as possible from this course.
Jason: "This course is one of the best I ever had. There are many microsevices courses on Udemy, and most of them are like something that manufactured in the same factory. They all used the same framework and followed the same steps to teach microservices. They never talked about the important concepts behind the microservice. I felt like they just wanted to show off the latest version of frameworks and finish the long courses with them quickly and get paid. The impression after I watched first this lesson was amazing. He actually starts the project with the bare bone java plain object. It was like I'm flying with feather, not fully armed with numerous buzzword frameworks. It might be frustrated at first if you are really new to microservices and never heard of concepts like DDD before. But I'm pretty sure this is one of the courses that make you a "better" developer."
Remember! There is a 30-day full money-back guarantee for this course! So you can safely press the 'Buy this course' button with zero risk and join this learning journey with me.