ruang.work

Easy Deploy Astro Dengan Cloudflare Page

  • Avatar for Ilham Nuruddin Al Huda
Ilham Nuruddin Al Huda
•

4 min read

Astro is an all-in-one web framework for building fast, content-focused websites. By default, Astro builds websites that have zero JavaScript runtime code.

go to Multi-Page Application (MPA) section

Multi-Page Application (MPA)

A Multi-Page Application (MPA) represents an intricate web architecture, encompassing multiple HTML pages predominantly served from a centralized server. Each time a user navigates to a different page, the browser sends a request to the server to fetch the corresponding HTML page. One prominent exemplar of an MPA framework is Astro.

Additionally, traditional MPA frameworks comprise well-established platforms such as Ruby on Rails, Python Django, PHP Laravel, WordPress, Joomla, Drupal, as well as static site builders like Eleventy or Hugo.

go to Embracing the Server-First Approach section

Embracing the Server-First Approach

Astro embraces a server-side rendering approach, aligning with established practices of traditional server-side frameworks like PHP, WordPress, Laravel, and Ruby on Rails.

This eliminates the need to master a secondary server-side language, as Astro maintains the simplicity of HTML, CSS, and JavaScript (or TypeScript).

In contrast, modern JavaScript web frameworks like Next.js, SvelteKit, Nuxt, Remix, and others primarily rely on client-side rendering, using server-side rendering for performance optimization.

While this Single Page App (SPA) model offers advantages, it introduces complexity and performance tradeoffs that negatively impact page performance, especially for content-centric websites where swift first-load performance is crucial.

go to Benefits of Deploying Static Sites with Cloudflare Pages section

Benefits of Deploying Static Sites with Cloudflare Pages

Deploying static sites with Cloudflare Pages offers several significant benefits, making it an attractive choice for website hosting and delivery:

In summary, deploying static sites with Cloudflare Pages empowers you with exceptional performance, security, scalability, and ease of use, allowing you to focus on creating outstanding web experiences for your audience.1

go to Prerequisites section

Prerequisites

Before proceeding, ensure the following prerequisites are met:

If you don’t have one yet, you can follow the step-by-step tutorial to create a blog.

go to Deploying with Cloudflare Pages section

Deploying with Cloudflare Pages

To deploy your site to Cloudflare Pages, follow these steps:2

  1. Log in to the Cloudflare dashboard and select your account.
  2. In Account Home, navigate to Workers & Pages > Create application > Pages > Connect to Git.

Workers & Pages
Workers & Pages
Create application
Create application

  1. If you haven’t done so already, authorize Cloudflare to access your GitHub account.

Pages > Connect to Git
Pages > Connect to Git
Select Repository
Select Repository
Select Framework
Select Framework
Save & Deploy
Save & Deploy

  1. This access is essential for Cloudflare to monitor and deploy your projects from the source. If you prefer, you can restrict access to specific repositories; however, you’ll need to manually update this list within your GitHub settings when adding more repositories to Cloudflare Pages.

  2. Select the newly created GitHub repository and, in the Set up builds and deployments section, provide the required information.

go to Footnotes section

Footnotes

  1. Cloudflare Pages documentation ↩

  2. Deploy an Astro site ↩