Universal schema translator for LLM microservices. Automated code generation for Go, TypeScript, and Python clients.
- Quick Start
- Installation
- Project Structure
- Usage Examples
- Code Generation
- Design Conventions
- API Evolution Rules
- Testing
- Development Workflow
- CI/CD Pipeline
- Prerequisites
- Contact & Support
- References
git clone https://github.com/spounge-ai/spounge-proto
cd spounge-proto
make docker-setup | Language | Command |
|---|---|
| Go | go get github.com/spoungeai/spounge-proto@latest |
| TypeScript | npm install @spounge/proto-ts |
| Python | pip install spounge-proto-py |
proto/
├── <domain>/<version>/ # Domain definitions (auth/v1/)
├── common/v1/ # Shared definitions
└── api/v1/ # API Gateway definitions
gen/ # Generated code
├── go/ # Go protobuf + gRPC/Connect
├── ts/ # TypeScript + Connect-Web
├── py/ # Python protobuf
└── openapi/ # OpenAPI specs
Go Client
package main
import (
"context"
"log"
"time"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/metadata"
apiv1 "github.com/spounge-ai/spounge-protos/gen/go/api/v1"
authv1 "github.com/spounge-ai/spounge-protos/gen/go/auth/v1"
)
func main() {
conn, err := grpc.Dial("localhost:8080",
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithBlock())
if err != nil {
log.Fatalf("connection failed: %v", err)
}
defer conn.Close()
client := apiv1.NewAuthGatewayServiceClient(conn)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
ctx = metadata.AppendToOutgoingContext(ctx,
"authorization", "Bearer your_token",
"x-request-id", "unique-request-id")
req := &apiv1.AuthGatewayServiceLoginRequest{
LoginRequest: &authv1.LoginRequest{
Email: "[email protected]",
Password: "SecurePassword123",
},
}
res, err := client.Login(ctx, req)
if err != nil {
log.Fatalf("login failed: %v", err)
}
log.Printf("Token: %s", res.GetLoginResponse().GetToken())
}TypeScript Client
import { createConnectTransport } from '@bufbuild/connect-web';
import { AuthGatewayServiceClient } from '../gen/ts/api/v1/auth_gateway_service.client';
import { AuthGatewayServiceLoginRequest } from '../gen/ts/api/v1/auth_gateway_service';
import { LoginRequest } from '../gen/ts/auth/v1/auth_service';
const transport = createConnectTransport({
baseUrl: 'http://localhost:8080',
interceptors: [
(next) => async (req) => {
req.header.set('Authorization', 'Bearer YOUR_TOKEN');
return next(req);
},
],
});
const client = new AuthGatewayServiceClient(transport);
async function login() {
try {
const request = new AuthGatewayServiceLoginRequest({
loginRequest: new LoginRequest({
email: '[email protected]',
password: 'SecurePassword!',
}),
});
const response = await client.login(request);
console.log('Token:', response.loginResponse?.token);
} catch (error) {
console.error('Login failed:', error);
}
}| Command | Purpose |
|---|---|
make gen |
Generate all clients |
make gen-go |
Go only |
make gen-ts |
TypeScript only |
make gen-py |
Python only |
make docker-gen |
Docker-based generation |
| Element | Convention | Example |
|---|---|---|
| Packages | lower.snake.case |
api.v1 |
| Services | PascalCase + Service |
AuthGatewayService |
| RPC Methods | PascalCase |
Login, GetUserProfile |
| Messages | ServiceMethodRequest/Response |
AuthGatewayServiceLoginRequest |
| Fields | lower_snake_case |
workflow_id |
| Enums | PascalCase |
ExecutionStatus |
| Enum Values | PREFIX_VALUE_NAME |
EXECUTION_STATUS_PENDING |
repeated- Arrays/listsoptional- Nullable scalars (recommended for new fields)oneof- Mutually exclusive field groups
| ✅ Allowed | ❌ Breaking Changes |
|---|---|
| Add new fields, services, methods | Remove/rename fields, services, methods |
Add optional fields |
Change field types or numbers |
| Add enum values (append only) | Reorder enum values |
gRPC Testing
# List services
grpcurl localhost:8080 list
# Test RPC
grpcurl -plaintext -d '{
"loginRequest": {
"email": "[email protected]",
"password": "password"
}
}' localhost:8080 api.v1.AuthGatewayService/LoginHTTP/REST Testing
curl -X POST \
-H "Content-Type: application/json" \
-d '{"loginRequest": {"email": "[email protected]", "password": "password"}}' \
http://localhost:8080/v1/auth/login| Command | Purpose |
|---|---|
make test-go |
Go integration tests |
make test-ts |
TypeScript client tests |
make test-py |
Python client tests |
- Edit
.protofiles following conventions buf format -w proto/- Formatmake lint- Lintmake gen- Generatemake test- Test- Commit (include generated code)
- Protobuf linting (
buf lint) - Breaking change detection (
buf breaking --against origin/main) - Code generation verification
- Client library testing
| Tool | Version | Installation |
|---|---|---|
| Go | 1.24+ | go.dev/doc/install |
| Node.js | LTS | nodejs.org |
| protoc | v30+ | protobuf.dev/installation/ |
| buf | v2.x.x+ | docs.buf.build/installation |
| Docker | Latest | docs.docker.com/get-docker |
- Issues: GitHub Issues
- Support: [email protected]
- License: MIT
Documentation Links
Protocol Buffers & gRPC
Buf Ecosystem
Connect & Gateway
API Design