All Projects → roblaszczak → Go Cleanarch

roblaszczak / Go Cleanarch

Licence: mit
Clean architecture validator for go, like a The Dependency Rule and interaction between packages in your Go projects.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Go Cleanarch

Archit Ios
Intelygenz iOS Architecture
Stars: ✭ 203 (-53.23%)
Mutual labels:  architecture, clean-architecture
Go Clean Arch
Go (Golang) Clean Architecture based on Reading Uncle Bob's Clean Architecture
Stars: ✭ 5,128 (+1081.57%)
Mutual labels:  architecture, clean-architecture
from-fat-controllers-to-use-cases
Rails (API) app that shows different kinds of architecture (one per commit), and in the last one, how to use the Micro::Case gem to handle the application business logic.
Stars: ✭ 74 (-82.95%)
Mutual labels:  architecture, clean-architecture
Clean Architecture Swiftui
SwiftUI sample app using Clean Architecture. Examples of working with CoreData persistence, networking, dependency injection, unit testing, and more.
Stars: ✭ 2,925 (+573.96%)
Mutual labels:  architecture, clean-architecture
Kotlin Modular Tdd Coroutines Mvvm
A sample Kotlin app which was built with modular structure, Kotlin DSL, Kotlin Coroutines, TDD and MVVM patterns.
Stars: ✭ 256 (-41.01%)
Mutual labels:  architecture, clean-architecture
Architecture
.NET 6, ASP.NET Core 6, Entity Framework Core 6, C# 10, Angular 13, Clean Code, SOLID, DDD.
Stars: ✭ 2,285 (+426.5%)
Mutual labels:  architecture, clean-architecture
Python-CleanArchitecture-Example
This project is a sample Python(Flask) web application adapting Clean Architecture.
Stars: ✭ 69 (-84.1%)
Mutual labels:  architecture, clean-architecture
Android Modular Architecture
📚 Sample Android Components Architecture on a modular word focused on the scalability, testability and maintainability written in Kotlin, following best practices using Jetpack.
Stars: ✭ 2,048 (+371.89%)
Mutual labels:  architecture, clean-architecture
golang-starter
Golang code boilerplate inspired by clean architecture
Stars: ✭ 49 (-88.71%)
Mutual labels:  architecture, clean-architecture
archunit-junit5-kotlin
Generic Architecture Tests written in Kotlin using ArchUnit and Junit5
Stars: ✭ 22 (-94.93%)
Mutual labels:  architecture, clean-architecture
Domain Driven Hexagon
Guide on Domain-Driven Design, software architecture, design patterns, best practices etc.
Stars: ✭ 4,417 (+917.74%)
Mutual labels:  architecture, clean-architecture
Cleanarchitecturerxswift
Example of Clean Architecture of iOS app using RxSwift
Stars: ✭ 3,256 (+650.23%)
Mutual labels:  architecture, clean-architecture
Android Clean Architecture Boilerplate
Apply clean architecture on Android
Stars: ✭ 141 (-67.51%)
Mutual labels:  architecture, clean-architecture
Android Mvp Architecture
🏛 A basic sample android application to understand MVP in a very simple way. Just clone, build, run and understand MVP.
Stars: ✭ 203 (-53.23%)
Mutual labels:  architecture, clean-architecture
Cleanarchitecture.workerservice
A solution template using Clean Architecture for building a .NET Core Worker Service.
Stars: ✭ 142 (-67.28%)
Mutual labels:  architecture, clean-architecture
bitcoin-market-android
Bitcoin Market app shows you the current Bitcoin market price and price chart of different time intervals 💰
Stars: ✭ 284 (-34.56%)
Mutual labels:  architecture, clean-architecture
Swift Cleanarchitecture
Simple Swift project applying concepts inspired on the Clean Architecture
Stars: ✭ 133 (-69.35%)
Mutual labels:  architecture, clean-architecture
Go Clean Architecture
👨‍💻 REST API example, built by following Uncle Bob’s clean architecture principles
Stars: ✭ 133 (-69.35%)
Mutual labels:  architecture, clean-architecture
iOS-Clean-Architecture-Example
An iOS app designed using clean architecture and MVVM.
Stars: ✭ 50 (-88.48%)
Mutual labels:  architecture, clean-architecture
Cleanaspnetcorewebapi
Starter project for creating APIs built on ASP.NET Core using clean architecture.
Stars: ✭ 279 (-35.71%)
Mutual labels:  architecture, clean-architecture

