Onion-Layer-Golang - A web application boilerplate built with go and clean architecture

Overview

go-clean-architecture-web-application-boilerplate

A web application boilerplate built with go and clean architecture. Most of this application built by standard libray.

image

Get Started

cp app/.env_example app/.env docker-compose build docker-compose up

After running docker, you need to execute sql files in app/database/sql.

Architecture

app
├── database
│   ├── migrations
│   │   └── schema.sql
│   └── seeds
│       └── faker.sql
├── domain
│   ├── post.go
│   └── user.go
├── infrastructure
│   ├── env.go
│   ├── logger.go
│   ├── router.go
│   └── sqlhandler.go
├── interfaces
│   ├── post_controller.go
│   ├── post_repository.go
│   ├── sqlhandler.go
│   ├── user_controller.go
│   └── user_repository.go
├── log
│   ├── access.log
│   └── error.log
├── main.go
└── usecases
    ├── logger.go
    ├── post_interactor.go
    ├── post_repository.go
    ├── user_interactor.go
    └── user_repository.go

8 directories, 22 files
Layer Directory
Frameworks & Drivers infrastructure
Interface interfaces
Usecases usecases
Entities domain

API

ENDPOINT HTTP Method Parameters
/users GET
/user GET ?id=[int]
/posts GET
/post POST
/post DELETE ?id=[int]

Controller method naming rule

Controller Method HTTP Method Description
Index GET Display a listing of the resource
Store POST Store a newly created resource in storage
Show GET Display the specified resource
Update PUT/PATCH Update the specified resource in storage
Destroy DELETE Remove the specified resource from storage

Repository method naming rule

Repository Method Description
FindByXX Returns the entity identified by the given XX
FindAll Returns all entities
Save Saves the given entity
SaveByXX Saves the given entity identified by the given XX
DeleteByXX Deletes the entity identified by the given XX
Count Returns the number of entities
ExistsBy Indicates whether an entity with the given ID exists

cf. Spring Data JPA - Reference Documentation

Tests

I have no tests because of my laziness, but I will prepare tests in github - gobel-api which is a my more practical clean architecture application with golang.

References

Issues
  • does not build

    does not build

    Describe the bug does not build, halted building app container

    To Reproduce docker-compose build

    Expected behavior should have built

    Screenshots image

    Desktop (please complete the following information):

    • OS: ubuntu

    Additional context tried building code as is

    opened by MetaSteel 0
Owner
Endy Gigih Pratama
I am a student at UPN Veteran East Java specializing in information technology.
Endy Gigih Pratama
A tool to manage all your boilerplate from cli and generate files for you !

A tool to manage all your boilerplate from cli and generate files for you !

null 28 Jul 20, 2022
Softsuite - Start from gofiber boilerplate and plan to build large projects

Softsuite Thanks to Cozy (ItsCosmas) to build gofiber boilerplate. I start learn

Mai 4 Apr 25, 2022
A tool for exploring each layer in a docker image

dive A tool for exploring a docker image, layer contents, and discovering ways to shrink the size of your Docker/OCI image. To analyze a Docker image

Alex Goodman 33.3k Aug 18, 2022
tfuzz is a command-line tool to fuzz some layer 7 OSI protocols with a template file

tfuzz tfuzz is a command-line tool to fuzz some layer 7 OSI protocols with a template file download the linux binary executable (or you can compile fr

Noob0x 3 Sep 29, 2021
:zap: boilerplate template manager that generates files or directories from template repositories

Boilr Are you doing the same steps over and over again every time you start a new programming project? Boilr is here to help you create projects from

Tamer Tas 1.5k Aug 13, 2022
create boilerplate structure for neovim plugins

boilit Boil yourself a sweet plugin Installation • Usage Ain't nobody got time to create plugin directories: boilit yourself! boilit creates boilerpla

Gennaro Tedesco 43 Aug 15, 2022
archy is an static binary to determine current kernel and machine architecture, with backwards compatible flags to uname, and offers alternative output format of Go runtime (i.e. GOOS, GOARCH).

archy archy is an simple binary to determine current kernel and machine architecture, which wraps uname and alternatively can read from Go runtime std

xargs-dev 3 Mar 18, 2022
🧹 Safely clean up your local branches

gh poi A gh extension for deleting merged local branches. This extension checks the state of remote pull requests, so it works even when you "Squash a

Seito Tanaka 104 Aug 11, 2022
go-editor is the clean go module that refractors from Kubernetes to help you edit resources in a command-line way.

go-editor The source code of go-editor comes from Kubernetes and refractor as the clean Go module. You can embed go-editor in your command-line tool l

Yong 0 Dec 5, 2021
Generate High Level Cloud Architecture diagrams using YAML syntax.

A commandline tool that generate High Level microservice & serverless Architecture diagrams using a declarative syntax defined in a YAML file.

Luca Sepe 542 Aug 11, 2022
Architecture checks for Go projects

Arch-Go Architecture checks for Go projects Supported rules Dependencies Checks Supports defining import rules Allowed dependencies Not allowed depend

Francisco Daines 55 Jul 11, 2022
A CLI application that allows you to run a complete ToDo app from your terminal application

todo-cli This is a CLI application that allows you to run a complete ToDo app from your terminal application. As a user you can: Create a list of todo

Jonathan Reeves 0 Oct 11, 2021
Restful services on a Go application integrated with mongodb. Articles demo application.

article-app Restful Go services demo integrated with MongoDB by Cahit Ünver article-app is a GO application integrated with MongoDB. Application is a

Cahit Ünver 0 Jan 17, 2022
Simple todo app web application created with Go and MySQL.

TodoApp This is a project I've always wanted to do, it's simple, but to be says it involves to use different techniques in order to have a: authentica

null 1 Dec 21, 2021
Share your terminal as a web application

GoTTY - Share your terminal as a web application GoTTY is a simple command line tool that turns your CLI tools into web applications. Installation Dow

Iwasaki Yudai 17.1k Aug 16, 2022
Go-file-downloader-ftctl - A file downloader cli built using golang. Makes use of cobra for building the cli and go concurrent feature to download files.

ftctl This is a file downloader cli written in Golang which uses the concurrent feature of go to download files. The cli is built using cobra. How to

Dipto Chakrabarty 2 Jan 2, 2022
Fully featured Go (golang) command line option parser with built-in auto-completion support.

go-getoptions Go option parser inspired on the flexibility of Perl’s GetOpt::Long. Table of Contents Quick overview Examples Simple script Program wit

David Gamba 43 Jul 25, 2022
Gowget - A simple wget tool built using golang to download files from the internet whether it is zip

gowget wget built using golang About: A simple wget tool built using golang to d

Krisna Pranav 3 May 21, 2022