Coder Social home page Coder Social logo

rest-spring-boot-hexagonal-architecture's Introduction

rest-spring-boot-hexagonal-architecture

This project is to expose my interpretation of the hexagonal architecture, under spring-boot framework.

The diagram of the hexagonal architecture relies on the following:

Hexagonal architecture diagram

I have tried to take a diagram that I have seen common on different articles, even though I saw port/adapter to be swap.

This architecture follows the clean architecture from Uncle bob:

https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html

This project is following this diagram on spring-boot framework.

Application diagrams

On this I was doing the following approach diagram:

Application diagram

Where we have as part of the application is:

  • REST implementation
  • Database connection

The colors meant to be:

  • Orange: this is the domain model of our application, that is located on com.example.service.user.domain
  • Blue: this is the application itself, where we have the logic and the ports (to apply this logic from and to). The package is: com.example.service.user.application
  • Green: this is the package com.example.service.user.adapter, where are the implementation of the ports. It was decided to keep the repositories and the controllers, even though this could be moved to the infrastructure package.

What was not played out on this diagram was the package:

com.example.service.user.infrastructure

This package is cross, so it was not having a flow on the diagram, but impacts to be defined shared components.

Domain model

The domain model is a simple one, for user management.

This diagram it is just a simple information for eventual User domain. We can see the following domain model diagram:

Domain model diagram

where the colors here represents:

  • Orange: entity or root aggregate of our domain
  • Blue: value objects

This domain has a functions class, where it is a bunch of functions to access to User entity information.

Architecture tests

It was implemented the arch rules from arch unit library.

The tests are located on:

com.example.service.user.architecture.*

Test strategy

The tests develop were doing unit tests for each class of the project.

Do integration test on the controller, which is our application entry point.

rest-spring-boot-hexagonal-architecture's People

Contributors

naspredam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.