πŸ“’ Advertisement β€” AdSense unit goes here
TutorialAstroWeb Dev

How to Build a Personal Blog with Astro and Deploy it Free

Step-by-step guide to launching a fast, SEO-optimized blog using Astro and Cloudflare Pages β€” completely free.

Why Astro?

Astro is the best framework for content-heavy sites in 2025. It generates pure static HTML β€” no JavaScript bloat β€” which means:

  • ⚑ Perfect Lighthouse scores
  • πŸ” Excellent SEO out of the box
  • πŸ’° Free hosting on Cloudflare Pages

Let’s build it.

Prerequisites

  • Node.js 18+ installed
  • A GitHub account
  • A Cloudflare account (free)

Step 1: Create Your Astro Project

npm create astro@latest my-blog
cd my-blog
npm install

Choose the β€œblog” template when prompted. It sets up everything you need.

Step 2: Run It Locally

npm run dev

Open http://localhost:4321 and you’ll see your blog running.

Step 3: Push to GitHub

git init
git add .
git commit -m "initial commit"
gh repo create my-blog --public --push

Step 4: Deploy to Cloudflare Pages

  1. Go to pages.cloudflare.com
  2. Click Create a project β†’ Connect to Git
  3. Select your GitHub repo
  4. Set build command: npm run build
  5. Set output directory: dist
  6. Click Save and Deploy

Your site will be live in under 2 minutes at a *.pages.dev URL.

Step 5: Connect Your Custom Domain

  1. In Cloudflare Pages β†’ your project β†’ Custom domains
  2. Add nareshtech.net
  3. Since your domain is already on Cloudflare Registrar, DNS updates automatically

That’s it. Your blog is live on your custom domain, with SSL, for free.

Writing Your First Post

Create a new file in src/pages/blog/:

---
title: "My First Post"
description: "A short description"
pubDate: "2025-01-20"
tags: ["Tag1", "Tag2"]
---

Your content here in Markdown.

Push to GitHub and Cloudflare auto-deploys in ~30 seconds.


Next Steps

  • Set up Google Analytics
  • Apply for Google AdSense
  • Add affiliate links to your posts

Happy blogging! πŸš€

πŸ“’ Mid-article AdSense unit goes here

Enjoyed this? Read more articles β†’