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

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 18 Jan 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 0 Jan 19, 2022
: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.4k Jan 21, 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 29.6k Jan 19, 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 31 Jan 20, 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
🧹 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 30 Jan 17, 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 518 Jan 13, 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 32 Jan 3, 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 12, 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 16.2k Jan 18, 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 39 Jan 2, 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 2 Dec 31, 2021
Lux is a command-line interface for controlling and monitoring Govee lighting strips built in Go.

What is Lux? Lux is a command-line interface for controlling and monitoring Govee lighting strips built in Go. Lux provides it's users with the abilit

BanDev 33 Nov 27, 2021