Skip to content

daikieng/clean_arch_go

Repository files navigation

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

Clean Architecture In Go

This is a backend development of REST API in Go with Clean Architecture pattern.
Explore the docs »

View Demo

Table of Contents
  1. About The Project
  2. Getting Started
  3. License
  4. Contact

About The Project

In this project, I aimed to achieve the followings below;

  1. Refactor the code (see the original code) to follow the clean architecture properly.
  2. Inspect its testability and maintainability to demonstrate that this architecture is suitable for backend development in Go.
  3. Create a file generator utility that allows to generate files that follow the clean architecture pattern.
  4. Build CI, using Github Action to automate some of the testings.

List of game screens:

ゲーム画面

(back to top)

Screen Transition Diagram 画面遷移図

Built With

(back to top)

Getting Started

This is an instruction of how to set up and start the project locally. To get a local copy up and running follow these simple steps.

Prerequisites

This is an example of how to list things you need to use the software and how to install them.

  • Install Go

    Follow the steps shown in this website

Installation

  1. Clone this repo
    git clone https://github.com/daikidev111/clean_arch_go/
  2. Install goimports and golangci-lint
    make local-install

Running MySQL, Redis, PHPMyAdmin, Swagger, Proxy containers with docker-compose

  docker-compose up -d
  
  The list of containers should be like this.
  
             Name                         Command               State                 Ports              
-------------------------------------------------------------------------------------------------------
clean_arch_go_mysql_1        docker-entrypoint.sh mysql ...   Up      0.0.0.0:3306->3306/tcp, 33060/tcp
clean_arch_go_phpmyadmin_1   /docker-entrypoint.sh apac ...   Up      0.0.0.0:4000->80/tcp             
clean_arch_go_proxy_1        /docker-entrypoint.sh ngin ...   Up      0.0.0.0:3010->3010/tcp, 80/tcp   
clean_arch_go_redis_1        docker-entrypoint.sh redis ...   Up      0.0.0.0:6379->6379/tcp           
clean_arch_go_swagger-ui_1   /docker-entrypoint.sh sh / ...   Up      80/tcp, 127.0.0.1:3000->8080/tcp

Check if golangci-lint and gofmt work

gofmt is a tool that automatically formats the Go source code.

make fmt

golangci-lint is a tool that checks if the source code follows the coding standard.

make lint

Initiate the API

go run ./cmd/main.go

Execute the /user/create API, using the Curl command shown below;

curl -X 'POST' \
'http://localhost:8080/user/create' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"name": "Joji"
}'

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Daiki Kubo - LinkedIn

Project Link: https://github.com/daikidev111/clean_arch_go/

(back to top)

About

This is a backend development of REST API in Go with Clean Architecture pattern.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors