Skip to content

RPC Specification

RPC services are defined using standard Protocol Buffers (.proto) files.

Overview

Proto files describe:

  • Messages - Request and response structures
  • Services - RPC methods and signatures
  • Enums - Enumerated types
  • Options - Go package and other metadata

Quick Example

protobuf
syntax = "proto3";

package user;
option go_package = "user";

message GetUserRequest {
  int64 id = 1;
}

message User {
  int64 id = 1;
  string name = 2;
  string email = 3;
  int64 created_at = 4;
}

message ListUsersRequest {
  int32 page = 1;
  int32 page_size = 2;
}

message ListUsersResponse {
  repeated User users = 1;
  int32 total = 2;
}

service UserService {
  rpc GetUser(GetUserRequest) returns (User);
  rpc ListUsers(ListUsersRequest) returns (ListUsersResponse);
}

Documentation

Generated Code

When you run ss rpc gen, the following is generated:

ComponentLocationDescription
Proto Typeskitex_gen/<pkg>/Generated protobuf code
Serverinternal/server/Service implementation
Logicinternal/logic/Business logic layer
Configinternal/config/config.goConfiguration struct
Entrycmd/main.goServer entry point

Released under the MIT License.