Skip to content

Cloudflare

How to Deploy Astro JS Project to Cloudflare

Cloudflare Pages is the recommended hosting option for the Blacks template — free forever, with unlimited bandwidth and a global CDN.

This guide walks you through deploying your Blacks project to Cloudflare Pages step by step.

Before you begin: Make sure your Blacks project is pushed to GitHub. Read how to push on GitHub →


Create Cloudflare Account

Cloudflare astro js themes template

Go to cloudflare.com and create a new account. It’s free.


Workers and Pages

production astro js themes template

From your Cloudflare dashboard, click the Workers & Pages menu.


Create Application

Astro js themes template cloudflare

Click Create application.

Then:

  1. Select Pages
  2. Click Connect to Git

Select GitHub Repo

cloudflare deploy astro js themes template

Select your GitHub repository from the list. Click Next.

On the Framework setting, select Astro.

Then click Save and Deploy.


Finish — Your Site Is Live

astro js cloudflare deploy

Your website is now live at:

https://your-project.pages.dev

Every future push to your Git repository triggers an automatic build and deploy.


Add Custom Domain

From your Cloudflare project dashboard:

  1. Click the Custom domains tab
  2. Click Set up a custom domain
  3. Enter your domain name
  4. Follow the DNS setup instructions

HTTPS is enabled automatically.


Build Settings Summary

SettingValue
Build commandnpm run build
Build output directorydist
FrameworkAstro
Node version20 or newer

Troubleshooting

ProblemSolution
Build failsCheck that Node.js version is 20 or newer
404 errorsVerify output directory is dist
Images not loadingCheck site URL in astro.config.mjs
Custom domain not workingWait for DNS propagation (5–30 minutes)

Next Step

Explore other hosting options:

👉 Netlify — alternative static host with drag-and-drop deploy