Cloudflare Open-Sources Forge for Unified SDK, CLI, and Docs Generation
Cloudflare has released Forge, an open-source, pluggable code generation pipeline designed to streamline the creation of SDKs, CLIs, and documentation from API specifications.

Cloudflare has introduced Forge, a new open-source project aimed at simplifying the complex process of generating software development kits (SDKs), command-line interfaces (CLIs), and documentation. This pluggable pipeline is designed to handle the extensive API surface of large organizations, enabling developers to generate essential tools and documentation efficiently.
Forge was developed out of Cloudflare's internal need to manage its own vast API, which comprises over 3,500 operations across numerous services written in various programming languages. The project's genesis lies in the challenge of maintaining consistency and reducing coordination overhead when API changes occur. Forge aims to provide a unified system that can generate preview builds for CLIs, SDKs, and documentation whenever an API change is proposed, allowing teams to catch potential issues before merging code.
The pipeline runs directly within continuous integration (CI) environments, integrating seamlessly with existing development workflows. This approach ensures that code generation is a consistent part of the development lifecycle, similar to automated testing or code reviews. By generating preview builds for every change, Forge offers a developer experience akin to Cloudflare Workers Previews, but applied to the critical task of SDK and documentation generation at scale.
Forge's flexibility is a key feature, extending beyond standard SDK and documentation outputs. It supports custom transformers that can generate various formats, including Cap'n Web RPC, Zod schemas, and potentially other protocols like AsyncAPI, GraphQL, or Protobuf in the future. This extensibility allows teams to generate bindings for specific libraries, create full dashboards, or even build entire applications directly from API specifications.
A significant aspect of Forge is its ability to chain transformations. This means the output of one generator can serve as the input for another, enabling complex generation workflows. For instance, an OpenAPI specification could be used to generate a Go SDK, which then serves as the input for generating a CLI in TypeScript, or vice-versa, depending on the team's needs and preferred language.
Cloudflare highlighted the challenge of integrating custom, handwritten CLI commands into generated documentation. Forge's design accommodates this by allowing developers to feed these unique elements back into the documentation generation process, ensuring that all aspects of an API's interface, whether generated or custom, are properly documented and accessible to users.
The project is positioned as a solution to the shortcomings of existing hosted products, which Cloudflare found to be inflexible, difficult to control, and sometimes unreliable. By open-sourcing Forge, Cloudflare aims to empower other organizations to build robust and customized code generation pipelines, thereby improving developer experience and reducing the friction associated with API evolution.
Forge is available for anyone to deploy and run for free, with Cloudflare planning to integrate it further into its own product offerings, including its extensive API documentation and SDKs, in the coming months. The project represents a significant step towards standardizing and automating the creation of developer-facing assets for APIs.