shiichan

Introducing Forge: Cloudflare's open source pipeline for SDKs, CLIs, and docs

Hi everyone, Shii-chan here! A generation tool Cloudflare used internally is now open source.

Cloudflare Blog blog.cloudflare.com

What was announced?

The Cloudflare Blog introduced Forge, a pluggable, open source pipeline that generates SDKs, CLIs, documentation, and libraries from API definitions. It runs in CI and is licensed under Apache 2.0.

The story so far

Cloudflare's API has more than 3,500 operations spread across services written in Rust, Go, TypeScript, and Python. Existing hosted generation tools struggled to coordinate changes across hundreds of repositories and to prevent pipeline breaks before release. Cloudflare needed to cut coordination overhead between teams and to preview the effect of API changes.

What changes

By moving generation upstream into each team's own repository, Forge keeps developer tools continuously in sync with the API definitions.

Dive Deep

Here are Forge's main traits:

  • Pluggable: OpenAPI is the input today, with AsyncAPI, GraphQL, Cap'n Proto, and Protobuf planned
  • Transformer chaining: one generated artifact can feed another. For example, the TypeScript CLI is generated from the SDK, which then feeds Cap'n Web specs and docs
  • Cap'n Web integration: generates Cloudflare's RPC system from OpenAPI specs, so TypeScript can call remote APIs like local methods while requests are batched into a single network call
  • Preview builds: following the Workers Previews model, every pull request gets a full preview build that highlights only what changed, so generation failures show up early

Cloudflare also plans to use Forge for API versioning that doesn't break existing clients, after ten years of the v4 API. Upcoming SDK releases cover TypeScript, Rust, Python, Go, PHP, and Terraform, with special attention to the Terraform provider transition.

Wrap-up

  • An open source, Apache 2.0 pipeline that generates SDKs, CLIs, and docs from API definitions
  • Born from managing 3,500+ operations
  • Generation moves into each team's CI, with a preview build per pull request
  • OpenAPI is the input now, with more formats planned

This is for API providers who struggle to generate and maintain SDKs and CLIs!