Skip to content

About

A modular monolith application built with Spring Modulith

Resources

Stars

1 star

Watchers

0 watching

Forks

 
 

Repository files navigation

spring-modular-monolith

An e-commerce application following Modular Monolith architecture using Spring Modulith. The goal of this application is to demonstrate various features of Spring Modulith with a practical application.

bookstore-modulith.png

This application follows modular monolith architecture with the following modules:

  • Common: This module contains the code that is shared by all modules.
  • Catalog: This module manages the catalog of products and stores data in catalog schema.
  • Orders: This module implements the order management and stores the data in orders schema.
  • Inventory: This module implements the inventory management and stores the data in inventory schema.
  • Notifications: This module handles the events published by other modules and sends notifications to the interested parties.

Goals:

  • Implement each module as independently as possible.
  • Prefer event-driven communication to direct module dependency wherever applicable.
  • Store data managed by each module in an isolated manner by using different schema or database.
  • Each module should be testable by loading only module-specific components.

Module communication:

  • Common module is an OPEN module that can be used by other modules.
  • Orders module invokes the Catalog module public API to validate the order details
  • When an Order is successfully created, the Orders module publishes "OrderCreatedEvent"
  • The "OrderCreatedEvent" will also be published to external broker like RabbitMQ. Other applications may consume and process those events.
  • Inventory module consumes "OrderCreatedEvent" and updates the stock level for the products.
  • Notifications module consumes "OrderCreatedEvent" and sends an order confirmation email to the customer.

Prerequisites

  • JDK 25
  • Docker and Docker Compose
  • Your favourite IDE (Recommended: IntelliJ IDEA)

Follow the Installation Guide to install the required tools.

Verify the prerequisites:

$ java -version
$ docker info
$ docker compose version
$ task --version

Using task to perform various tasks:

$ task test // runs all tests

$ task format // formats java code using spotless

$ task build_image // builds docker image

$ task start // starts app using docker compose
$ task stop
$ task restart

Deploying on k8s cluster

Set up a Kind cluster following Installation Guide

# deploy app to kind cluster 
$ task k8s_deploy

# undeploy app
$ task k8s_undeploy

About

A modular monolith application built with Spring Modulith

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages