Skip to content

TangJetsada123/cleango-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CLEANGO-TEMPLATE

A clean, minimal, and production-ready Go project template built with a Clean Architecture mindset. Designed to help teams and developers start building APIs/Services faster with a well-organized structure.

Installation & Dependencies

  • Initialize a Go module (if not already done):

    go mod init <module-name>
    
  • Download and install dependencies:

    go mod tidy
    
  • Verify Go version:

    go version
    

Use

  • Run the service
    go run ./cmd/main.go
    
  • for test
    go test ./...
    

Directory Hierarchy

|—— api
|    |—— route.go
|—— cmd
|    |—— main.go
|—— go.mod
|—— go.sum
|—— internal
|    |—— configs
|        |—— env.go
|    |—— domain
|        |—— model
|            |—— user_model.go
|    |—— handler
|        |—— user_handler.go
|    |—— repository
|        |—— user_repository.go
|—— pkg
|    |—— enum
|        |—— user_enum.go
|    |—— utils
|        |—— utils.go
|    |—— worker
|        |—— worker.go
  • cmd/ — The application's entry point (e.g., main.go)
  • api/ — Contains the router/routing setup (e.g., integration with frameworks such as Echo, Fiber, Gin, or net/http)
  • internal/configs/ — Configuration files and environment/config loaders
  • internal/domain/ — The domain layer (entities, domain models, and repository/business rule interfaces)
  • internal/handler/ — Adapters for handling HTTP requests (controllers/handlers)
  • internal/repository/ — Database connections and persistence implementations
  • pkg/ — Reusable code (enums, utility functions, background workers, etc.)

Note: If you want to add a Usecase/Service layer, place it between the domain and handler layers to contain business logic that is independent of transport or persistence.

References

About

A lightweight and easy-to-understand Go Clean Architecture Template.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages