Skip to content

Cloudflare Integration Introduction

The Cloudflare integration (part of AvantiPoint Aspire) lets you model your Cloudflare resources in your Aspire AppHost and deploy them with aspire deploy.

AppHost examples provide synchronized C# and TypeScript tabs. Both use the same .NET hosting integrations and deployment behavior. See the quickstart for package setup and builder initialization. The consuming .NET service-client examples remain C#; these packages do not provide JavaScript runtime clients.

When you add a Cloudflare environment to your AppHost, the integration hooks into Aspire’s publish/deploy pipeline:

  1. Validate - your Cloudflare API token is checked up front; deployment fails fast with a clear message if it’s missing, invalid, or inactive. Permission checks happen in the service APIs during deployment.
  2. Publish — build artifacts are produced (container images, generated wrangler.jsonc, the JS build output).
  3. Deploy — resources are created/updated on Cloudflare: data services (R2, D1, KV, Queues, Vectorize, Hyperdrive, AI Gateway) via the REST API; Workers, Containers and Pages via wrangler.

During local aspire run, services that support .RunAsEmulator() run against a local emulator instead of Cloudflare — R2 against MinIO, D1 against SQLite, AI against Ollama, and KV/Queues/Vectorize against in-memory stores — so the inner dev loop needs no Cloudflare credentials at all.

Each service ships a hosting package (model + provision) and, where a .NET app consumes it, a matching client package:

Service Client Local emulator
R2 IR2Client (S3-compatible) MinIO
D1 ID1Client SQLite
AI IChatClient / IEmbeddingGenerator Ollama
Vectorize IVectorizeClient in-memory
Workers KV ICloudflareKVClient in-memory
Queues IQueueClient in-memory
Hyperdrive (Worker binding — no .NET client) your normal database
Workers / Containers / Pages — runs locally

Plus custom domains for Containers, Workers, and Pages.

Most of the friction in getting started is on the Cloudflare side — gathering identifiers and minting a token with the right permissions. The next pages walk through each piece:

Step Why
Prerequisites Tools you need installed.
Account ID & Zone ID Required for provisioning and custom domains.
API Tokens & Scopes The token the integration and wrangler use — scoped to the services you deploy.
R2 S3 Credentials Separate keys your app uses to read/write R2 at runtime.
How wrangler authenticates Non-interactive auth for Pages/Containers.
Quickstart Wire it all together.