Cloudflare Pages
deploy-targets.json defines two targets, each a Cloudflare Pages project tied to a branch:
{
"prod": {
"project": "yourstartup",
"branch": "main",
"site": {
"url": "https://yourstartup.ai",
"dataMode": "live",
"apiBaseUrl": "https://api.yourstartup.ai",
"recaptchaSiteKey": "..."
}
},
"local": {
"project": "yourstartup-local",
"branch": "dev",
"default": true,
"site": { "url": "https://local.yourstartup.ai", "dataMode": "demo", "noindex": true }
}
}
Create both projects from the Cloudflare dashboard with the GitHub integration, using
npm run build as the build command, _site as the output directory and the target's
branch as the production branch. Every push to that branch then deploys itself: the build
reads CF_PAGES_BRANCH and applies the matching target's site settings. Any other
branch, such as a pull request preview, builds the default target. To deploy from
your machine instead, run:
bun run deploy:check # validate both targets, deploy nothing
bun run deploy:local # build and deploy the local target
bun run deploy:prod # build and deploy the prod target
Builds for a target, from a push or from your machine, fail on a placeholder url or a
missing dataMode. A live target also needs an HTTPS API URL and a real reCAPTCHA key.
noindex adds a robots noindex meta tag to every page, so the staging copy stays out of
search results.
bun run preview serves the build through Wrangler locally, including the cache rules
in src/_headers and any redirects in src/_redirects.
Caching
Production CSS and JavaScript have content hashes in their file names, and
src/_headers caches them for a year. Images and fonts are cached for 30 days. HTML is
never cached long-term, so a deploy is visible right away.
Before you launch
- Replace the sample testimonials and blog bylines with your own.
- Fill in the legal pages linked from the footer.
- Run
bun run lighthouse:checkandbun run links:check:externalonce against the final content.