Golang Hexagonal Architecture codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.
This codebase was created to demonstrate a fully fledged fullstack application built with Golang including CRUD operations, authentication, routing, pagination, and more.
We've gone to great lengths to adhere to the Golang community styleguides & best practices.
For more information on how to this works with other frontends/backends, head over to the RealWorld repo.
The hexagonal architecture is simply push any external dependency to the edge of the app and keep business logic (service) in the core part. With this architecture we can easily swap external dependencies such as swap restful API to gRPC, mongo to postgres etc.
Run default app (rest-api, postgres) (see docker-compose.yaml)
$ docker compose --profile restful_postgres up -d
- Add environment
cp env.example .env
- Run all required external dependency for development (databases)
$ docker compose up -d
- Run the app
$ go run main.go server
- (optional) See help of application
$ go run main.go server --help
- (optional) run app with different dependency
$ go run main.go server --server grpc --database mongo --log zap