Hosting Reviews

How to Deploy Frontend Applications to Cloudflare Pages?

Deploying frontend functions is probably going one of many enormous points a time prior to now. However presently, it’s a piece of cake. Even a brisker can deploy functions with the help of large web internet hosting firms.

Many web internet hosting platforms allow us to deploy frontend functions in minutes. Our web site will probably be ready publicly in minutes.

Isn’t it good?

Yeah, it is.


Let’s learn how to deploy frontend functions on Cloudflare Pages.

Frontend Applications

Earlier than diving into the deployment part of the making use of, we might like to create one frontend utility.

How to do it?

Even you already comprehend it. So, we’re not any going to speak about it proper right here now.


We all know that there are quite a few libraries, frameworks in the marketplace for us to create frontend functions. However, the core part of these libraries or frameworks is JavaScript. You realize all that stuff, as you are already looking out for a method to deploy your frontend utility. You would skip this half and soar to deployment in case you’re solely looking out for the deployment half.

There may be React, Vue, Angular, JavaScript, and many further. One can create functions based totally on their requirements.

As we’re ready to see, there are a bunch of selections to create frontend functions. What regarding the deployment? Is it the an identical course of for all frontend functions?

Yeah, the deployment course of is comparable for all frontend functions. However, the strategy which makes frontend functions ready for deployment might vary based totally on the libraries and frameworks.


There’ll probably be a command to assemble for lots of the front-end functions constructed with libraries and frameworks. You would already find out about it. If you happen to don’t know what it is, you may have to look into it based totally in your frontend library or framework.

We would like an utility to deploy. Let’s organize a simple utility. You would skip this half if you already have a frontend utility to deploy.


Earlier than setup, we might like to focus on one issue. The entry degree ought to be index.html for our frontend utility to deploy it to Cloudflare pages. You would uncover the file index.html (location might vary based totally on library and framework) after the assemble course of.

We’re going to create a simple React and Plain JavaScript utility for the demo. You would choose another library or framework that you simply’re accustomed to. Let’s organize React utility first.

Run the subsequent command to create React utility.

npx create-react-app demo

Replace the app collectively along with your creativity, or go away it because it’s. I am going to merely change one factor to be sure that it’s deployed precisely on the end.

Now, let’s create a plain JavaScript utility.

Having index.html is compulsory for us. So, let’s create the file with the title index.html. Now, it is potential you may add further recordsdata like varieties.css, script.js, pictures, and so forth.., to make it look fancy. But it surely’s non-compulsory, though :).

Our simple setup for deployment is now achieved. What subsequent? It’s deployment time. Dive into it.


Cloudflare pages allow us to deploy our frontend utility from GitHub. So, there are two parts to the deployment course of.

  • First, we might like to have our utility code on GitHub.
  • Second, deploying the making use of to Cloudflare pages.

More often than not, you acquired’t have to concern regarding the first half as we preserve our code in web internet hosting platforms from the first day of the mission. You would skip the first half and head over to the deployment half.

If you happen to haven’t pushed your code to GitHub or it’s in several code web internet hosting platforms, you may have to shift it to GitHub to deploy to Cloudflare pages. You would observe the beneath steps to push your code to GitHub or do it by your self.

1. Pushing Code to GitHub

Do you’ve got a GitHub account? Yeah, I suppose usually. In case do you have to don’t have one, create one here.

  • Go to GitHub and log into your account.
  • Create a repository collectively along with your mission title. Right here, we’re naming it identical to the demo.

  • A newly created repository will look as follows. It reveals some git directions to fill your repository with code.

GitHub Repository

Let’s push our code to the repository that we now have created merely now. You would observe the beneath steps or do it your self in case you’re accustomed to it already. Let’s start by opening our mission in terminal or cmd.

  • Initialize the git with git init command.
  • Add your entire modifications to native git using the command git add ..
  • Commit the modifications with git commit -m "message" command. Change the message with a suitable message for the commit.
  • Now, we now have to be part of our distant repository to the native mission.
  • Command to be part of it is git distant add origin 'your_repo_path'. Change your_repo_path collectively along with your distant repository. The repository path will probably be as follows [email protected]:username/repo_name. My repository path for the demo is [email protected]:hafeezulkareem/demo.
  • The final step is to push the code to our distant repository. We are able to do it using the command git push -u origin predominant.

Let’s see the snaps of code inside the GitHub repository.

GitHub Repository Code

JavaScript Repository Code

We’re accomplished with pushing our code to Github. Our subsequent exercise is to deploy it to the Cloudflare Pages. With out extra ado, let’s start deploying.

2. Deploying to Cloudflare Pages

Let’s deploy the positioning to Cloudflare pages. Earlier than going to extra, we now have to create a Cloudflare account. If you happen to already don’t have an account in Cloudflare, then create one here. After the completion of constructing the Cloudflare account, you are ready to deploy your web site.

  • Go to the Cloudflare Pages web site.
  • Login to your account. You will note the dashboard as follows.

Cloudflare Pages Dashboard

  • When you have acquired logged into the Cloudflare website online, then it is potential you may not see your pages’ dashboard.
  • Navigate to the pages’ dashboard by click on on on the Pages button on the exact side of your Cloudflare dashboard. Refer to the beneath image.
Cloudflare Dashboard
Cloudflare Dashboard
  • Click on on the Create a mission button from the pages’ dashboard.
Create Project
Create Challenge
  • You’ll navigate to the subsequent net web page.

Project - First Step

  • Click on on the Join GitHub account to get our utility repository from GitHub.
  • You’ll probably be redirected to the GitHub apps net web page to authorize Cloudflare Pages.

GitHub Cloudflare Pages Authorization

  • We are able to present entry to all repositories or chosen ones. It’s greater to give entry to the repositories that we’re deploying to Cloudflare Pages. You would give entry to the entire repositories if you would like to.
  • Choose one in all many two selections.
  • When you have acquired chosen All repositories, there is no such thing as a such factor as a need to select the repositories’ specific repository. Click on the button Set up & Authorize.
  • When you have acquired chosen Solely select repositories, then you’ve got to select repositories from the dropdown. Click on on the Choose repositories dropdown that appears after deciding on the Solely select repositories alternative.

Repositories Dropdown

  • Enter your repository title as follows.

Search Repository

  • Your repository will probably be confirmed whenever you enter the title. Choose the repository. You may see the chosen repository on the excessive of the itemizing as follows.

Selected Repository

  • Click on on the Set up & Authorize button. You’ll probably be redirected to the Cloudflare Pages deployment net web page.
  • You will note all licensed repositories on the net web page.

Authorized Repositories

  • Choose the repository that you simply actually need to deploy.

Selecting the Repository to Deploy

  • After deciding on the repository to deploy, click on on on the Start setup button.

Begin setup

  • It would take you to the next steps inside the deployment course of, i.e.., Arrange builds and deployments.

Set up builds and deployments

  • If you scroll down, you will discover a bit generally known as Construct settings. We have now to select the acceptable assemble course of for our frontend utility.
  • We have now to select the assemble course of based totally on the framework or library we’re using.
  • Click on the Framework preset to see all selections.

Build - Framework Preset Options

  • Right here, we’re deploying React and Plain JavaScript functions.
  • If you happen to’re deploying a React utility, then select Create React App from the dropdown.
  • For a Plain JavaScript utility with none packages, then select None.
React App Build Config
React App Construct Config

Plain JavaScript Build Config

  • If you happen to’re deploying one other frontend utility, then select the acceptable Framework preset assemble alternative.
  • We are able to select None and enter the personalized assemble command as properly. Primarily based in your utility, select it.
  • After the assemble config setup, click on on on the Save and Deploy button to finish our deployment course of.
  • When you click on on the Save and Deploy button, the deploy course of will start as follows.

Deploying Process

  • The course of will take couple of minutes to deploy our web site. Wait and luxuriate in.
  • After the completion of the deployment course of, it reveals you the positioning URL with a success message.

Deployment Success

  • Go to the positioning with the given URL.
Demo Live
Demo Dwell

Demo Live

  • We are able to substitute the settings of the positioning from the mission net web page.

Site Settings

  • Cloudflare pages will routinely deploy the updates every time we push new code to the repository.

That’s it. We’re accomplished with deploying our frontend utility to Cloudflare pages.


Hurray! we now have deployed our frontend utility to the Cloudflare Pages. After deploying the frontend utility, you may have to change settings, substitute points, and so forth..; refer to the Cloudflare documentation here. If you happen to want to see the steps to deploy a selected framework info, it is potential you may head over to the framework guides half inside the documentation.

Subsequent, how about deploying the frontend to Netlify?

Word: The demo web sites confirmed inside the article won’t be accessible publicly after some time.

Completely satisfied Deploying 🙂

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *