HexaShop is a simple Golang application built to learn and implement hexagonal architecture. It includes APIs for managing users and products, demonstrating the core principles of domain-driven design and separation of concerns.
- User management API (CRUD operations)
- Product management API (CRUD operations)
- Demonstrates hexagonal Architecture (ports & adapters pattern)
This project uses the hexagonal architecture (also known as Ports and Adapters), which aims to create a more modular, loosely-coupled code structure. The business logic (core domain) is separated from the infrastructure (database, HTTP layer), making it easier to test and extend.
- Must have installed
go 1.21.1
or latest. - Must have installed task command
-
Run the following command to execute the application
task run
./
βββ cmd/
β βββ app/
β βββ main.go
βββ conf/
β βββ conf.go
βββ internal/
β βββ adapter/
β β βββ http/
β β β βββ api/
β β β β βββ product.go
β β β β βββ user.go
β β β βββ rq/
β β β β βββ product.go
β β β β βββ user.go
β β β βββ router.go
β β βββ storage/
β β βββ postgres/
β β β βββ migration/
β β β β βββ 000001_init.down.sql
β β β β βββ 000001_init.up.sql
β β β βββ repo/
β β β β βββ product.go
β β β β βββ user.go
β β β βββ schema/
β β β β βββ schema.sql
β β β βββ db.go
β β β βββ migration.go
β β βββ redis/
β βββ core/
β β βββ domain/
β β β βββ product.go
β β β βββ user.go
β β βββ service/
β β βββ product.go
β β βββ user.go
β βββ port/
β βββ product.go
β βββ user.go
βββ .env.sample
βββ .gitignore
βββ README.md
βββ Taskfile.yml
βββ go.mod
βββ go.sum