Project generator for go backend architecture using goserve framework
Check out goserve framework github.com/unusualcodeorg/goserve
-
Download the goservegen binary for your operating system from the goservegen latest release: github.com/unusualcodeorg/goservegen/releases
-
Expand the compressed file (Example: Apple Mac M2: goservegen_Darwin_arm64.tar.gz)
-
Run the binary
cd ~/Downloads/goservegen_Darwin_arm64
# ./goservegen [project directory path] [project module]
./goservegen ~/Downloads/example github.com/yourusername/example
Note:
./goservegen ~/Downloads/example github.com/yourusername/example
will generate project namedexample
located at~/Downloads
and modulegithub.com/yourusername/example
-
Open the generated project in your IDE/editor of choice
-
Have fun developing your REST API server!
.
├── .extra
│ └── setup
│ └── init-mongo.js
├── api
│ └── sample
│ ├── dto
│ │ └── create_sample.go
│ ├── model
│ │ └── sample.go
│ ├── controller.go
│ └── service.go
├── cmd
│ └── main.go
├── config
│ └── env.go
├── keys
│ ├── private.pem
│ └── public.pem
├── startup
│ ├── indexes.go
│ ├── module.go
│ ├── server.go
│ └── testserver.go
├── utils
│ └── convertor.go
├── .env
├── .test.env
├── .gitignore
├── .dockerignore
├── Dockerfile
├── docker-compose.yml
├── go.mod
└── go.sum
docker-compose up --build
curl --location 'http://localhost:8080/sample/ping'
Response
{
"code": "10000",
"status": 200,
"message": "pong!"
}
You can read about using this framework here github.com/unusualcodeorg/goserve
How to Architect Good Go Backend REST API Services
Sometimes your operating system will block the binary from execution, you will have to provide permission to run it.
In Mac you have to go System Settings > Privacy & Security > Allow goservegen