How to deploy your websites to Cloudflare's Pages Platform for free

Muzafar Ali
20 Jan 202313:32

Summary

TLDRThis tutorial video guides viewers on deploying a website on Cloudflare Pages, offering free hosting with up to 10k daily requests. It demonstrates creating a Cloudflare account, setting up a project, and deploying via direct upload or connecting to a GitHub repository for automatic updates. The video also covers configuring build settings, managing environment variables, testing branches, and collaborating with team members, concluding with project deletion from Cloudflare Pages while retaining the GitHub repository.

Takeaways

  • 🌐 Cloudflare Pages allows you to deploy websites for free with up to 10k requests per day.
  • πŸ’» Start by creating an account at cloudflare.com and logging in to access the dashboard.
  • πŸ“ Click on 'Pages' to see existing projects or create a new one by clicking 'Create a Project'.
  • πŸ”— Two main options for uploading a website: Direct upload or connecting to a GitHub repository.
  • πŸ€– Connecting to Git automates updates, reflecting changes in the GitHub repository on Cloudflare instantly.
  • πŸš€ Demonstrated using 'Connect to Git' to deploy a website, starting with creating a GitHub repository.
  • πŸ“ Instructions on how to create a repository on GitHub, including naming and setting it to private.
  • πŸ”„ Showed how to commit an HTML file to the GitHub repository for testing purposes.
  • πŸ”‘ Detailed the process of connecting GitHub to Cloudflare for access to repositories.
  • πŸ” Discussed how to select repositories for Cloudflare Pages to access and deploy.
  • 🌟 Highlighted the ability to preview changes in different branches without affecting the production URL.
  • πŸ›  Mentioned the option to set environment variables for the website within Cloudflare's settings.
  • πŸ‘₯ Explained how to invite team members to collaborate on the website through Cloudflare Pages.
  • πŸ—‘ Demonstrated how to delete a project from Cloudflare Pages, noting that it does not affect the GitHub repository.

Q & A

  • What is the purpose of the video?

    -The purpose of the video is to demonstrate how to deploy a website on Cloudflare Pages, a platform that allows free deployment of websites with up to 10,000 requests per day.

  • Where should one start to deploy a website on Cloudflare Pages?

    -To start, one should go to desktop.cloudflare.com, create an account with Cloudflare, log in, and then navigate to the 'Pages' section on the dashboard.

  • What are the two main options to upload a website to Cloudflare Pages?

    -The two main options are 'Direct upload', where you can upload your website directly to Cloudflare, and 'Connect to Git', which connects your GitHub repository to Cloudflare for automatic deployment of changes.

  • How does connecting to Git on Cloudflare Pages work?

    -By connecting to Git, any changes made to your GitHub repository are automatically reflected in your Cloudflare deployment, ensuring that your website is always up-to-date.

  • What steps are involved in creating a repository on GitHub?

    -To create a repository on GitHub, you need to go to the 'Repositories' tab, click 'New', name the repository, set it as private or public, and then press the 'Create repository' button.

  • How can you upload a website to a GitHub repository?

    -You can either upload your website directly through the GitHub interface by creating a file, or you can clone the repository and push your website files from your local computer to the repository.

  • What is the process of connecting GitHub to Cloudflare Pages?

    -To connect GitHub to Cloudflare Pages, you need to configure GitHub access from Cloudflare, which may involve clicking 'Add account' and following the instructions to connect your GitHub account.

  • Why might you need to update the settings in GitHub to access a new repository from Cloudflare Pages?

    -You might need to update the settings if you initially granted access to only specific repositories and want to include a new repository, which requires selecting additional repositories in the GitHub Pages app settings.

  • What happens when you create a project on Cloudflare Pages?

    -When you create a project on Cloudflare Pages, you can choose a project name that will form part of your website's URL. The project name will be suffixed with '.pages.dev'.

  • How can you manage environment variables for your website on Cloudflare Pages?

    -You can manage environment variables by navigating to the 'Build settings' and then to 'Settings' in the Cloudflare Pages dashboard, where you can edit or add new environment variables.

  • What are the benefits of creating multiple branches in your GitHub repository for deployment on Cloudflare Pages?

    -Creating multiple branches allows you to test changes in a separate environment before deploying them to the production URL. This helps in ensuring that the production site remains stable and error-free.

  • How can you delete a project on Cloudflare Pages?

    -To delete a project, go to the 'Build settings', scroll down to 'Settings' in the 'General' section, and click 'Delete project'. You will need to confirm the deletion by typing the project name.

