Components

📄️ API Definition

Kratos implements REST and gRPC as the transport protocols. We mainly follow the [API Design Guide](https://cloud.google.com/apis/design/) from Google. You could define REST API and gRPC API in proto files and generate Go codes from these files.

📄️ Configuration

Kratos configuration supports multiple sources, and the config will be merged into map[string]interface{}, then you can get the value content through Scan or Value.

📄️ Encoding

We’ve abstracted the Codec interface to unify the serialization/deserialization logic for processing requests, and you can implement your own Codec to support more formats. The specific source code is in encoding。

📄️ Errors

You can define errors in protos and generate enums with protoc-gen-go.

📄️ Logger

Kratos contains only the simplest Log interface for business-adapted log access. When your business logic needs to use custom logs inside the kratos framework, you only need to implement the Log method simply.

📄️ Metadata

Microservices interact with each other via HTTP and gRPC API, so the service architecture should use unified Metadata transmission.

📄️ Metrics Interface

📄️ Registry Interface

📄️ Routing and Load Balancing

The main interface for routing and load balancing is Selector, but a default Selector implementation is also provided in the same directory. This implementation can implement node weight calculation, route filtering, and load balancing algorithms by replacing NodeBuilder, Filter, Balancer, and Pluggable

🗃️ Middleware

🗃️ Transport