All Projects → nurcahyaari → golang-starter

nurcahyaari / golang-starter

Licence: MIT License
Golang code boilerplate inspired by clean architecture

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to golang-starter

Cleanarchitecture.workerservice
A solution template using Clean Architecture for building a .NET Core Worker Service.
Stars: ✭ 142 (+189.8%)
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 (+4563.27%)
Mutual labels:  architecture, clean-architecture
Android Clean Architecture Boilerplate
Apply clean architecture on Android
Stars: ✭ 141 (+187.76%)
Mutual labels:  architecture, clean-architecture
Swift Cleanarchitecture
Simple Swift project applying concepts inspired on the Clean Architecture
Stars: ✭ 133 (+171.43%)
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 (+479.59%)
Mutual labels:  architecture, clean-architecture
Go Clean Architecture
👨‍💻 REST API example, built by following Uncle Bob’s clean architecture principles
Stars: ✭ 133 (+171.43%)
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 (+5869.39%)
Mutual labels:  architecture, clean-architecture
Polysemycleanarchitecture
Showcasing how the Polysemy library can be used to implement a REST application conforming to the guidelines of the Clean Architecture model.
Stars: ✭ 106 (+116.33%)
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 (+51.02%)
Mutual labels:  architecture, clean-architecture
Archit Ios
Intelygenz iOS Architecture
Stars: ✭ 203 (+314.29%)
Mutual labels:  architecture, clean-architecture
Go Bank Transfer
Simple API for banking routines using a Clean Architecture in Golang. 💳 💰 💸
Stars: ✭ 123 (+151.02%)
Mutual labels:  architecture, clean-architecture
iOS-Clean-Architecture-Example
An iOS app designed using clean architecture and MVVM.
Stars: ✭ 50 (+2.04%)
Mutual labels:  architecture, clean-architecture
Rxviper
Android micro framework for developing apps based on clean VIPER architecture.
Stars: ✭ 112 (+128.57%)
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 (+4079.59%)
Mutual labels:  architecture, clean-architecture
Deptrac
Keep your architecture clean.
Stars: ✭ 1,784 (+3540.82%)
Mutual labels:  architecture, clean-architecture
Domain Driven Hexagon
Guide on Domain-Driven Design, software architecture, design patterns, best practices etc.
Stars: ✭ 4,417 (+8914.29%)
Mutual labels:  architecture, clean-architecture
Dev Stuff
😎 Programming stuff for everyone. Collection of articles, videos about architecture, Domain Driven Design, microservices, testing etc.
Stars: ✭ 105 (+114.29%)
Mutual labels:  architecture, clean-architecture
Android Kotlin Clean Architecture
Android Sample Clean Architecture App written in Kotlin
Stars: ✭ 1,562 (+3087.76%)
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 (+314.29%)
Mutual labels:  architecture, clean-architecture
Python-CleanArchitecture-Example
This project is a sample Python(Flask) web application adapting Clean Architecture.
Stars: ✭ 69 (+40.82%)
Mutual labels:  architecture, clean-architecture

golang-starter

Golang code boilerplate inspired by clean architecture

Alert

  • I migrated the structures, like adding infrastructures, move the config folder from internal/config into config/
  • I also don't test after the rewriting, when you clone it and try to implement to your projects, it might need some changes
  • the old version placed on dep-0.0.1 branch


Folder Structure

here how golang-started manage directory:

|-- config
|-- infrastructures
|-- internal
|   |-- middleware
|   |-- routes
|   |-- utils
|       |-- auth
|       |-- encryption
|   |-- web
|-- src

all global setting will place in internal folder all module will place in src

There is detailed article about folder structure written on medium by Ari

Config

Config modules for the app

Infrastructures

infrastructures store the infrastructure layer, such as database, database stored in infrastructures/db folder. If you use mysql, then just create a file called mysql.go and you must define your mysql modules here (it's a dependency). If you using redis in your project, create a cached folder then create a file called redis.go, and make your modules again. all examples was attached in this repo

Internal

Internal with their folders are using for the whole apps that will be needed to be a global function that will call in other modules. example:

we have a products modules with their controller, repo, service, routes, in the service we need a jwt for verification the jwt token. the jwt token function will be a callable function on other moduless, hence the jwt must be a global function

src

This boilerplate based on modules. eg: products modules, user modules, etc. and the modules have their structure based on clean architecture. controllers, models, repositories, services, routers. the flow is router -> controller -> service -> repository.

entities

entities is a struct to store any objects from database, example you have a products in your tables. then you must create your products.go in the entities folder, it's use to decode the data from database query and store it as a object

dto

it's similar with entities but the differents are:

  • don't define dto in repository, the repository is the responsibility of the entities
  • dto is usefull to get your request body, request params, or response your data to your rest api
example you have products.go as entities and its entities called as Products, and products_response.go as the dto and its dto called as ProductsResponseBody. the repositories will return the data as Products and the services will return it too, but if you want to sent your data as a json response, you should have used the ProductsResponseBody to response it.

router

All App Router eg: Http Router, RabbitMQ Queue, will defined here

Handlers

Handlers usefull to encode raw body, query params, make a response to client. note: make the controller based on the protocols eg: HTTP Handlers, RabbiqMQ controller, Grpc controller. and it also useful to convert entities to dto for responding to the data

Service

Service contains all of business logic, like creating a products, creating a users, validation products, validation for products quantity, run you transaction. note that if you have relations based on the modules example you have a product modules with order modules, when user make an order then product quantity must be reduced based on order quantity, so you must make a transaction in service

Repository

Repository contains all of database query

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].