Skip to content
GitHubXDiscord

Zone

The Zone resource lets you manage Cloudflare DNS zones and their configuration settings.

Create a basic DNS zone with default settings.

import { Zone } from "alchemy/cloudflare";
const zone = await Zone("example-zone", {
name: "example.com",
type: "full",
delete: true, //Default true: Delete's Zone on --destroy
});

Configure a zone with strict SSL and enhanced security settings.

const secureZone = await Zone("secure-zone", {
name: "secure.example.com",
settings: {
ssl: "strict",
alwaysUseHttps: "on",
minTlsVersion: "1.3",
tls13: "zrt",
},
});

Create a zone optimized for performance with HTTP/3 and caching.

const fastZone = await Zone("fast-zone", {
name: "fast.example.com",
settings: {
browserCacheTtl: 7200,
brotli: "on",
http3: "on",
earlyHints: "on",
},
});

Configure a zone for development with specific features enabled.

const devZone = await Zone("dev-zone", {
name: "dev.example.com",
settings: {
developmentMode: "on",
websockets: "on",
hotlinkProtection: "on",
},
});