Skip to content

JunNishimura/clean-architecture-with-go

Repository files navigation

Template project of Clean-Architecture

This is a simple CRUD application build on a Clean-Architecture written in Golang.

🚩 DEMO

1. use Docker to set up an environment to run the application

> make init
> make up 

2. Call API by curl command

create

> curl -i -XPOST -d '{"title": "test", "body": "this is a test article"}' localhost:8080/articles

read

> curl -i -XGET localhost:8080/articles
> curl -i -XGET localhost:8080/articles/1

update

> curl -i -XPUT -d '{"title": "updated title", "body": "this article is updated"}' localhost:8080/articles/1

delete

> curl -i -XDELETE localhost:8080/articles/1

📖 Explanation

cleanarchitecture

layer directory
Enterprise Business Rules entities
Application Business Rules usecase
Interface Adapters adapter
Frameworks & Drivers driver

Enterprise Business Rules

Core business rules are implemented in this layer.

Application Business Rules

By describing the business logic API, this layer expresses what this software will achieve.

Interface Adapters

This layer describes the input(controller), output(presenter) and data presistence process(gateway).

Frameworks & Drivers

This layer describes establishing DB connections, configuring routing and using the framework.