my-company-backend

My Company Backend - Monorepo

View the Project on GitHub

projects/my-company-backend CircleCI

This backend application/s is a mono-repo version of the lab, and represents a predecessor of a multi-repo version. It exposes a REST API to be consumed by internal employees or partners.

Monorepo

Repository is structured in two folders:

Libraries are implemented in a separate maven projects and packaged independently into ‘jar’ archives. This promotes code sharing, reuse and it will enable us to apply microservices architecture style as an alternative to a monolith style.

My Company dependencies

At this stage we have one deployment pipeline for all projects (apps & libs). In addition, all projects in the repository share the same dependencies. Hence, there are no version conflicts b/c everyone has to use the same/ the latest (snapshot) version. And you don’t need to deal with a private maven repository when you just want to use your own libraries.

Benefits of monorepo

Drawbacks of monorepo

Architecture overview

Domain Driven Design is applied through Event Sourcing and CQRS. How Event Sourcing enables deployment flexibility - the application can be deployed as a monolithic or microservices.

Monolithic

The application is literally split into a command-side (domain) component and a query-side (materialized view) component (this is CQRS in its most literal form).

Communication between the two components is event-driven and the application uses simple event store (Database in this case - JPA) as a means of passing the events between components of a monolithic applicaton.

Microservices

Modular approach is enabling us to use microservices pattern and deploy components from monolithic application as independent applications/containers. The domain is split into a command-side microservice application/container and a query-side microservice application/container.

Communication between the two microservices is event-driven and we use RabbitMQ messaging as a means of passing the events between processes (VM’s).

The command-side and the query-side containers both have REST API’s which can be used to access their capabilities.

Running instructions

Clone it

$ git clone https://github.com/ivans-innovation-lab-monorepos/my-company-backend.git

Run it

$ cd my-company-backend
$ mvn clean install

run monolith

$ cd my-company-backend/my-company-apps/my-company-monolith
$ mvn spring-boot:run

or run microservices

$ cd my-company-backend/my-company-apps/my-company-microservices/my-company-configuration-backingservice
$ mvn spring-boot:run

$ cd my-company-backend/my-company-apps/my-company-microservices/my-company-registry-backingservice
$ mvn spring-boot:run

$ cd my-company-backend/my-company-apps/my-company-microservices/my-company-blog-domain-microservice
$ mvn spring-boot:run

$ cd my-company-backend/my-company-apps/my-company-microservices/my-company-blog-materialized-view-microservice
$ mvn spring-boot:run

$ cd my-company-backend/my-company-apps/my-company-microservices/my-company-project-domain-microservice
$ mvn spring-boot:run

$ cd my-company-backend/my-company-apps/my-company-microservices/my-company-project-materialized-view-microservice
$ mvn spring-boot:run

$ cd my-company-backend/my-company-apps/my-company-microservices/my-company-api-gateway-backingservice
$ mvn spring-boot:run

$ cd my-company-backend/my-company-apps/my-company-microservices/my-company-adminserver-backingservice
$ mvn spring-boot:run


Created by Ivan Dugalic@lab. Need Help? Join our Slack team.