Skip to content
Blog

An OpenAPI reference with code samples and Try it, deployed on Cloudflare

Turn an OpenAPI spec into an API reference with code samples and a Try it panel, beside your docs, and deploy it on Cloudflare.

Nimbus reads your OpenAPI 3.x document and turns it into one page per operation, tag and webhook, with cURL, TypeScript and Python samples and an optional Try it panel. The scaffolder can set it up beside your docs and deploy the whole site to Cloudflare.

Start from your spec

Point the scaffolder at your spec. --api puts the reference beside the docs, at /api, and --adapter cloudflare makes it a server site on Cloudflare, which Try it’s proxy needs:

npm create @cloudflare/nimbus-docs@latest -- my-docs --adapter cloudflare --api ./openapi.yaml

Leave the path out for a sample spec, or use --template api to make the reference the whole site.

The spec stays the source of truth. You don’t write a page per operation; Nimbus builds them, with navigation, search entries, Markdown versions and llms.txt lines (Set up an OpenAPI reference).

What each operation page has

  • The request, with its parameters, body and authorization, and every response with its fields.
  • Code samples in cURL, TypeScript and Python, built from the spec’s examples and schemas (Code samples).
  • A Markdown version, so an agent can read the operation without the page around it.

Add Try it

Try it adds a button to each operation that opens the request as the sample sends it. The reader adds a key, sends it, and sees the status, timing, headers and body.

Ask your coding agent to run the recipe:

npx @cloudflare/nimbus-docs add try-it

It asks, for each API, whether the API answers browser requests from your docs. If it doesn’t, requests go through a proxy route on your site. The proxy runs only on a server site; a static site sends every request from the browser (Try it).

Versions

An API with several versions gets a version picker, with each version’s pages at its own URL (API versions).

Deploy on Cloudflare

The scaffolder sets the site up for Cloudflare. You need a Cloudflare account; then, from the project:

  1. Set site in the Nimbus config in astro.config.ts to the address readers will use.
  2. Run npm run deploy. It checks and builds the site first, and the first run opens a browser to sign in to Cloudflare.

Wrangler prints the site’s address when it finishes. Netlify, Vercel and Node work as well (Deploy to Cloudflare).

To see a finished reference, open the weather demo: a 105-endpoint API in three versions, rendered on request on Cloudflare Workers, with Try it.

Try it

Scaffold a server site with the sample API, then run it with npm run dev:

npm create @cloudflare/nimbus-docs@latest -- my-docs --adapter cloudflare --api

More posts

All posts

Get started

Your docs, five minutes from now.

Press ⌘C to copy the one command you need. Or click the keys.

npx @cloudflare/create-nimbus-docs@latest

Paste it in your terminal. A few questions later, the site is in your repo.

Type to search…

↑↓ navigate↵ selectEsc close