Hexagonal Architecture In Golang!? - Full Structure Example

preview_player
Показать описание
In this video, I talk about the Hexagonal Architecture Pattern in Golang. I go through ports and adapters, the package structure and talk about use cases for the pattern. The pattern includes an internal Domain Driven Design structure used throughout your application's core, a service layer that embeds your ports and shows a primary web adapter.

The Go code starts at 01:30.

Let me know whatcha want me to cover next with a comment :)

Рекомендации по теме
Комментарии
Автор

Great video. My company is starting to build a few new Microservices and we are using this design pattern.

IPHoldings
Автор

What’s your thoughts on using DTOs and newing up domain models in the service vs newing up in the adapters and parsing domain objects to services? I’ve seen both approaches and see pros and cons for both as well.

What do you think about creating ports for the services as well? So the driving adapters are not depending directly on the services, but of a port of the service?

AndreasHejndorf
Автор

Hey great video! I implemented something similar after reading Domain Driven Design. However I ran into some issues where I wanted the core of my application to maintain a transaction over multiple interactions with adapters I wanted to write to. A simple example would be: Say I have an inventory service, and any time a new unit is added to an inventory I want to increment the inventory available in the database, and produce to a message queue an event saying the new inventory level. I want to be sure that I don't commit my transaction to the database until I've successfully written to the topic. It feels to me like it's the responsibility of the domain layer to be aware of the transaction taking place and committing the transaction when both calls are successful. My problem with this is I'm beginning to leak implementation details (the fact that there's a transactional system within one of the adapters) into my domain layer. I was wondering if you had come across a similar problem and if you did, what was your solution?

SeanSmithPit
Автор

good content, tnx, but why background music??? it is hard to understand

samankarbasi
Автор

I making my first Golang side project, how do I learn about structuring applications like this? A lot to learn!

IkraamDev
Автор

how would you structure a go micoservice, I have been trying to follow the examples of go-kit and standard go-structure but it is very confusing.

Mikkysam
Автор

have you played with Taskfile instead of Make?

EightSixx
Автор

how could you implement transaction since core doesn't know the db implementation?

lintaoamons
Автор

Why wouldn’t you want your handlers to have any domain dependencies?

petenilson
Автор

Love your video!
Could you guide me how to manage db transaction when we might have to use some of services together?

bankonly
Автор

Let me ask if this Hexagonal Architecture is clean architecture?

anhhaoam
Автор

thanks for the video, do you have the github URL for this code repo? would be great to use as a reference while we implement similar pattern

nickernara
Автор

I liked the video but the music is unnecessary here, it's a little bit distracting and hard to focus :) just my 2 cents

SayfSentinel