There are no reviews yet. Be the first to send feedback to the community and the maintainers!
Repository Details
Example go clean architecture folder pattern
Golang Clean Architecture
The following is a folder structure pattern that I usually use, although I don't use all of them because of the project I'm working on only small projects that are not too big, so if you are interested in the pattern I made, you can use it if you think it's good, check this link for new update for this architecture here.
A collection of functions used to create a series of tests or run a test, be it unit testing or integration testing, which will later be used for the application itself.
Docker
Folder Name
Folder Status
Description
Docker
Optional
A collection of functions that are used to create a container for the application that has been created, which will later be used for the application itself.
Handlers
Folder Name
Folder Status
Description
Hanlders
Optional
A collection of functions used to handle all requests passed down from the client via routing, where later those requests will be forwarded to services and repositories for further processing, which will later be used for the application itself.
Repositorys
Folder Name
Folder Status
Description
Repositorys
Required
A collection of functions used to handle all requests given from handlers and services, which then those requests will be used to communicate with the database, which will later be used for the application itself.
Services
Folder Name
Folder Status
Description
Services
Required
A collection of functions that are used to forward requests given by handlers to repositories, which will later be used for the application itself.
Helpers
Folder Name
Folder Status
Description
Helpers
Optional
A collection of functions used to create utilities for application purposes, such as customError or customResponse, which will later be used for the application itself.
Middlewares
Folder Name
Folder Status
Description
Middlewares
Optional
A collection of functions that are used as a service for HTTP Requests such as authJWt, authRole, customLogger whether used per-route or used globally without the need to use them in each route, which will later be used for the application itself.
Models
Folder Name
Folder Status
Description
Models
Required
A collection of functions used to represent the table structure in a database, which will later be used for the application itself.
Routes
Folder Name
Folder Status
Description
Routes
Required
A collection of endpoints or addresses from the server itself, which is used for communication lines between the client and the server, which will later be used for the application itself.
Schemas
Folder Name
Folder Status
Description
Schemas
Required
A collection of functions that are used to represent the desired request structure, according to the requests required by the database, which will later be used for the application itself.
Templates
Folder Name
Folder Status
Description
Templates
Optional
A collection of functions that are used to output HTML code into emails to be used as templates, which will later be used for purposes such as activationCode or resetPassword, which will later be used for the application itself.
Pkg
Folder Name
Folder Status
Description
Pkg
Optional
A collection of functions that are used for the purpose of customizing a library into a separate function, which will later be used for the application itself.
Scripts
Folder Name
Folder Status
Description
Scripts
Optional
A collection of functions that are used to trigger a function from another function, such as importing a database from a .sql file into a container using docker, which will later be used for the application itself.
Configs
Folder Name
Folder Status
Description
Configs
Optional
A collection of functions that contains all the configurations related to the application needs, such as .env or serverless.yml, which will later be used for the application itself.
Cmd
Folder Name
Folder Status
Description
Cmd
Optional
A collection of functions that are used to interact directly with the terminal, usually used for purposes such as running database migrations or seeds, which will later be used for the application itself.
Crons
Folder Name
Folder Status
Description
Crons
Optional
A collection of functions that are used to trigger a desired function, according to the time specified by the user, which will later be used for the application itself.
Databases
Folder Name
Folder Status
Description
Databases
Optional
A collection of functions used to create migrations or seeds for the database, which will later be used for the application itself.
Command
Application Lifecycle
Install node modules
$ go get .|| go mod || make goinstall
Build application
$ go build -o main || make goprod
Start application in development
$ go run main.go | make godev
Test application
$ go test main.go main_test.go || make gotest
Docker Lifecycle
Build container
$ docker-compose build | make dcb
Run container with flags
$ docker-compose up -d --<flags name>| make dcu f=<flags name>
Run container build with flags
$ docker-compose up -d --build --<flags name>| make dcubf f=<flags name>