Outlines

00:00

🌐 Deploying Websites on Cloudflare Pages

This paragraph introduces the process of deploying a website on Cloudflare Pages, a platform that allows free hosting with up to 10,000 requests per day. The speaker guides viewers to create an account on Cloudflare, navigate to the dashboard, and start a new project. Two primary methods for uploading a website are discussed: direct upload and connecting to a GitHub repository. The speaker opts to demonstrate the 'Connect to Git' method, emphasizing its real-time update capabilities. The viewer is then directed to create a GitHub repository and upload HTML files, which will be connected to Cloudflare for deployment.

05:02

πŸ”— Connecting GitHub to Cloudflare Pages

The speaker continues by detailing the steps to connect a GitHub repository to Cloudflare Pages. This involves configuring GitHub access in Cloudflare, which may require connecting a GitHub account if not already done. Once connected, the speaker demonstrates how to select a repository for deployment. The process includes setting up a project with a unique name to avoid random word suffixes in the URL. The speaker also explains how to select the appropriate branch for deployment and enable automatic deployment for any changes pushed to the repository. Additionally, viewers are shown how to manage environment variables and other settings for their Cloudflare Pages project.

10:03

πŸ“š Managing Branches and Collaborators on Cloudflare Pages

In this paragraph, the speaker discusses managing multiple branches in a GitHub repository and how they can be reflected in Cloudflare Pages without deploying to the production URL. The speaker creates a new 'testing' branch from the 'Main' branch and updates the index file to demonstrate how changes in the testing branch are immediately visible in Cloudflare Pages. The speaker also explains how to invite team members to collaborate on a website by adding them to the project and configuring their access. Finally, the speaker shows how to delete a project from Cloudflare Pages, highlighting that this action does not affect the GitHub repository.

Mindmap

Keywords

πŸ’‘Cloudflare Pages

Cloudflare Pages is a platform provided by Cloudflare that allows users to deploy websites. In the video, it is the main service being discussed and demonstrated, highlighting its capabilities for free website hosting with up to 10,000 requests per day. The script details the steps to create an account, link a GitHub repository, and deploy a site using this platform.

πŸ’‘GitHub

GitHub is a web-based platform used for version control and collaboration, allowing multiple people to work on projects simultaneously. In the video, GitHub is used to host the website's code, which is then connected to Cloudflare Pages for deployment. The script explains how to create a repository and manage integration with Cloudflare.

πŸ’‘Repository

A repository, often shortened to repo, is a storage location for software packages, often used for managing code in version control systems like GitHub. In the video, the speaker creates a GitHub repository named 'demo project' to store and manage the website files, which are then deployed to Cloudflare Pages.

πŸ’‘Direct Upload

Direct Upload is an option provided by Cloudflare Pages to upload website files directly from a local computer. The video contrasts this method with connecting to a GitHub repository, showing that direct upload is a simpler but less automated way to deploy a website.

πŸ’‘Connect to Git

Connect to Git refers to linking a GitHub repository to Cloudflare Pages so that any changes made to the repository are automatically deployed. This is the method demonstrated in the video, emphasizing the seamless integration and automatic updates provided by this approach.

πŸ’‘Branch

A branch in version control systems like GitHub is a parallel version of a repository. Branches allow users to work on different features or fixes independently. In the video, the speaker creates a new branch called 'testing' to demonstrate how changes can be made and tested in a separate environment before merging them into the main branch.

πŸ’‘Deployment

Deployment is the process of making a website or application available for use. In the video, deployment occurs when the website files are pushed to Cloudflare Pages, making them accessible on the internet. The video covers both automatic deployment through GitHub integration and manual deployment via direct upload.

πŸ’‘Environment Variables

Environment variables are dynamic values that can affect the way running processes behave on a computer. In the context of the video, environment variables are used to manage configuration settings like API URLs and credentials, which can be set within Cloudflare Pages to customize the website's behavior.

