Home
Features
Jzero, a low-code scaffold developed based on go-zero, aims to accomplish more with fewer commands, but jzero is not limited to the go-zero framework. In theory, it can support any framework through the template function, depending on how you use it.
The project can create projects with one click and support different usage scenarios, such as grpc projects, gateway projects, api projects, and command line projects. Through the project's descriptive files (such as proto, api, sql, etc.), you can generate server code, client code, and database code with one click.
jzero has the following features:
- Minimal commands, control the parameters of different commands through the configuration file .jzero.yaml
- With development templates for different scenarios, it has the ability to quickly copy projects
- Optimize the existing pain points of go-zero and expand new features, and be fully compatible
- The template feature supports adding any file, and based on the template feature, it can theoretically support any framework
Optimization points in the following scenarios:
API scenario
- Support types File grouping (native goctl puts all the types generated by api files into a single file types.go, causing the file to explode)
- Write multiple api files, no need to explicitly write a main.api file, the framework automatically handles it
- Default integration of
https://github.com/go-playground/validator
validation framework
rpc scenario
- Support multiple proto, automatic registration, no need to write manually
- Default support for proto message field validation, and support for custom error messages
- Default support for adding interceptors through proto, you can set a certain method, or you can set the entire service
gateway scenario
- Default support for adding rpc + gateway projects
- Add interface version control features, the default is v1, you can initialize v2, v3 and other versions of the interface with one click, no configuration required
- Default support for adding interceptors and http middleware through proto, you can set a certain method, or you can set the entire service
database scenario
- Replace native sql with sqlbuilder, So that different database types can be better supported
- Expand new abstract methods to improve development efficiency, no longer a simple addition, deletion, modification and query, gradually expand, and have capabilities similar to orm
Client scenarios:
- Automatically generate swagger json through api/proto files, and built-in swagger ui
- Automatically generate http client through api/proto files
- Automatically generate zrpc client through proto files
Quick start
Windows users please execute all instructions under powershell
# One-click project creation
docker run --rm -v ${PWD}:/app ghcr.io/jzero-io/jzero:latest new your_project
cd your_project
# One-click code generation
docker run --rm -v ${PWD}:/app ghcr.io/jzero-io/jzero:latest gen
# Download dependencies
go mod tidy
# Start the project
go run main.go server
# Install jzero
go install github.com/jzero-io/jzero@latest
# Install the required tools in one click
jzero check
# Create a project in one click
jzero new your_project
cd your_project
# Generate code in one click
jzero gen
# Download dependencies
go mod tidy
# Start the server program
go run main.go server