Skip to content

A reference implementation showcasing a micro monolith architecture that harnesses the power of DDD, CQRS, and Event Sourcing principles

Notifications You must be signed in to change notification settings

dddsphere/martello

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

Martello is a reference implementation of a micro monolith that serves as an example of Go microservices architecture that integrates Domain-Driven Design (DDD), Command and Query Responsibility Segregation (CQRS), and Event Sourcing principles. This repo should provide with a reliable reference for creating custom services based on these principles while minimizing external dependencies and leveraging the Go standard library.

A code generator to develop in another repository is envisioned to be developed based on Martello's architecture. This generator will utilize the reference implementation as a foundation for generating custom code that aligns with the established principles.

Key Features

  • DDD-Driven Design: Embrace modularity, separation of concerns, and a deep understanding of the domain model for well-organized and maintainable microservices.
  • CQRS Paradigm: Promote a clear separation between write and read operations to design optimized read models and ensure a consistent and scalable write side.
  • Event Sourcing: Capture every state change as an immutable event to enable precise auditing, temporal querying, and the ability to rebuild state at any given point.
  • Dependency Minimization: Strive to minimize external dependencies by relying primarily on the functionality provided by the Go standard library for simplicity, efficiency, and ease of maintenance. The goal is to ensure that the generated code is self-contained. Any common structures or reusable components, such as struct embeddings, will be generated within the internal package of the project, avoiding the need to import additional packages from outside of the generated codebase.

At its core, this monolith is designed to operate as a single executable, providing convenience in local development environments and production scenarios where extensive load scaling is not required. However, its architectural design also enables the option of operating as a group of microservices, working together harmoniously.

This dual nature will allow the monolith to serve as a cohesive unit by default, while retaining the architectural flexibility to smoothly transition into separate microservices so when the need arises, each service can be individually horizontally scaled out.

TopSpin and its generator will eventually be modeled after this implementation. The goal is to leverage the principles and design patterns demonstrated in this reference implementation to shape the development of TopSpin and its associated code generator. By aligning with this implementation, we aim to ensure consistency, maintainability, and adherence to best practices.

Usage

To use this reference implementation, follow the instructions below:

  1. Clone the repository: git clone github.com/dddsphere/martello.git
  2. Explore the different components and modules to understand the implementation.
  3. Adapt and modify the codebase according to your specific project requirements.
  4. make run
$ make run
go run ./cmd/martello/main.go
[INF] martello starting...
[INF] analytic-service-42rg8ryt default init
[INF] cart-service-ijwrqhan default init
[INF] catalog-service-yolg1ij8 default init
[INF] order-service-uyt44zva default init
[INF] user-service-hqn2037y default init
[INF] warehouse-service-77km5ltm default init
[INF] martello started!
[INF] http-server started listening at localhost:8080

License

This project is licensed under the MIT License.

About

A reference implementation showcasing a micro monolith architecture that harnesses the power of DDD, CQRS, and Event Sourcing principles

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published