LinuxCommandLibrary

kitex

Generate code for Kitex RPC framework

TLDR

Generate client codes when a project is in $GOPATH

$ kitex [path/to/IDL_file.thrift]
copy

Generate client codes when a project is not in $GOPATH
$ kitex -module [github.com/xx-org/xx-name] [path/to/IDL_file.thrift]
copy

Generate client codes with protobuf IDL
$ kitex -type protobuf [path/to/IDL_file.proto]
copy

Generate server codes
$ kitex -service [svc_name] [path/to/IDL_file.thrift]
copy

SYNOPSIS

kitex [global-options] command [command-options] [arguments]
Example: kitex new my_service
Example: kitex update path/to/idl.thrift

PARAMETERS

--help
    Displays help information for the kitex command or a specific subcommand.

--version
    Prints the current version of the kitex CLI tool.

--verbose
    Enables verbose output, providing more detailed information during execution.

DESCRIPTION

kitex is a command-line interface (CLI) tool for the Kitex RPC framework, primarily developed by ByteDance for building high-performance Go-based microservices. It streamlines the development workflow by providing functionalities for code generation, project initialization, and updating existing services. The kitex command helps developers quickly set up new Kitex projects from IDL (Interface Definition Language) files like Thrift or Protobuf, generate boilerplate code, manage dependencies, and facilitate updates as service definitions evolve. It is an essential tool for developers working with the Kitex framework to ensure consistency and accelerate service development, focusing on efficiency and scalability in Go-based distributed systems.

CAVEATS

Not a standard Linux utility; it must be installed separately, typically via `go install`.
Requires a Go development environment to be set up.
Specifically designed for the ByteDance Kitex RPC framework; not applicable to other RPC technologies or general-purpose development.

SUBCOMMANDS

The kitex command operates primarily through a series of subcommands, each responsible for a specific task.
Common subcommands include:
new: Generates a new Kitex service project from an IDL.
update: Updates an existing Kitex service, typically regenerating code after IDL changes.
model: Generates Go struct models from IDL files.
idl: Manages IDL dependencies.
get: Fetches and installs Kitex related dependencies.
To get help for a specific subcommand, use kitex command --help (e.g., kitex new --help).

HISTORY

The kitex CLI tool is an integral part of the Kitex RPC framework, which was open-sourced by ByteDance. Developed internally to meet the demands of their large-scale microservice architecture, Kitex (and its accompanying CLI) was designed for high performance and ease of use within the Go ecosystem. Its development reflects ByteDance's extensive experience in building robust distributed systems, aiming to provide an efficient and developer-friendly solution for RPC communication in Go.

SEE ALSO

go(1), protoc(1), grpc-go

Copied to clipboard