Skip to content

PagesProject

Source: src/Cloudflare/Pages/Project.ts

A Cloudflare Pages project (direct-upload).

The project is the container for Pages deployments, custom domains, and per-environment configuration. Created without git source integration, it is a direct-upload project — deployments are pushed via the API or wrangler pages deploy.

The project name is its identity (it forms the <name>.pages.dev subdomain), so renaming triggers a replacement. productionBranch, buildConfig, and deploymentConfigs are all mutable in place.

Minimal project (generated name)

const project = yield* Cloudflare.PagesProject("site", {});
// project.subdomain === "<generated-name>.pages.dev"

Named project with a build config

const project = yield* Cloudflare.PagesProject("site", {
name: "my-site",
productionBranch: "main",
buildConfig: {
buildCommand: "npm run build",
destinationDir: "dist",
},
});
const project = yield* Cloudflare.PagesProject("site", {
deploymentConfigs: {
production: {
compatibilityDate: "2025-01-01",
envVars: {
API_URL: { value: "https://api.example.com" },
API_KEY: { type: "secret_text", value: apiKey },
},
kvNamespaces: {
CACHE: kvNamespace.namespaceId,
},
},
},
});
const domain = yield* Cloudflare.PagesDomain("site-domain", {
projectName: project.name,
name: "www.example.com",
});