Skip to main content
The Kratos CLI is an elegant toolkit for building Go microservices. It provides commands to scaffold new projects, generate code from proto files, run your services, and upgrade tooling.

Installation

Install the Kratos CLI using Go:
go install github.com/go-kratos/kratos/cmd/kratos/v2@latest
Verify the installation:
kratos --version

Available Commands

The Kratos CLI provides the following commands:

kratos new

Create a new service project from a template

kratos proto

Generate proto files and code from proto definitions

kratos run

Run your Kratos project locally

kratos upgrade

Upgrade Kratos tools and dependencies

kratos changelog

Get release notes and commit information

Quick Start

Create a new project and run it:
# Create a new service
kratos new myservice

# Navigate to the project
cd myservice

# Generate code
go generate ./...

# Build the project
go build -o ./bin/ ./...

# Run the service
kratos run

Getting Help

Get help for any command using the --help flag:
kratos --help
kratos new --help
kratos proto --help

Next Steps

Create Your First Service

Follow the tutorial to build your first microservice

Proto Guide

Learn how to define and generate APIs with Protocol Buffers

Build docs developers (and LLMs) love