buf-connect-playground

Playground environment primarily to play with the connect-go and connect-web ecosystem for Protobuf. To replicate certain aspects of a full-stack application, this playground also makes use of MongoDB in the form of a docker hosted container, OpenTelemetry using the otel sidecar to batch and send trace data to honeycomb, as well as docker-compose to make local development seamless across MacOS and Windows.

The basis for this playground is the proto folder that holds various .proto file definitions as well as buf.build files for declaring generation of both connect-go and connect-web API code for Go and TS respectively. The primary architecture of the application is a Go backend server that will handle connect-go requests, put together traces with spans at each step, and perform CRUD operations on a MongoDB instance. Additionally, this backend is capable of hosting the static files of the frontend client when built with the primary Dockerfile. The frontend is a very simple React app, started with Vite and using the generated connect-web API classes to make requests to the backend.

The results of this experiment left me very satisfied with gRPC as a whole. One of my earliest and most disappointing finds with gRPC is that because it uses HTTP/2, it is not compatible for use within browsers. The connect-go/connect-web ecosystem resolves this by allowing a singularly defined backend to host both base gRPC as well as the custom "connect-grpc" protocol that allows for POST-only HTTP/1 requests. With this setup, all the .proto files defined will generate code and types for both the backend and fronted and provide seamless connection between them.