with Fiber V2 Framework
The following is a folder structure pattern that I use Golang Clean Architecture - https://github.com/restuwahyu13/go-clean-architecture
- Go version 1.21 or above
- taskfile.dev - same
makefile
but config withyaml
file - Cobra-cli - create cli with project
- Swag Go - Swag converts Go annotations to Swagger Documentation 2.0.
-
Init Go Module
go mod init __your_project_name__
-
Replace
default.env
to.env
mv default.env .env
-
Change go import
github.com/attapon-th/template-fiber-api
to your go module -
Download Go Module
with
taskfile
task mod
or with
go mod
go mod download go mod tidy go mod vendor
-
migrate database
task migrate
Run dev
for start server dev mode:
task dev
Run swag
for generate swagger docs:
task swag
Run build
for build go binary file
(output directory: ./build/
)
task build
Run docker-build
fors Build Docker Image:
task docker-build