πŸ’‘Team Collaboration

Team Collaboration refers to the ability to work jointly with others on a project. The video mentions that Cloudflare Pages allows users to invite team members and configure their access levels, facilitating collaborative development and management of a website.

πŸ’‘Delete Project

Delete Project is a feature that allows users to remove a deployed project from Cloudflare Pages. The video demonstrates this by showing how to navigate the settings and delete the project, while clarifying that this action does not affect the repository on GitHub, ensuring users do not accidentally lose their code.

Highlights

Deploying websites on Cloudflare's Pages platform is free and supports up to 10k requests per day.

Start by creating an account at cloudflare.com and logging in to access the dashboard.

Click on 'Pages' to view existing projects or create a new one.

Option to upload websites directly or connect to a Git repository.

Connecting to Git allows automatic updates to the Cloudflare deployment from GitHub.

Demonstration of deploying a website using the 'Connect to Git' option.

Creating a new repository on GitHub with HTML files for the website.

Instructions on how to upload a website directly to the GitHub repository.

Committing a new file to the GitHub repository for testing purposes.

Configuring GitHub access in Cloudflare to access repositories.

Updating GitHub settings to allow Cloudflare access to all repositories.

Selecting a GitHub repository to deploy on Cloudflare Pages.

Setting up the project name, which determines the URL.

Selecting the branch for deployment and enabling automatic deployment.

Viewing the deployed site and exploring additional settings.

Managing environment variables for the website through Cloudflare Pages settings.

Creating and testing multiple branches for different deployment sites.

Inviting team members to collaborate on the website through Cloudflare Pages.

Deleting a project from Cloudflare Pages and noting that it does not affect the GitHub repository.

Transcripts

play00:00

hello everybody this is in

play00:02

today's video I'm gonna show you how to

play00:04

deploy your website on cloudflare's

play00:07

pages platform so we can deploy our

play00:09

websites to cloudflare for free with up

play00:14

to 10k of requests per day

play00:17

to start please go to desktop

play00:19

cloudfooter.com

play00:21

and from there you create your account

play00:24

to cloudflare

play00:26

and once it is done login and then you

play00:31

will end up on this dashboard here from

play00:33

here click on pages

play00:36

and this will show you your existing

play00:38

projects if you have any otherwise you

play00:41

can press this create a project button

play00:43

and choose any of these options to

play00:47

upload your website to cloudflare

play00:49

so if you have your website ready on

play00:51

your local computer you can click on

play00:53

Direct upload upload it directly to

play00:55

cloudflare and another option which is

play00:58

quite interesting is connect to git this

play01:02

is where you connect your GitHub

play01:04

repository where you have your website

play01:07

uh this repository will be connected to

play01:11

cloudflare so any changes you do to your

play01:14

repository will be reflected in

play01:18

cloudflare deployment right away

play01:21

so I can go with direct upload

play01:25

but I think uh it is better to show you

play01:29

an example with a connect to git option

play01:33

so yeah without further Ado let's try to

play01:36

uh use this option to deploy our website

play01:41

to cloudflare pages

play01:43

before we do that let's go to our GitHub

play01:47

account and create a repository with

play01:49

some

play01:51

HTML files right so I'm here on my

play01:54

GitHub account I will go to repositories

play01:57

Tab and click new

play02:00

in here I will name the repository as a

play02:03

demo project and I'll keep it as private

play02:05

then I'll just press create repository

play02:08

button

play02:09

and then I will uh if you if you if you

play02:14

have a website locally you can upload it

play02:16

directly here uh like uh if you have

play02:21

like single file otherwise you can you

play02:23

know clone this repository and then push

play02:27

your whole website to the repository

play02:30

directly from your local computer in my

play02:32

case I'll just create a file from here

play02:35

I'll name it ad intex.html and here I

play02:39

will just add these contents since this

play02:43

is for testing purpose only right and I

play02:47

have H1 here and uh title and finally I

play02:50

have some message since this is a main

play02:53

uh Branch right so I'll just press

play02:55

commit new file button

play02:58

and then I will have this file here

play03:01

