Forge is a schema-first OpenAPI code generation and surface tooling framework. It provides a plugin-based architecture for resolving OpenAPI 3.x specifications, applying JSONPath-based overlays, and generating typed SDKs, CLI interfaces, runtime helpers, and documentation.
This monorepo contains:
@cloudflare/forge: Core engine: OpenAPI 3.x resolver, typed schema model, JSONPath overlay runner, plugin lifecycle manager, and RFC runtime helpers.astro-fern: Generic Astro engine for rendering Fern-based API documentation.fern-forge:astro-fernextension for validating and adapting Forge OpenAPI metadata for documentation.docs-site: API reference documentation website consumingastro-fern.@cloudflare/fern-config: Shared Fern generator configuration and workspace staging.@cloudflare/forge-sdk-ts: TypeScript SDK package wrapper andsdk-mapgenerator.@cloudflare/forge-transformer-sdk-ts: Standalone TypeScript SDK generator that turns any bundled OpenAPI specification into an idiomatic TypeScript client library.@cloudflare/forge-sdk-{lang}: Multi-language SDK workspace wrappers (Python, Go, Java, PHP, C#, Ruby, Rust, Swift).
Forge separates the API definition from surface implementations:
+--------------------------------+
| OpenAPI 3.x Specification |
+---------------+----------------+
|
v
+--------------------------------+
| JSONPath Overlays (Optional) |
+---------------+----------------+
|
v
+--------------------------------------------------------------------+
| @cloudflare/forge |
| |
| - OpenApiResolver: $ref dereferencing, parameter/body extraction |
| - Schema model: typed command/method hierarchy |
| - Plugin lifecycle: init -> transform -> finalize |
+---------------------------------+----------------------------------+
|
+---------------------+---------------------+
| |
v v
+-----------------------+ +-----------------------+
| TypeScript SDK | | Other Surface |
| (@cloudflare/forge- | | Transformers (CLI, |
| transformer-sdk-ts) | | docs, runtimes) |
+-----------------------+ +-----------------------+
pnpm add @cloudflare/forgeimport { Forge, init } from '@cloudflare/forge';
// Load any OpenAPI 3.x specification
const spec = {
openapi: '3.0.0',
info: { title: 'Sample API', version: '1.0.0' },
paths: {
'/users': {
get: {
operationId: 'listUsers',
summary: 'List all users',
responses: {
'200': { description: 'Success' },
},
},
},
},
};
// Initialize a Forge instance with overlays applied
const forge = await init(spec);
// Access resolved operations and schemas
const op = forge.getVerbPath('listUsers');
console.log(op?.path, op?.verb); // /users getInstall the standalone Forge CLI to generate a TypeScript SDK from a bundled OpenAPI specification:
pnpm add --save-dev @cloudflare/forge-transformer-sdk-ts
pnpm exec forge openapi.json --out ./generatedUse - to read the OpenAPI document from stdin. Full generation requires Docker. The output directory contains the finalized OpenAPI document, generated SDK source, and sdk-map.json.
# Install dependencies
pnpm install
# Run tests across all packages
pnpm test
# Typecheck
pnpm typecheck
# Lint and format
pnpm checkApache-2.0 © Cloudflare, Inc.