Skip to content

gRPC

gRPC is Gortexa’s native protocol. External connections arrive on the same h2c port; the mux dispatches on Content-Type: application/grpc to grpc-go’s ServeHTTP mode.

Services are defined in proto. The built-in sample resource:

service ResourceService {
rpc CreateResource(CreateResourceRequest) returns (Resource);
rpc GetResource(GetResourceRequest) returns (Resource);
rpc ListResources(ListResourcesRequest) returns (ListResourcesResponse);
rpc UpdateResource(UpdateResourceRequest) returns (Resource);
rpc DeleteResource(DeleteResourceRequest) returns (google.protobuf.Empty);
}

gortexa regen writes stubs to gen/; logic implementations live in internal packages. The two never mix.

For local grpcurl testing, enable reflection first (it is off by default):

Terminal window
GORTEXA_SERVER__REFLECTION=true gortexa run
Terminal window
grpcurl -plaintext \
-H 'authorization: Bearer <token>' \
-d '{"id":"x"}' \
localhost:8080 resource.v1.ResourceService/GetResource

Without a token you get UNAUTHENTICATED: auth treats all three protocols the same way.

The three-state health model maps to the standard gRPC Health protocol. Register real dependency checks with app.Health().Register(...) so /readyz and gRPC Health reflect actual DB, cache and MQ reachability. Each check runs under a 5-second timeout, so one slow dependency cannot stall the whole query.

gRPC reflection is off by default. Enable it via config or an environment variable when needed:

Terminal window
GORTEXA_SERVER__REFLECTION=true

Keep it off in production — see Deployment.