now let's go back to uh Cloud Player and

play03:04

here let's press this create a project

play03:07

button and click connect to git

play03:10

from here like you have to configure

play03:15

[Music]

play03:16

GitHub

play03:17

[Music]

play03:19

access in from cloudflare so cloudflare

play03:23

is able to you know access your

play03:26

repositories on your GitHub account

play03:28

for in my case it is already connected

play03:31

the cloudflare is already connected to

play03:34

my GitHub account so I am able to see my

play03:36

GitHub account here in your case you

play03:39

might need to click on the add account

play03:41

button and then follow the instructions

play03:44

to connect your GitHub account to

play03:46

cloudflare

play03:47

so once it is done uh you will find

play03:51

cloudflare's app in your GitHub uh

play03:54

settings

play03:56

and because of that integration uh you

play04:01

will be able to see your GitHub

play04:03

repositories in cloudflare

play04:06

so

play04:07

I am able to see these two repositories

play04:10

from my GitHub account but they are

play04:12

already in use and what I want to do now

play04:15

is I want to see this demo project

play04:18

repository in my cloudflare account so

play04:23

that I can deploy it to cloudflare pages

play04:26

right so I am not seeing uh that demo

play04:30

project repository here because I did

play04:33

not configure my uh

play04:35

uh GitHub cloudflare app in my GitHub

play04:39

account to access all the repositories I

play04:42

just selected specific uh these two

play04:45

repositories from there so in order I I

play04:48

in order to access this new repository I

play04:51

need to update the settings so from here

play04:53

I can click cloudflare Pages link

play04:56

and it will take me to my GitHub account

play04:58

and here I can see the settings for my

play05:01

GitHub Pages uh app in my GitHub setting

play05:05

right so it is inside the integration

play05:07

and applications and here I can see I

play05:10

have given access to cloudflare to these

play05:13

two repositories but I could also select

play05:16

you know all repository so it is able to

play05:18

access all but in my case I am following

play05:20

this option and let's now click on

play05:22

select repositories and then add another

play05:26

eight

play05:28

give access to the cloudflare pages to

play05:32

another repository I have here so demo

play05:34

project and then save

play05:37

so with that change I should be able to

play05:41

see uh that repository in My Cloud

play05:45

Player

play05:46

deployment settings so let's close this

play05:48

and go back to the original one so now

play05:51

yeah if you see this I can see this demo

play05:55

project repository let's click it and

play05:57

begin setup right

play05:59

and the name of the project uh uh like

play06:03

whatever uh name you want to give it

play06:05

here it will be your url so you see it

play06:09

is demo project

play06:10

and uh with that URL I am getting this

play06:13

uh

play06:15

uh website URL right so whatever is

play06:18

unique it will put dot Pages dot Dev

play06:21

right it will be suffixed with this URL

play06:26

so I think demo project is an existing

play06:30

repository let me create something that

play06:32

is unique so I don't get this random

play06:35

word there so let's say the first

play06:38

chapter we

play06:41

yeah so you see I am able to create this

play06:43

uh URL with this project name and it I'm

play06:47

not receiving any random uh word there

play06:49

because it is kind of unique right

play06:51

nobody has used this in cloudflare page

play06:54

before

play06:55

so yeah for now let's stick to demo

play06:58

project I don't care about additional

play07:00

word there

play07:05

and then let's select which branch you

play07:07

want this

play07:10

deployment to access right uh in my case

play07:13

I have only a main branch here so that

play07:16

I'm getting main branch here if I had

play07:18

like multiple branches I could get you

play07:21

know other branches here as well right

play07:23

so I won't change anything else I will

play07:26

just press save and deploy button

play07:29

and

play07:31

once it is done I should be able to see

play07:36

the deployed site

play07:40

so yeah it is almost done let's go back

play07:43

to GitHub and refresh

play07:47

and

play07:48

[Music]

play07:51

oh yeah I can see the status deployed

play07:54

successfully right so let's go back to

play07:56

this and

play07:58

I think deployment is done yeah let's

play08:03

click continue to project

play08:05

and

play08:07

uh from here I can see the URL already

play08:10

now let's go back to the pages again

play08:13

and we can see my new project being

