Mangokit is a Go tool that helps you generate web projects based on a predefined project structure. It utilizes the Gin framework, Proto files for defining HTTP handlers and errors, and Wire for dependency injection.
- Generate a web project with a predefined project structure.
- Utilize the Gin framework for building robust and performant web applications.
- Define HTTP handlers and errors using Proto files for easy API contract management.
- Implement dependency injection using Wire for cleaner and more modular code.
git clone github.com/mangohow/mangokit
cd mangokit && make install
other tools:
# install proto-gen-go
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
# install wire
go install github.com/google/wire/cmd/wire@latest
# make sure you have protoc
To get started with Mangokit, follow these steps:
- Create a new web project:
mangokit create {projectFileName} {goModName}
. cd {projectFileName} && go mod tidy
- Generate go files from proto files:
mangokit generate proto {protoDir}
- Generate openapi from proto files:
mangokit generate openapi {protoDir}
. - Generate wire:
mangokit generate wire
. - Add a proto api:
mangokit add api {path} {protoName}
. - Add a proto error:
mangokit add error {path} {protoName}
.
mangokit create helloworld github.com/xxx/helloworld
cd helloworld && go mod tidy
go run cmd/server/main.go cmd/server/wire_gen.go
Mangokit provides the following commands:
mangokit create
: Generate a new web project based on the predefined structure.mangokit generate
: Generate go files or openapi from proto files and wire.mangokit add
: Add proto files, makefile and Dockerfile.