Skip to content
NLEN
← Apps overview

Cloudflare OS: technical tutorial

By Ivo Donker · — created with AI assistance (writer: DeepSeek V4.1 Flash; critic: Gemini 3.8 Flash)

Cloudflare OS: ReviewInstall & set upNews

As of September 2026, compiled from our own notes and news archive; text machine-generated and editorially checked. Check versions and commands in the official documentation.

This tutorial goes under the bonnet of Cloudflare OS: the architecture (gadgets, gatekeepers, blueprints), the capabilities-based security model, the development setup, and running it as a public multi-user service with sign-in via OAuth and billing via AI Gateway. It is based on the documentation in the official repository cloudflare/cloudflare-os (as of September 2026, v2 early access).

The architecture as an operating system

Cloudflare OS does not use the term "operating system" merely as marketing. Technically, the components resemble those of an OS:

Technically, everything relies on Cloudflare Workers: every workspace is a Durable Object, every gadget runs in a Dynamic Worker Facet, and gatekeepers install their own facets in a workspace to manage access to external services.

Gadgets: every user gets their own copy

The starting point is different from ordinary SaaS. When you create a presentation, you do not call on central software. Cloudflare OS starts a private instance of the presentation app, just for you, in its own sandbox. This has two consequences:

Communication between a gadget's client and server must go through Cap'n Web RPC. As a result, every gadget automatically has a clean API that an agent can call directly. So you can also have the agent collaborate *inside* an app, without building a separate MCP server for it.

Because every gadget runs on a Durable Object, real-time collaboration (as in an online office suite) is built in by default.

The sandbox

A gadget cannot do anything with the internet without your permission:

Gatekeepers and capabilities

A gatekeeper is a kind of extended MCP server, as a separate Worker per external service. It:

Capability-based access. By default, an agent or gadget has access to nothing, even if you have connected the service. You must explicitly introduce a resource, for example by pasting a link to a GitHub repository or choosing a resource via "add resource". An agent can itself ask for an introduction, which you grant or deny. This is the opposite of most agent environments, where MCP servers are broadly available in every chat in advance.

Asynchronous approval. If an agent wants to do something that requires approval, the gatekeeper simulates the outcome and the agent continues. The real actions are placed in a queue that you later approve or reject all at once or per action. This way, an agent does not get stuck on the first question all night, and you do not have to turn on "approve everything automatically".

Blueprints: sharing code instead of data

A blueprint is the code of a gadget, without chat history, storage or login credentials. Anyone who creates a gadget from a blueprint gets their own copy with their own bindings, their own storage and their own conversations.

Developing Cloudflare OS itself

To develop, you run frontend and backend separately, in two terminals:

pnpm dev-server
pnpm dev-client

Then open http://localhost:3000. You put settings for local development in a .dev.vars file in the root of the repository, with one KEY=VALUE per line. That file is in .gitignore and is loaded automatically by pnpm run dev-server.

The project is not currently taking large external contributions: small, easy-to-review fixes yes, larger ideas via GitHub Discussions.

As a public service for multiple users

By default, the Workshop uses username and password (or Cloudflare Access) and every user gets unlimited AI usage: ideal for self-hosting in a team. You can also set it up as a public service. You enable those parts separately:

AUTH_GATEKEEPERS=cloudflare,google,github   # met deze diensten mag je inloggen
DISABLE_PASSWORD_AUTH=true                  # alleen OAuth-login (werkt alleen als de lijst hierboven niet leeg is)
ENABLE_CLOUDFLARE_LIMITS=true               # gratis dagtegoed + betalen via eigen Cloudflare-credits
PUBLIC_BASE_URL=https://jouw-domein
CF_AI_GATEWAY=jouw-gateway                  # AI Gateway voor het gratis tegoed
CF_AI_GATEWAY_PROVIDERS=anthropic,openai,google
CF_AI_GATEWAY_ACCOUNT_ID=...
CF_AI_GATEWAY_API_TOKEN=...

Logging in. Every gatekeeper that supports logging in (Google, GitHub, Cloudflare) uses one OAuth app for both logging in and linking the service. The account key is always the verified email address: anyone who logs in with Google and GitHub using the same verified address ends up in the same account. When logging in, only the minimum permissions needed to read that address are requested, and that temporary access expires immediately afterwards. Broader permissions (repositories, Gmail and Docs, billing) are only requested when the user explicitly links the service.

Billing. With ENABLE_CLOUDFLARE_LIMITS, every user gets a free daily allowance (100 LLM calls per UTC day by default). A user who links their own Cloudflare account and has at least $2 in AI Gateway credits is always billed through that own account. If the free allowance is used up and there are no credits or too few, the request is blocked with a message to link an account or top up. The platform itself never handles money: topping up happens in the Cloudflare dashboard.

If you run the free allowance via Workers AI, that uses the same gateway by default. With CF_AI_GATEWAY_WAI_DIRECT=true it goes straight to the REST endpoint of Workers AI, and with CF_AI_GATEWAY_WAI you choose a different gateway.

What to watch out for

Source: github.com/cloudflare/cloudflare-os and the docs/ folder in that repository.