Deploy Your Website Free With Cloudflare Pages (and Why Vercel's Free Plan Can't Run Ads)

Deploy Your Website Free With Cloudflare Pages (and Why Vercel's Free Plan Can't Run Ads)

One git push, and your site is live on everyone's phone, for ₹0. Most "deploy for free" videos say Vercel, and for a personal project that is a great choice. But Vercel's free plan is for non-commercial personal use only: the day you add ads or take payments, it is outside the rules. This guide shows the free option that has no such rule in its plans, Cloudflare Pages: the click-by-click deploy, how to add your own domain with HTTPS, and which free host fits which job.

The short version

  1. Put your project on GitHub (a repo, for example my-first-site).
  2. In the Cloudflare dashboard: Workers & Pages → Create → Pages → Connect to Git.
  3. Pick your repo, choose your framework's build settings, and press Save and Deploy.
  4. Your site is live at your-project.pages.dev, with HTTPS, unlimited bandwidth, ₹0.
  5. Every git push to your main branch updates the site by itself. Add your own domain under Custom domains.

If you came from my reel and commented DEPLOY: this is the full guide I promised, with the domain steps and the free host list.

In this guide

"Free hosting means Vercel": read this first

Vercel is excellent, especially for Next.js, and its free Hobby plan is perfect for a portfolio, a college project or anything you build to learn. Keep using it for those.

The catch most tutorials skip is in Vercel's own fair use guidelines: the Hobby plan is for non-commercial personal use only. Commercial use means a site deployed for financial gain, and the guidelines count things like showing ads (for example Google AdSense) and taking payments. A commercial site needs Vercel's paid Pro plan (or Enterprise).

So if your site will ever earn, even a little from AdSense, you have two honest options: pay for Vercel Pro, or host it somewhere whose free plan has no personal-only rule. That is where Cloudflare Pages comes in.

My own portfolio is still on Vercel Hobby, and that is fine: it earns nothing.

What Cloudflare Pages gives you for free (and its limits)

Cloudflare Pages hosts your site on Cloudflare's global network, the same network that sits in front of a large part of the web. On the Free plan:

WhatFree plan
Sites (projects)Unlimited (a soft cap of 100 projects; you can ask for more)
BandwidthUnlimited
Requests for your static filesUnlimited
HTTPSFree, on the .pages.dev link and on your own domain
Price₹0 ($0)

The limits you might actually hit:

LimitFree planWhat it means for you
Builds500 a monthAbout 16 pushes a day. Plenty for one person.
Builds at the same time1Two quick pushes wait in line; nothing is lost.
Build time20 minutes per buildA normal React or Astro build takes one to three minutes.
Files per site20,000Only huge image galleries or docs sites get near this.
Custom domains100 per projectMore than you will need.

What you can host on it, and what you can't

Great fit: anything that builds into plain files (HTML, CSS, JavaScript, images). That covers a plain HTML site, a portfolio, a blog, documentation, and apps made with React, Vite, Vue, Svelte, Astro, Hugo, Jekyll, or Next.js with static export.

Not a fit: a traditional backend that runs all the time, such as an Express, Django or Laravel server with a MySQL or PostgreSQL database, a Discord bot, or a long-running job. Pages serves files; it does not keep your server process running. For those, see the free host list below.

Deploy your site, step by step

Step 1. Put your project on GitHub