play08:16

listed here I can click visit site to

play08:19

see my website uh directly

play08:23

so you see the URL we picked while

play08:25

creating the project so demo project doc

play08:28

dot pages.dev this is kind of uh

play08:32

uh like main URL for GitHub for cloud

play08:36

players pages so

play08:38

uh what we receive is sub domain

play08:41

basically uh with whatever project name

play08:44

we chose right so you see I am seeing my

play08:47

website deployed so this was a success

play08:49

now let's go back and explore a few

play08:52

settings

play08:53

so let's explore a few settings here let

play08:56

me click on view details and then

play09:01

I can see some settings uh

play09:04

let's click on build settings and then

play09:08

click on the settings link here

play09:11

from here we can see my

play09:15

production branch is Main and automatic

play09:18

deployment is enabled so whenever I push

play09:20

any change it will be deployed right

play09:22

away

play09:23

and

play09:25

I don't have any other settings

play09:28

one useful thing if you are using any

play09:31

environment variables in your website

play09:34

then you can you know edit them from

play09:36

here

play09:37

uh let's say you want to add any like

play09:43

you are using any apis and you want to

play09:45

configure your best URLs to that API

play09:48

maybe credentials to that API or

play09:50

whatever you can add all the environment

play09:52

variables here right so that is it for

play09:56

the environment variables and other

play09:59

things we can check here

play10:02

is

play10:04

we can also have like uh multiple

play10:07

branches and if we create any branch in

play10:11

our repository we can see uh whatever

play10:15

changes we do in that branch in here

play10:19

directly in Pages without even deploying

play10:22

to the production URL that is just URL

play10:25

right so let's go back to the repository

play10:28

and create a branch just to demo that

play10:31

thing so I'll create a new Branch for

play10:34

testing

play10:36

and I'll create it from Main Branch

play10:40

right so

play10:41

this is done now I have testing branch

play10:44

and uh

play10:46

from here let's go to code then load the

play10:51

testing branch

play10:53

in this Branch I will edit this file and

play10:56

update its message

play10:58

demand from Main Branch to testing

play11:01

branch

play11:02

just to demo this thing right

play11:05

so yeah now in my uh testing Branch I

play11:10

have that message now let's go back to

play11:13

uh

play11:15

our Cloud Player pages

play11:20

dashboard and in here if you click on

play11:22

view details

play11:25

you can see I have uh

play11:30

let's go to deployment settings

play11:35

I can see multiple deployment sites so

play11:38

this deployment was for Main and this is

play11:40

for the testing so this is this is this

play11:43

happened when we created a branch and

play11:46

this is when we updated the index file

play11:47

right so you see I am also getting the

play11:51

new URL for this branch so if I click on

play11:55

this one

play11:56

I'll see my change in that branch and if

play12:00

I go back to the original deployment if

play12:03

I refresh I won't see that change

play12:06

so this is useful in case you are

play12:09

testing something before deploying to

play12:11

production environment

play12:14

so yeah

play12:16

one other thing you can do is you can

play12:18

invite uh other team members to

play12:21

collaborate on some website here so for

play12:24

that you have to go to pages and there

play12:26

you can add members

play12:28

so whatever members you add you can

play12:31

configure their access and they will be

play12:33

able to collaborate with you on that

play12:35

website so okay so last thing we can do

play12:40

we can try is this go to the setting and

play12:44

see how we can delete this project so

play12:46

under build setting click setting and

play12:49

there if you go uh scroll down

play12:54

under settings in general

play12:58

you should be able to see delete project

play13:00

so here we can do delete project and

play13:03

write the name of the project and click

play13:07

delete

play13:08

uh this way we should be able to delete

play13:11

it yes it's gone now if you refresh it

play13:14

doesn't exist anymore but it is not

play13:17

deleted from your GitHub repository so

play13:20

not to freak out or something so yeah

play13:24

that's about it for this video I hope

play13:26

you liked it be sure to subscribe to

play13:29

this Channel and I'll see you in next

play13:30

video

Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
Cloudflare PagesWebsite DeploymentGitHub IntegrationFree HostingWeb DevelopmentStep-by-StepTutorialGitHubCloud HostingTech Guide