Header Background Header Background Header Background Header Background Sebastian

How the Project Started

Infographic: How the Project Started

In recent years, I have worked a lot with gRPC and ProtoBuf—the clear definition of services and models with automatic, type-safe stub generation for many languages has always thrilled me.

The Challenge with RESTful APIs

However, for purely RESTful APIs, gRPC is often not ideal. I tried gRPC Gateway, but particularly in Go, the approach felt too heavyweight.

Discovering TypeSpec

Since I started using TypeSpec, writing API specifications has become significantly more enjoyable than handcrafted OpenAPI files. The generated OpenAPI specs are solid and give me everything I need.

The Drawback of Code Generation

The catch lies in code generation: While TypeScript clients are usually usable, the results for Go—both on the client and server side—were disappointing. Satisfactory, idiomatic, clean Go code could not be generated from it, which is why I have often manually transferred server and client implementations until now.

This works as long as specs remain stable, but it remains an avoidable source of errors and costs unnecessary time.

The Extended Goal

My goal goes further: From a TypeSpec definition, I want to generate not only better clients but above all clean server stubs as well as additional tooling—such as a CLI client for interactive testing and a mock server for integration tests.

A New Approach

Initial experiments with my own TypeSpec emitter were promising. Instead of solving everything in one pass, I opted for a cleaner path: an intermediate format that contains all relevant information, and building upon that, a Go AST generator for real, maintainable Go code—without string templates.

From this, Spec CLI is taking shape step by step.