Developer tools

Cloudflare open sources Forge to streamline SDK and CLI generation

Cloudflare released Forge, an open source pipeline for generating SDKs, CLIs, and docs. It runs in CI to preview changes and supports chained outputs.

Cloudflare has introduced Forge, an open source pipeline designed to generate software development kits, command line interfaces, and documentation. Released on September 28, 2026, the tool aims to help engineering teams manage complex API surfaces by automating the creation of client libraries and developer tools. The company built the system internally to handle its own scale before making it available to the public under the Apache 2.0 license.

What happened

Cloudflare’s internal API infrastructure has grown significantly, now supporting over 3,500 operations across hundreds of services. These backend services are written in a variety of languages, including Rust, Go, TypeScript, and Python. As the company worked to build a unified command line interface for its entire API, along with corresponding SDKs and documentation, existing code generation tools proved insufficient. The engineering team needed a pipeline that could handle this massive scale while remaining flexible enough to accommodate different programming languages and workflow requirements.

The primary challenge was reducing coordination overhead between disparate product teams. Previously, when one team made an API change, they lacked a reliable way to preview how that change would affect the global CLI, SDKs, or documentation before merging their code. This often led to situations where a merge would inadvertently break the generation pipeline, causing issues that other teams would only discover at release time. Cloudflare attempted to use several hosted third-party products to solve this, but found them lacking in control and reliability, with some services even shutting down entirely.

To address these friction points, Cloudflare developed Forge as an internal solution and is now releasing it as open source. The tool is already generating the output required for the cf CLI and is scheduled to power Cloudflare’s API documentation and SDKs in the coming months. By open sourcing the project, the company intends to allow other organizations to generate the necessary surfaces for both human developers and AI agents without relying on proprietary SaaS vendors.

How it works

Forge operates as a pluggable generation pipeline that integrates directly into continuous integration workflows. It functions similarly to Cloudflare’s Workers Previews, creating a full preview build for every change submitted via pull request. When a developer modifies an API specification, Forge lints the change and generates preview builds of the CLI, documentation, and SDKs. These previews highlight only the specific changes made, allowing engineers to install and test the new artifacts immediately. This process helps detect breaking changes or errors in the CI stage, preventing downstream issues before they reach production.

A core feature of Forge is its ability to chain transformers, meaning it can generate outputs from other outputs rather than just from the original source specification. While many generators produce targets like CLIs or Terraform providers directly from a Go SDK, Forge allows users to control this chaining process themselves. For example, Cloudflare uses this capability to generate its TypeScript-based cf CLI from the TypeScript SDK, which itself is derived from the OpenAPI definition. This flexibility supports the addition of local-only behaviors, such as custom CLI commands that do not correspond to direct API calls, and ensures these manual additions are properly reflected in the generated documentation.

The system is designed to be extensible beyond standard language targets. It currently supports OpenAPI as an input type, with plans to support AsyncAPI, GraphQL, Cap’n Proto, and Protobuf in the future. This architecture enables the generation of specialized tools like Cap’n Web, Cloudflare’s RPC system that allows TypeScript to call remote APIs as if they were local methods. It also facilitates the creation of bindings for tools like TanStack Query, Zod schemas, Valibot schemas, and Model Context Protocol servers, ensuring that all consumer-facing interfaces remain synchronized with the actual API state.

Key details

  • Forge is released under the permissive Apache 2.0 license, allowing free private or public use.
  • The tool currently supports OpenAPI inputs, with future support planned for GraphQL, AsyncAPI, and Protobuf.
  • It generates preview builds for every pull request, highlighting changes for immediate testing.
  • Forge supports chained outputs, enabling the creation of CLIs from SDKs rather than just specs.
  • The pipeline is already in use for Cloudflare’s cf CLI and will soon power its main SDKs.
  • It is designed to reduce coordination overhead by catching breaking changes in CI.

Why it matters

For software teams managing large or distributed APIs, maintaining consistent client libraries and documentation is a significant operational burden. Traditional approaches often involve manual updates or rigid generators that fail to account for custom logic or multi-language requirements. Forge addresses this by providing a self-hosted, controllable alternative to volatile third-party services. By running the generation pipeline within their own CI environment, teams gain ownership over their developer experience tools and can ensure that SDKs and docs are always in sync with the latest API definitions.

The rise of AI agents as API consumers further increases the need for robust, machine-readable interfaces. Agents require precise SDKs, clear documentation, and standardized protocols like MCP to interact with services effectively. Forge’s ability to generate these surfaces automatically ensures that products remain accessible to both human developers and automated systems. This shift treats agent compatibility as a fundamental requirement rather than an afterthought, helping organizations future-proof their APIs against evolving consumption patterns.

Additionally, the tool’s support for API versioning strategies offers a path forward for long-lived services. Cloudflare notes that its v4 API has been in place for ten years, accumulating changes that would traditionally warrant a major version bump. By using Forge to release artifacts incrementally, teams can explore versioning approaches that introduce new capabilities without breaking existing clients. This is particularly relevant for complex ecosystems like Terraform, where upgrades require careful management to avoid disrupting infrastructure deployments.

What you can do

  • Evaluate Forge for your current API generation workflow to see if it reduces manual maintenance.
  • Integrate the pipeline into your CI system to generate preview builds for every pull request.
  • Use the chaining feature to create custom CLIs or documentation from your existing SDKs.
  • Experiment with generating bindings for specific libraries like TanStack Query or validation schemas.
  • Contribute to the open source repository if you have improvements for supported input formats.
  • Plan your API versioning strategy by leveraging incremental artifact releases instead of big bang updates.

Tools from the Bytechap store

Keep reading

All stories