Clean Architecture checker for Golang

Go Report Card

go-cleanarch was created to keep Clean Architecture rules, like a The Dependency Rule and interaction between modules in your Go projects. For more information you should read our article about Clean Architecture.

Some benefits of using Clean Architecture:

  1. Independent of Frameworks. The architecture does not depend on the existence of some library of feature laden software. This allows you to use such frameworks as tools, rather than having to cram your system into their limited constraints.
  2. Testable. The business rules can be tested without the UI, Database, Web Server, or any other external element.
  3. Independent of UI. The UI can change easily, without changing the rest of the system. A Web UI could be replaced with a console UI, for example, without changing the business rules.
  4. Independent of Database. You can swap out Oracle or SQL Server, for Mongo, BigTable, CouchDB, or something else. Your business rules are not bound to the database.
  5. Independent of any external agency. In fact your business rules simply don’t know anything at all about the outside world.

Source: The Clean Architecture

Clean Architecture

Project schema requirements

go-cleanarch assumes this files structure:

[GOPATH]/[PACKAGE_NAME]/[LAYER_NAME]

or

[GOPATH]/[PACKAGE_NAME]/[MODULE_NAME]/[LAYER_NAME]

For example

  • go/src/github.com/roblaszczak/awesome-app
    • auth
      • domain
      • application
      • interfaces
    • content
      • domain
        • submodule1
        • submodule2
        • etc.
      • application
      • interfaces
    • frontend
      • domain
      • application
      • interfaces

Allowed LAYER_NAME:

The default layer names are as followed. It is possible to set different names by command line parameters see -domain/-application/-interfaces/-infrastructure bellow.

var LayersAliases = map[string]Layer{
    // Domain
    "domain":   LayerDomain,
    "entities": LayerDomain,

    // Application
    "app":         LayerApplication,
    "application": LayerApplication,
    "usecases":    LayerApplication,
    "usecase":     LayerApplication,
    "use_cases":   LayerApplication,

    // Interfaces
    "interfaces": LayerInterfaces,
    "interface":  LayerInterfaces,
    "adapters":   LayerInterfaces,
    "adapter":    LayerInterfaces,

    // Infrastructure
    "infrastructure": LayerInfrastructure,
    "infra":          LayerInfrastructure,
}

For examples please go to examples directory, with contains examples of valid and invalid architectures.

For more information you should read our article about Clean Architecture.

Installing

GO111MODULE=on go get github.com/roblaszczak/go-cleanarch

go-cleanarch was only tested on Linux and also should work on OS X. Probably it doesn't work well on Windows.

Running

To run in the current directory:

go-cleanarch

To run in provided directory

go-cleanarch go/src/github.com/roblaszczak/awesome-cms

Process will exit with code 1 if architecture is not valid, otherwise it will exit with 0.

-ignore-tests

If you need to ignore *_test.go files in go-cleanarch check you can pass -ignore-tests

go-cleanarch -ignore-tests

It is useful when you have memory implementation in infrastructure layer and you need to test application service which depends of it.

-ignore-package

If for some reason you need to allow to make forbidden import, for example

github.com/roblaszczak/go-cleanarch/examples/ignore-package/app to github.com/roblaszczak/go-cleanarch/examples/ignore-package/domain.

you can use

go-cleanarch -ignore-package=github.com/roblaszczak/go-cleanarch/examples/ignore-package/app 

Layer names

The layer names can be set to a specific value with the following parameters. Each parameter stands for on layer.

go-cleanarch -domain dom -application appli -interfaces int -infrastructure outer

This would only allow the domain name to be dom, application hast to be appli, interafces must be int and infrastructure must be outer.

Running the tests

make test

And coding style tests

make qa

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Credits

Made without love by Robert Laszczak </3

License

This project is licensed under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].