Golang REST API - Clean Architecture Principles

Image of Clean Architecture

Architecture Properties

  • Independent of Frameworks. The architecture does not depend on the existence of some library of feature laden software.
  • Testable. The business rules can be tested without the UI, Database, Web Server, or any other external element.
  • Independent of UI. The UI can change easily, without changing the rest of the system.
  • Independent of Database. You can swap out Oracle or SQL Server, for Mongo, BigTable, CouchDB, or something else.

Install Dependencies

go install

Build

go build

Run

go run .
go run *.go

Using Docker

Build The Image

docker image build -t yourname/gocleanarch .

Run the container

docker run -p 8000:8000 -d yourname/gocleanarch

Useage

Localhost