Hexagonal architecture is a great way to build structure to your system and split it into different layers each of which serves a specific purpose.
Do not let the name trick you into thinking that it contains 6 pieces of logic. It is more of a representation of the multiple sides a hexagon has, which makes it ideal apps that have multiple connections with external systems. Also the hexagon is common to use in UML diagrams.
Now let’s talk about the 3 layers that make Hexagonal architecture.
The way I like to think of adapters is like the I/O of our app. What gives data to the app and then where does the data go?
That might be a HTTP endpoint that invokes our app, or an EventBridge event that our app is listening to. Then on the opposite end, once the app executes its business logic it has to do something with that data.
A very common scenario is to store it in some kind of Database like DynamoDB or MongoDB or even send a notification to the customer. Adapters can be anything that allows our app to communicate with the outside world.