AI Cloudflare Deployment and Hosting
Built a website, a game or an app in Cursor? Until you deploy it online, nobody will see it. Cloudflare Pages is one of the simplest ways to get a static website onto the internet, and for a smaller project the free plan is enough: up to 20,000 files per site, 500 builds a month and 100 custom domains per project (as of October 2026, limits).
dist, build or public), not the whole project. Otherwise you may accidentally publish a .env file with passwords and keys. Anyone can download what's online on Pages.
🌩️ What Cloudflare Pages and Wrangler are
Cloudflare is a worldwide network that speeds up and protects websites. The Pages service hosts static websites (HTML, CSS, JavaScript) and apps built with React or Vite. Wrangler is their command-line tool that packages and uploads the website. You create an account for free at dash.cloudflare.com.
I have a finished website in this project and I want to put it on the internet for the first time with Cloudflare Pages and npx wrangler. I'm a beginner and I've never done this.
1. Find out from the project whether it has a build (package.json, Vite, React…) and which folder the finished website goes into. For plain HTML, find the folder with index.html.
2. Check that the folder contains no secret files (.env, keys, passwords). If it does, stop and tell me.
3. Explain how I log in to Cloudflare (npx wrangler login) and what happens when I do.
4. Write the exact command to deploy that one folder with the project name [my-website].
Show me the commands and explain them. Run them only after I confirm.
🚀 One command that uploads the website
Open the terminal (in Cursor at the bottom, the Terminal tab) in the project folder and run the command. Instead of dist, write the folder with the finished website.
npx wrangler pages deploy dist --project-name my-website
https://my-website.pages.dev. Done, the page is live. You upload a preview without touching the main website with the switch --branch=preview.
🔁 Automatically from GitHub
When your project is on GitHub, connect it to Pages and every push deploys itself. Every other branch gets its own preview address, so you check changes before they go to the main website. How to use Git and GitHub is in GitHub for beginners.
I want my website to deploy itself after every push to GitHub. Project: [a static HTML website / Vite + React], repo: [the repo name on GitHub]. 1. Find out from the project the build command and the folder the result goes into (no build for plain HTML). 2. Write me the steps in Cloudflare: Workers & Pages → create a Pages project → connect Git, and what to fill in the build settings. Button names may change, so describe what to look for too. 3. Explain the preview addresses for branches other than the main one. 4. Check that there are no secret keys (.env) in the repo. If there are, advise how to remove them and move them into environment variables in Cloudflare. Don't push anything without my confirmation.
🌐 Connecting your own domain (DNS)
Don't want a .pages.dev address? Buy your own domain (e.g. myname.com) and connect it. A subdomain like www.myname.com is connected with a CNAME record at your registrar. The whole domain without www only by moving it under Cloudflare (changing the nameservers). Always add the domain to the project in Cloudflare first (Custom domains) and only then change DNS, otherwise the website shows error 522. Cloudflare's guide.
I have a website on Cloudflare Pages at [my-website.pages.dev]. At the registrar [Namecheap / GoDaddy / Porkbun] I have the domain [my-business.com]. I want the website to work on [both www.my-business.com and my-business.com]. I'm not an IT person. 1. Explain the two ways: a CNAME just for www, or moving the whole domain under Cloudflare (nameservers). What each one means, especially for the email I have at the registrar. 2. For my choice, a numbered procedure: where to click in Cloudflare (Workers & Pages → project → Custom domains) and exactly what to enter at the registrar. 3. The order: add the domain in Cloudflare first, then change DNS. 4. How long it takes and how I check that it works. Before you tell me to change the nameservers, remind me to write down the existing DNS records (especially MX for email). If the procedure differs at my registrar, tell me where to check it.