My Static Site Workflow
In this post I will walk you through my static site workflow making this website possible & the 💰 money it costs me.
Domain
I leased the domain cosmicqbit.dev
back in 2021 from Namecheap, which is still my preferred choice for a domain registar. I had another domain previously registered on GoDaddy, which I got transferred to Namecheap as well for a) low pricing b) free whois privacy
Back in those days, Freenom was well known for providing free domains & I used that opportunity to its fullest for some side projects. And later due to of the abuse by bad actors like launching fishing attacks it got sued by Zuck’s Meta.
The domain costs me around $17 (taxes included) annually which is ~₹1400. I’m willing to pay that much for owning a little space on the web. On the same note .dev Top Level Domain (TLD) generally costs a bit higher as compared to mainstream TLDs like .com .net which costs between ₹800-1000 annually.
Code Editor & Source Code Management
For writing code I use VSCodium VSCode. I switched to VSCode not so long ago, simply because it is super snappy on M1 like every other app. VSCodium has been my choice for last 4 years but not anymore.
It was the only app on my machine taking too long to launch – 5 seconds… yeah that is too much & the reason is VSCodium is not optimized for M1. Besides it doesn’t make any significant difference in terms of telemetry logging when the code is going to Github anyway, also owned by Microsoft.
Using git as a version control system I commit & push the changes to Github which acts as a remote source code respository for build phase.
Static Site Builder
I use Hugo for static site generation, which is a Go-based world’s fastest static site builder. It feature templating therefore I write the posts in plain markdown, which heavily reduces the friction of getting new posts published.
Usually to generate the static files for deployment we have to run a couple of hugo based commands. I have compiled them into a small bash function to ease the phases of build, commit and pushing to remote.
Build, Deployment & DNS Management
The site is hosted on Cloudflare Pages which also takes care of Continuous Integration & Continuous Deployment (CI/CD) phase. The CF deploys the final build on pages.dev subdomain which is mapped to the actual root domain.
I use Cloudflare for DNS management as well because of its sleek UI and tons of features Cloudflare provide in general, for example DDoS protection, web traffic analysis, email routing, email forwarding & CDN spread across all over the world.
The Cloudflare offers 100,000 requests per day in free tier for pages & workers, which is more than enough for my blog besides other projects. So technically hosting doesn’t cost me a penny. For my other side projects I utilize the subdomains which can be created on will without any limit & Cloudflare pages suffice for hosting.
Summary
To get a new post public:
- I launch my terminal with a keybinding
shift
+space
- Hit
blog
alias which automcatically change directory into my portfolio repo & launches code editor. - I then create a new md file manually with YY-MM-DD-title.md naming format and start writing.
- After saving the changes I switch back to terminal with key binding, run
hugopush <commit-message-here>
alias which builds the code and generates static files in /public directory and then pushes the code to remote repository. - The new changes in the github repo trigger the CI/CD pipeline in Cloudflare pages, a new build starts and if it succedes the build is deployed in production.
Post commiting the new changes to github the post gets live in less than a minute. That is all it takes me to own a personal space on the web and keep it afloat.
Reply via mail