Create a repository on GitHub (a "repo" is just your project's folder, online) and push your code to it. If you are starting fresh, name it something like my-first-site. Make sure it runs on your own computer first (npm run build should finish without errors for a React, Vite or Astro project).

Step 2. Create a free Cloudflare account

Sign up at dash.cloudflare.com. You don't need to own a domain to use Pages: your site gets a free .pages.dev address.

Step 3. Connect GitHub

In the dashboard, open Workers & Pages, press Create, choose the Pages tab, then Connect to Git. Pick GitHub and allow Cloudflare to see your repositories. You can give it access to all of them or only to my-first-site.

Step 4. Pick your repo and set the build

Select your repo and press Begin setup. Give the project a name (this becomes your name.pages.dev link), keep the production branch as main, and choose your framework under Framework preset. The preset fills the build command and the output folder for you; the table below shows what they should be.

Step 5. Save and Deploy

Press Save and Deploy. Cloudflare downloads your repo, runs the build and shows the log live. When it ends with "Success! Your site is deployed", your link is right under it:

Success! Your site is deployed
https://my-first-site.pages.dev

Open it on your phone. That's the whole DevOps.

Build settings for React, Vite, Astro, Next.js and plain HTML

Your projectBuild commandOutput folder
Plain HTML / CSS / JS(leave empty)/ (or the folder with your index.html)
Vite (React, Vue, Svelte)npm run builddist
Create React Appnpm run buildbuild
Astronpm run builddist
Next.js, static exportnpm run build with output: 'export' in next.config.jsout
Hugohugopublic

If your project needs secret keys at build time (an API URL, an analytics ID), add them in the project's Settings under Variables and Secrets, never in the code you push.

Add your own domain with free HTTPS

First, the honest part: a domain is not free. You buy it from a registrar (yearly). Connecting it to Cloudflare Pages costs nothing, and the HTTPS certificate is free. If you don't want to buy one, the .pages.dev link works forever.

  1. Open your Pages project and go to Custom domains, then Set up a custom domain.
  2. Type your domain, for example www.mysite.com or mysite.com, and continue.
  3. If your domain's DNS is already on Cloudflare (you added the domain to your Cloudflare account and changed its nameservers), Cloudflare adds the record for you. Confirm and you are done.
  4. If your DNS is somewhere else (your registrar's panel), add a CNAME record there for the subdomain (for example www) pointing to my-first-site.pages.dev. To use the bare domain (mysite.com without www), move the domain's DNS to Cloudflare; it is free.
  5. Wait until the domain's status turns Active. The padlock (HTTPS) is issued automatically; it can take a few minutes, sometimes longer while DNS updates.

Every git push updates the site

You never upload files by hand again. Each push to your production branch (main) starts a new build, and when it succeeds the live site switches to the new version:

git add .
git commit -m "New homepage"
git push

Pushes to other branches get their own preview link, so you can check a change before it goes live. If a new version breaks something, you can go back to an earlier deployment from the project's Deployments list.

Which free host fits which job

Your projectGood free choiceKnow this first
Static site or frontend that may earn (ads, sales)Cloudflare PagesUnlimited bandwidth; 500 builds a month; static files only.
Personal portfolio, learning project, Next.js appVercel HobbyBest Next.js support; non-commercial personal use only (no ads or payments).
Simple site straight from a repoGitHub PagesStatic only; GitHub says it is not meant for running an online business, e-commerce or SaaS.
Backend that runs all the time, with a databaseOracle Cloud Always FreeA real server, up to 4 cores and 24 GB RAM free; you manage it yourself. Getting one in Mumbai: my Oracle free server guide.
Small API or demo backendRender free web servicesFree services go to sleep when nobody uses them, so the first visit after a while is slow.
Small API next to your Pages siteCloudflare Workers (and D1 for a database)A different model from a normal server: short functions, not a process that keeps running.

Free plans change. Before you put something important on any of them, open its current pricing and terms page; the links are at the end.

When the build fails

  • "Output directory not found": the output folder in the build settings doesn't match your framework. Check the table (dist for Vite and Astro, build for Create React App, out for a Next.js export).
  • It builds on your computer but not on Cloudflare: usually a different Node.js version. Set the variable NODE_VERSION (for example 20) in Settings, Variables and Secrets, and deploy again.
  • Missing package errors: the package is installed on your computer but not listed in package.json. Run npm install the-package, commit package.json and the lock file, push again.
  • A page works from the homepage but shows 404 on refresh: for single-page apps, make sure there is no custom 404.html at the top of your output folder (Pages then serves your app for every path), or add a _redirects file for your routes.
  • Your old site still shows: open the Deployments list and check the newest one finished; your phone may also be showing a cached copy, so try a private tab.

Frequently asked questions

Is Cloudflare Pages really free?

Yes. The Free plan has unlimited sites, unlimited bandwidth and unlimited requests for static files, at ₹0. The limits are on builds (500 a month, one at a time, 20 minutes each) and files (20,000 per site).

Can I put AdSense on a site hosted on Cloudflare Pages?

Cloudflare's Pages plans and docs have no personal-use-only rule like Vercel Hobby's. As with any service, read Cloudflare's current terms for your case, and follow AdSense's own policies for the site itself.

Is a custom domain free?

No. You pay a registrar for the domain every year. Connecting it to Cloudflare Pages and the HTTPS certificate are free. The your-project.pages.dev link is free forever.

Can I host a backend or database on Cloudflare Pages?

Not a traditional one. Pages serves your built files. For a server that runs all the time with a database, use a server host such as Oracle Cloud Always Free; for small serverless APIs, Cloudflare Workers.

Is Vercel bad for free projects?

Not at all. Vercel Hobby is one of the best free hosts for personal, non-commercial projects. Only commercial use (ads, payments, paid client work) needs its Pro plan.

Sources

More From CodeWings

Verified TestFlight guides & trending beta drops in Guides

All Guides