How samverrall/hex-structure works
Project type and purpose
• This is a Golang HTTP service structured around a hexagonal (ports & adapters) architecture.
• Its primary responsibility is handling user‐related operations (e.g., account creation) via a web interface and persisting data in Postgres.
File structure
• Top‐level “cmd/web”: entrypoint (main.go) that starts the web server.
• internal/adapters/primary/web: HTTP layer (routes, server, handlers, view templates).
• internal/adapters/secondary/postgres: Postgres implementation of the persistence port.
• internal/ports: definitions of the interfaces (e.g., UserRepository, UserService) that decouple core logic from adapters.
• internal/core:
• domain/user: entities and value objects (User, Name)
• services/users: application/business logic (CreateApplication)
• services/errors: shared error types
README
• States “hexagonal architectured Golang service”
Essential elements to capture
• Call out the “cmd/web” as the application launcher pointing into the Web Adapter
• Template rendering in the Web Adapter (views/layouts, pages, partials)
• How internal/ports defines the interface boundary