HexaGO (A simple ports & adapter architecture example)

by edlingao

177 downloads Not rated yet

About

HexaGO is a simple example of a calculator app using the ports and adapter (hexagonal) architecture in Go. It demonstrates how to separate business logic (core) from external systems via ports and adapters.

Explore

- Implements hexagonal architecture in Golang.
- Core business logic is isolated from external systems.
- Uses ports and adapters for clean separation.
- Includes calculator app example with HTTP and database adapters.
- Live reload via air tool for development.

Clone the repository, install air and templ, then run air in the project root. Open your browser and go to http://localhost:3000.

This is a simple example of a calculator app using the ports & adapter architecture.

How to run

1. Clone the repository
2. Install air go install github.com/cosmtrek/air@latest
3. Install templ go install github.com/a-h/templ/cmd/templ@latest
4. Run air in the root of the project
5. Open your browser and go to http://localhost:3000

Inspiration

This project was inspired by the book Hexagonal Architecture by Alistair Cockburn & Juan Manuel Garrido de Paz (RIP).

The prupose of this project is to show a simple example of how to implement the ports & adapter architecture in a Go project.

License

Do with this project whatever you want. It's free and open source. No strings attached.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.