For a long time, having my own website was one of those things I kept telling myself I’d “get to eventually.” Not because I didn’t know how to code (I did), but because the idea of taking something from my laptop to a real, working domain that anyone in the world could type in and land on felt bigger than it should have. This post is about that process: not just the technical steps, but the small wall of frustration I had to climb to get nirajbasnet.com.np live.
Starting with Astro
I picked Astro because I wanted something fast and simple, without the bloat of a full framework I didn’t need for a personal site. I wrote and structured the whole thing in VS Code, and pushed it to GitHub under my niraj-basnet repo. Every commit felt like a small checkpoint, proof that I was actually building something instead of just planning to.
Discovering Cloudflare Pages
I’d heard of Cloudflare mostly for DNS and security, so it took me a while to realize it could also host and deploy my site. Here’s the path I took, step by step:
- Went into Cloudflare → Compute (Workers & Pages), which is where Cloudflare now houses both Workers and Pages projects.
- Created a new Workers & Pages application, and chose to connect it to my GitHub repo rather than upload files manually.
- Linked my GitHub account, selected the
niraj-basnetrepository, and let Cloudflare pick up the Astro build settings automatically. Every time I pushed a commit from VS Code after that, Cloudflare would rebuild and redeploy the site on its own, genuinely one of the more satisfying feedback loops I’ve experienced as a beginner.
The DNS Rabbit Hole
This is where things got messy, and honestly, where most of the “struggle” of this whole project lived.
I wanted www.nirajbasnet.com.np to be the “real” version of my site, but I also wanted people who typed in the domain without the www to land in the same place instead of hitting an error or a broken page. That meant:
-
Creating a subdomain with
wwwin Cloudflare’s DNS settings, pointing it at my Pages deployment. -
Adding
www.nirajbasnet.com.npas a Custom Domain inside my Astro project under Workers & Pages → Custom Domains, so Cloudflare knew this domain belonged to that specific deployment. -
Writing a redirect rule so that anyone landing on the bare domain would get forwarded to the www version. The rule I set up was:
- If the URL matches:
nirajbasnet.com.np/* - Setting: Forwarding URL
- Status: 301 - Permanent Redirect
- Destination:
https://www.nirajbasnet.com.np/$1
Then I saved and deployed the rule.
- If the URL matches:
I remember sitting there refreshing the browser like it was going to change something instantly. It didn’t. DNS propagation is one of those things where you just have to sit with the discomfort of not knowing if you broke something or if it just needs time. I tested https://nirajbasnet.com.np and watched it dutifully redirect to https://www.nirajbasnet.com.np, and honestly, that quiet little redirect felt like a bigger win than it probably should have.
What This Actually Taught Me
The technical steps look clean when I list them out like this. In the moment, they weren’t. I second-guessed almost every setting: was I in the right tab, did I pick the right forwarding rule, would this break the site that was already live. There’s a particular kind of anxiety that comes with touching DNS settings for something that has your actual name on it.
But that’s kind of the point of writing this down. Not to make it sound like a tutorial I mastered on the first try, but to be honest that most of building something (a website, a habit, anything) is just tolerating the uncertainty long enough to see if it works.
It did. And now, when someone visits nirajbasnet.com.np, they land exactly where I meant for them to.
If you’re building something similar and you’re stuck in that same DNS-propagation limbo, wondering if you broke your own site, you probably didn’t. Give it a few minutes. Refresh again. It usually just needed time, same as most things do.
