Setup a website with Cloudflare Pages

Cloudflare Pages is a platform designed with developers in mind, enabling seamless deployment and hosting of static websites or JAMstack applications straight from your GitHub repository. Leveraging Cloudflare's global network, it promises swift load times and compatibility with an array of web frameworks, in addition to basic HTML. Offering features such as custom domain integration and automatic SSL, Cloudflare Pages simplifies the web deployment process, allowing developers to focus primarily on coding, reducing infrastructure concerns.

Getting Started with Cloudflare

Once you've logged into Cloudflare, locate "Workers & Pages" on the left side menu. To establish a new website, simply click on "Create application".

Cloudflare Pages Overview

Understanding Cloudflare Pages

During the setup process, you'll need to grant Cloudflare access to your preferred Git-Repository, either on Github or GitLab. Following this, you'll define your build process. As this step relies heavily on your chosen framework, a one-size-fits-all guide isn't possible here. However, the Cloudflare Pages documentation provides a wealth of examples to assist you.

A commonality I've noticed across various frameworks is the need to stipulate the Node.js version. If your framework requires Node.js, you can specify the version under the "Environment Variables" section. Simply create a new variable labeled NODE_VERSION and assign your desired value, such as 16.16.0.

Customizing Your Domain

Each successful build provides a preview URL, allowing you to test your website. However, if you prefer to use your personal domain, you'll need to add it to Cloudflare. Navigate to the "Custom domains" section and click "Add custom domain". You'll then need to add a CNAME record to your DNS settings, with the value being the preview URL received from Cloudflare. Following this, you'll be able to assign your domain to your website.

Cloudflare Pages Custom Domain Overview

Conclusion

Cloudflare Pages offers an exceptional platform for deploying static websites free of charge. For non-static websites, bear in mind that surpassing 100k requests per month incurs a fee. However, this limit should suffice for the majority of websites.

Though the initial setup of the build process may present a challenge, it becomes effortlessly maintainable once established.

Website