Cloudflare

Lightweight, dependency-free, in-memory Cloudflare API v4 fake for testing code that uses the cloudflare Node SDK or the raw Cloudflare REST API.

Default port: 4772

Quick start

import { CloudflareServer } from "./services/cloudflare/src/server.js";

const server = new CloudflareServer(4772);
await server.start();
// ... run your app/tests ...
await server.stop();

Point a client at it:

const res = await fetch("http://127.0.0.1:4772/client/v4/user", {
  headers: { Authorization: "Bearer cf_parlel" },
});
const { result } = await res.json();
// result.email => "parlel-user@parlel.dev"

Access via MCP / preview URL

Auth: Authorization: Bearer <token> or the legacy X-Auth-Key + X-Auth-Email header pair.

Implemented operations

Every response uses the Cloudflare envelope { success, errors, messages, result, result_info? }. State is in-memory and ephemeral.

Service & inspection (parlel extensions)

Surface coverage

This emulator faithfully replicates the API surface most application code and agents exercise. Anything below the supported lines is either an intentional design choice for a fast, zero-cost local emulator (✓ By design) or a candidate for a future release (⟳ Roadmap) — never a silent inaccuracy.

Legend: ✅ fully supported · ◐ accepted (stored, not strictly enforced) · ✓ by design · ⟳ on the roadmap.

FeatureStatus
GET /user✅ Supported
Zones list / create / get / patch / delete✅ Supported
DNS records CRUD✅ Supported
{ success, errors, messages, result, result_info } envelope✅ Supported
Bearer or X-Auth-Key/X-Auth-Email auth✅ Required
Workers / R2 / KV / Pages / Firewall⟳ Roadmap
Real DNS resolution / zone activation⟳ Roadmap — Zones are instantly active
Token scope enforcement✓ By design — Any non-empty credential is accepted — no real secrets needed

Error codes & shapes

Cloudflare failure envelope: { "success": false, "errors": [{ "code", "message" }], "messages": [], "result": null }.

StatusWhen
401missing/invalid authentication
400validation failed (missing name/record fields)
404unknown zone/record
405method not allowed

Manifest

See services/cloudflare/manifest.json:

<!-- parlel:testenv:start -->

Configuration — test.env

Copy these into your test.env (used by the bridge sidecar flow). Tokens are Parlel's seeded test credentials — any non-empty value is accepted by the emulator, so you rarely need to change them. Swap in real credentials only when pointing at the live service in prod.env.

CLOUDFLARE_API_TOKEN=cf_parlel
CLOUDFLARE_API_URL=http://parlel-bridge:4772/client/v4
<!-- parlel:testenv:end -->