deniz.in

Markets

Weather

Loading weather

· via Cloudflare blog

Cloudflare open-sources Forge, a pluggable pipeline for generating SDKs, CLIs and docs

Cloudflare has released Forge under Apache 2.0, an open source generation pipeline that already produces the cf CLI and will soon power its SDKs and API documentation.

Cloudflare open-sources Forge, a pluggable pipeline for generating SDKs, CLIs and docs

Cloudflare has open-sourced Forge, a pluggable pipeline for generating SDKs, CLIs and documentation from API specifications. According to the company's blog post, Forge already produces the output behind the cf CLI, and over the coming months it will also drive Cloudflare's API documentation, SDKs and other generated surfaces. The project is released under the permissive Apache 2.0 licence and can be deployed and run for free.

Why Cloudflare built it

Cloudflare's API spans more than 3,500 operations, and the hundreds of services behind it are written in a mix of languages including Rust, Go, TypeScript and Python. When the company set out to build a CLI covering its entire API, alongside SDKs and docs, it needed a generation pipeline flexible enough to handle that scale across many teams and repositories.

Cloudflare says it previously relied on hosted code-generation products, but none of them solved the problem and some have shut down entirely. In practice, one team would merge an API change that silently broke the generation pipeline, and another team would only discover the breakage at release time. Coordination overhead between teams and vendors became a tax.

Forge takes a different approach: it runs in CI inside each team's API repository, much like a test pipeline. It lints every change and generates preview builds of the CLI, docs and SDKs containing only that change, which the author can install and test before merging.

Pluggable and chainable generators

Forge accepts OpenAPI as an input format today, and Cloudflare says the design is meant to accommodate AsyncAPI, GraphQL, Cap'n Proto, Protobuf and other formats later. Generators are pluggable: Cloudflare ships CLI, SDK and docs generators, but a transformer can be added to produce a library-specific package or, in principle, a full application.

A distinctive feature is chaining, where one target's output feeds another. Cloudflare's original OpenAPI definition is embedded in its TypeScript SDK, which in turn is used to generate the cf CLI and Cap'n Web specifications. Other generators often hardcode such chains, for example deriving CLI and Terraform targets from a Go SDK, but Forge puts the user in control of the chain. That matters to Cloudflare because its own CLI is written in TypeScript, a language most SDK generators do not chain from.

CLIs also behave differently from SDKs, the post notes. They contain handwritten, local-only commands that have no backing API call, such as cf dev and cf build, which call into TypeScript packages like Vite. Cloudflare wants those handwritten commands folded back into generated documentation alongside everything else, and says no existing tool does this today, so it is building the capability into Forge.

Built with agents in mind

Cloudflare frames the effort around treating agents as customers. CLIs, API SDKs, MCP servers and good documentation were once the concern of developer products specifically; the company argues they are now table stakes for every product.

That is where Cap'n Web comes in. Cap'n Web is Cloudflare's RPC system, which lets TypeScript call a remote API as though it were a local method, batching multiple calls into a single request. Forge can generate Cap'n Web bindings directly from an OpenAPI specification, which Cloudflare says opens the door to generating bindings from Workers to other APIs, since bindings in the Workers runtime are themselves Workers exposing RPC methods.

The same idea extends to the wider ecosystem: transformers could generate TanStack Query bindings, Zod or Valibot schemas, or MCP servers, all validated against the real API.

Versioning plans

Forge also underpins an API versioning effort. Cloudflare's v4 API has been its only major version for a decade, and while that makes it look stable, the company admits it has shipped changes that qualify as new major versions under SemVer, plus internal v2 tags and beta labels that outlived their products. With Forge releasing artifacts along the way, Cloudflare is working toward shipping new major API versions without breaking old clients or SDKs. New SDKs are promised for TypeScript, Rust, Python, Go, PHP and Terraform, with Cloudflare pledging particular care around the Terraform transition.

Why it matters

Generated SDKs and docs today usually arrive through hosted SaaS tools, which Cloudflare argues leave you without control and can disappear. Forge's bet is that generation is core infrastructure you should own and run in CI like tests, with a full preview build of every artifact on every pull request, even when the API surface is spread across hundreds of repos. If the pipeline proves general, it could sharply lower the cost of keeping CLIs, SDKs, MCP servers and documentation in sync with fast-moving APIs, both for Cloudflare and for anyone who adopts it.

  • #open-source
  • #cloudflare
  • #sdk
  • #developer-tools
  • #api

Related posts