go-clarch

module
v0.0.0-...-0cd5e05 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2023 License: MIT

README ΒΆ

GO CLARCH

Go Clean Architecture Boilerplate New to Clean Architecture? Learn Here

A familiar architecture is MVC, but MVC is not enough to be a highly agile business solution today Learn Here.

On the other hand, the fame of the existing framework becomes a kind of boundary for those who are not used to using a particular framework.

Changes to packages from third parties are also a challenge, such as changing the database from PostgreSql to Mongo.

Go Report Card

πŸ“– Contains

🍰 The Layer

Layer Directory
Frameworks & Drivers /app/infra
Interface /app/interfaces
Usecases /app/usecases
Entities /app/domain

🧐 The Questions

  • Why placing all layer to one folder (app)? Β 

    πŸ₯• Bcs using this infrastructure (clean architecture), we must highlight the 4 layer in folder and ensure the concept is clean (no other file or folder).

  • Why using json validator than others for request validator? Β 

    πŸ₯• Request validator have several option u can see here. We use go-playground/validator because is very simple and clean, bcs just put in json tag, that(json tag) is familiar in go.

  • Why separate file interface, implementation in Usecase and Frameworks & Drivers layer? Β 

    πŸ₯• The concept come from Bridge Design Pattern, in Usecase imagine u have 2 user (student and teacher) with same action but different behavior (bcs business rules), in Frameworks & Drivers imagine u must transition change the db from Postgres to Mongo.

⚑ Fiber Go

We use fiber for routing and more, you can change whatever you like (echo, gin, chi, etc). Why fiber? learn here

🌊 Air

If you familiar with nodemon in nodejs, air is exactly same. Provide hot reloading when files change with auto build.

Visit: https://github.com/cosmtrek/air for installation guide

πŸ§ͺ Debugger

If you come from PHP maybe you use var_dump(), if u from javasript maybe u use console.log(), in GO u can use fmt.Println() or u can use logging with log.Println().

But if u don't know before, using debugger is awesome and helpful (If u use VS Code), u just go to debug and run the debugger. The config in .vscode in the project. Wanna try? Learn here

πŸ“š References

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL