Deploy to Cloudflare Pages
Ship a static landing page from your laptop to a global CDN in under ten minutes. No build tools, no Docker, no surprise bills.
Prerequisites
Before you start, make sure you have the following ready. None of this requires paid software.
- A LaunchStatic template — download from our templates page or clone the repo. You need at least one
index.htmlat the project root. - A GitHub account — free tier is fine. Cloudflare Pages connects directly to GitHub for automatic deploys on every push.
- A Cloudflare account — sign up at dash.cloudflare.com. The free plan includes Pages, SSL, and unlimited bandwidth for static sites.
- Git installed locally — verify with
git --versionin your terminal. - (Optional) A custom domain — you can use the free
*.pages.devsubdomain until you are ready to point your own domain.
Step 1: Create a GitHub repository
Create a new repository on GitHub. Keep it public (required for free Cloudflare Pages on personal accounts) and do not initialize with a README if you already have local files — that avoids merge conflicts on first push.
In your project folder, initialize Git and push your template files:
cd path/to/your-landing-page
git init
git add .
git commit -m "Initial commit: LaunchStatic template"
git branch -M main
git remote add origin https://github.com/YOUR_USERNAME/YOUR_REPO.git
git push -u origin main
Replace YOUR_USERNAME and YOUR_REPO with your actual GitHub details. Your folder structure should look like this:
your-landing-page/
├── index.html
├── assets/
│ ├── css/
│ └── js/
└── (optional) images/
Cloudflare Pages serves files from the repository root by default. Your homepage must be named index.html so visitors hitting / get the right page.
Step 2: Connect Cloudflare Pages
- Log in to the Cloudflare dashboard.
- Go to Workers & Pages in the left sidebar, then click Create application → Pages → Connect to Git.
- Authorize Cloudflare to access your GitHub account and select the repository you just created.
- On the build settings screen, configure the following:
- Production branch:
main - Framework preset: None (or "None")
- Build command: leave empty — static HTML needs no compilation
- Build output directory:
/(root)
Click Save and Deploy. Cloudflare clones your repo, finds your HTML files, and publishes them to a your-project.pages.dev URL within about a minute.
Every future git push to main triggers a new deployment automatically. Preview deployments are created for pull requests if you enable that option in project settings.
Step 3: No build command — why it matters
LaunchStatic templates are plain HTML, CSS, and vanilla JavaScript. There is no npm run build, no Vite, no Next.js output folder. Leaving the build command empty tells Cloudflare to upload your files as-is.
If you accidentally select a framework preset like React or Astro, Cloudflare may run a build step that fails or outputs to the wrong directory. Always choose None for raw static sites.
If you add a build step later (for example, Tailwind CLI), you would set a build command like npx tailwindcss -i ./src/input.css -o ./assets/css/main.css and keep the output directory as root or wherever your built files land.
Step 4: Custom domain with CNAME
Once your site works on *.pages.dev, point your own domain to it.
If your domain is on Cloudflare
- In your Pages project, go to Custom domains → Set up a custom domain.
- Enter your domain (e.g.
launchstatic.devorwww.launchstatic.dev). - Cloudflare adds the DNS records automatically. SSL certificates provision within a few minutes.
If your domain is at another registrar
Add a CNAME record at your DNS provider:
- Type: CNAME
- Name:
www(forwww.yourdomain.com) or@if your registrar supports CNAME flattening at apex - Target:
your-project.pages.dev - TTL: Auto or 300 seconds
For apex domains (yourdomain.com without www), Cloudflare Pages supports CNAME flattening when the domain is on Cloudflare DNS. Other registrars may require an ALIAS or ANAME record, or you can redirect apex to www.
Back in the Pages dashboard, add the custom domain under Custom domains. Wait for the status to show Active before sharing the URL publicly.
Alternative: GitHub Pages
GitHub Pages is a solid free alternative if you prefer to keep everything inside GitHub. The trade-off: slightly slower global CDN compared to Cloudflare, and custom domain setup uses GitHub's infrastructure rather than Cloudflare's edge network.
- Open your repository on GitHub → Settings → Pages.
- Under Source, select Deploy from a branch.
- Choose branch
mainand folder/ (root). - Click Save. Your site will be live at
https://YOUR_USERNAME.github.io/YOUR_REPO/within a few minutes.
For a custom domain on GitHub Pages, add a CNAME file to your repo root containing your domain name (e.g. www.yourdomain.com), then create a CNAME DNS record pointing to YOUR_USERNAME.github.io.
echo "www.yourdomain.com" > CNAME
git add CNAME
git commit -m "Add custom domain for GitHub Pages"
git push
Enable Enforce HTTPS in GitHub Pages settings once DNS propagates.
Troubleshooting
404 on homepage or subpages
- Missing index.html — Cloudflare and GitHub Pages both expect
index.htmlat the root for the/route. Rename your main file if needed. - Wrong output directory — If build output is set to
/distor/publicbut your files are at root, every URL will 404. Set output directory to/. - Case sensitivity — Linux servers are case-sensitive.
Index.htmlwill not work. Use lowercaseindex.html. - Broken asset paths — Use root-relative paths like
/assets/css/main.cssinstead of relative paths that break on nested routes.
Stale content / cache issues
If you pushed changes but the live site still shows old content:
- Check the Cloudflare Pages dashboard for deployment status. Failed builds leave the previous version live.
- Hard-refresh your browser:
Ctrl+Shift+R(Windows) orCmd+Shift+R(Mac). - Cloudflare caches static assets at the edge. Purge cache under Caching → Configuration → Purge Everything if you need an immediate update (rare for HTML-only sites).
- Add cache-busting query strings during development:
style.css?v=2. Remove before production or use filename hashing if you add a build step later.
Custom domain not working
- DNS propagation can take up to 48 hours, though it is usually under an hour.
- Verify the CNAME target matches your exact
*.pages.devsubdomain. - SSL errors often mean the certificate is still provisioning — wait 15 minutes and retry.