> For the complete documentation index, see [llms.txt](https://kdongs.gitbook.io/kdocs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kdongs.gitbook.io/kdocs/hexagonal-architecture/hexagonal-architecture.md).

# Hexagonal Architecture

## About

<figure><img src="https://3861773809-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvEkt1OKir6OqMCAqi7Nf%2Fuploads%2FUobVHWLEOgwBfbyfctEi%2Fhexagonal.png?alt=media&amp;token=e6ab54ae-1e64-4729-9c40-d98d96845f9f" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3861773809-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvEkt1OKir6OqMCAqi7Nf%2Fuploads%2FnnSRnT6dIoCSfgekNsZU%2Fhexagonal-1.png?alt=media&amp;token=755aafe7-6f43-4c0f-bda6-3b50f2be3f6b" alt=""><figcaption></figcaption></figure>

## Application

### The Business Logic

The business logic (usecases), uses a ***Driven Port***. And this Driven Port is implemented by a ***Driven Adapter***, and the Resources (Driven Side) use this Adapters to communicate with the application.

* Here the Driven Port, could be seen as a Generic Interface.
* This Generic Interface can be implemented by multiple types of Adapters:
  * Like Database adapter.
  * Memory adapter.
  * File adapter.

Also the business logic, implements a ***Driver Port***.

## Drivers

What drives the application, it is what consumes.

### Driven Actors (Resources)

Is what is consumed by the drivers.

* SMTP Server
* Queue
* File system
* Database

In the application border we will have the application API. This means that the API is not a resource to be consumed.
