Skip to content
This repository was archived by the owner on Dec 31, 2024. It is now read-only.

Latest commit

Β 

History

History
89 lines (84 loc) Β· 3.26 KB

File metadata and controls

89 lines (84 loc) Β· 3.26 KB

GO PROJECT LAYOUT STANDARD - ARCHITECTURE


#TREE

/_/ (master)
 drwxr-xr-x β”œβ”€β”€ .circleci
 -rw-r--r-- β”‚   └── config.yml
 drwxr-xr-x β”œβ”€β”€ api
 -rw-r--r-- β”‚   β”œβ”€β”€ .../*.go
 -rw-r--r-- β”‚   └── .../*.go
 drwxr-xr-x β”œβ”€β”€ bin
 -rw-r--r-x β”‚   └── binary.exec
 drwxr-xr-x β”œβ”€β”€ cmd
 drwxr-xr-x β”‚   └── application
 -rw-r--r-- β”‚   β”‚   └── main.go
 -rw-r--r-- β”‚   └── .../*.go
 drwxr-xr-x β”œβ”€β”€ configs
 -rw-r--r-- β”‚   β”œβ”€β”€ *.go
 -rw-r--r-- β”‚   β”œβ”€β”€ *.yaml
 -rw-r--r-- β”‚   └── *.json
 drwxr-xr-x β”œβ”€β”€ docs
 -rw-r--r-- β”‚   β”œβ”€β”€ *.xlsx
 -rw-r--r-- β”‚   β”œβ”€β”€ *.pdf
 -rw-r--r-- β”‚   β”œβ”€β”€ *.doc
 -rw-r--r-- β”‚   β”œβ”€β”€ *.yaml
 -rw-r--r-- β”‚   └── *.json
 drwxr-xr-x β”œβ”€β”€ internal
 -rw-r--r-- β”‚   β”œβ”€β”€ .../*.go
 -rw-r--r-- β”‚   └── .../*.go
 drwxr-xr-x β”œβ”€β”€ mocks
 -rw-r--r-- β”‚   β”œβ”€β”€ .../*.go
 -rw-r--r-- β”‚   └── .../*.go
 drwxr-xr-x β”œβ”€β”€ pb
 -rw-r--r-- β”‚   β”œβ”€β”€ .../*.go
 -rw-r--r-- β”‚   └── .../*.go
 drwxr-xr-x β”œβ”€β”€ pkg
 -rw-r--r-- β”‚   β”œβ”€β”€ .../*.go
 -rw-r--r-- β”‚   └── .../*.go
 drwxr-xr-x β”œβ”€β”€ proto
 drwxr-xr-x β”‚   β”œβ”€β”€ graphQL
 -rw-r--r-- β”‚   β”‚   └── .../*.go
 drwxr-xr-x β”‚   β”œβ”€β”€ gRPC
 -rw-r--r-- β”‚   β”‚   └── .../*.go
 drwxr-xr-x β”‚   β”œβ”€β”€ protobuf
 -rw-r--r-- β”‚   β”‚   └── .../*.go
 drwxr-xr-x β”‚   └── SOAP
 -rw-r--r-- β”‚       └── .../*.go
 drwxr-xr-x β”œβ”€β”€ script
 -rw-r--r-- β”‚   β”œβ”€β”€ .../*.sh
 -rw-r--r-- β”‚   β”œβ”€β”€ .../*.zsh
 -rw-r--r-- β”‚   └── .../*.bash
 drwxr-xr-x β”œβ”€β”€ test
 -rw-r--r-- β”‚   β”œβ”€β”€ .../*_test.go
 -rw-r--r-- β”‚   └── .../*_test.go
 -rw-r--r-- β”œβ”€β”€ .dockerignore
 -rw-r--r-- β”œβ”€β”€ .gitignore
 -rw-r--r-- β”œβ”€β”€ Dockerfile
 -rw-r--r-- β”œβ”€β”€ go.mod
 -rw-r--r-- β”œβ”€β”€ go.sum
 -rw-r--r-- β”œβ”€β”€ LICENSE
 -rw-r--r-- β”œβ”€β”€ Makefile
 -rw-r--r-- β”œβ”€β”€ README.md
 -rw-r--r-- └── tools.go

#DIRECTORIES:

  • .circle: contains all files config of circle CI/CD to run
  • cmd: contains all entry points of the application
  • configs: stores all the configurations of the application
  • docs: all the available documents of the application. (May be use 'Documents' to the same purpose).
  • internal: private packages of the project
  • pkg: public packages of the project
  • local: all the additional things that allow everyone to run your code in the local environment.
  • mocks: mocking stuff for unit testing your application
  • proto: protobuf definition for your microservices (I used it with the gRPC communication method for my company’s internal service communication, you can store another contract like jsonschema, graphQL or SOAP contract)
  • pb (maybe api): generated code from protobuf
  • test: for your microservices’ integration

#FILES:

  • Dockerfile & .dockerignore: containerize your application to make it perfectly easy to be runnable at any present infrastructure.
  • .git & .gitignore: git version control is currently the best choice for managing your project.
  • Makefile: create an incredibly convenient quick command.
  • README.md: definitely the soul of your project.
  • tools.go: add your go build tools dependency.

END