I wanted to create a functionality where every user of mine gets their own subdomain. And for that I needed my hosting provider to support wildcard(*) subdomain. So that anything.joyzo.in will resolve to *.joyzo.in where I have my application server running. And my application can then extract the subdomain "anything" from the full url anything.joyzo.in and build the page accordingly. As you know I am a returning-back dev and this seemingly simple task took almost 2 weeks for me, trying various hosting service providers. And finally got it done, ofcourse.
Here are my learnings:
1. Firebase
My app is in flutter. I started off thinking firebase would be ideal with seamless integration, because, you know, Google. Also, more importantly, I did not want to go searching the world for the best stack. So firebase it was. And seamless it did. Hosting worked fine. CLI was helpful. And then came the bummer.
Firebase does not support wildcard subdomain. Plain and simple NO. No turn arounds. No hacks. Nothing. You can afford two 10 days to not believe me.
2. Netlify
Then came Netlify. I follow a indie developer in Linkedin and sometime back he said he uses Netlify. So why not. There could have been many benefits and one was evident immediately. Drag and drop files to build. Cannot ask for anything simpler. But then came the bummer.
Netlify supports wild card subdomain but only for pro version. Pro version costs $19 per month. And we'll never know how easy it is to set up with a pro version ๐
But there is one important learning I had with Netlify. I learnt about NameServers.
Use this prompt to understand about nameservers in detail:
"explain nameservers like I am a fresh college grad with a CS degree".
But here is my version. A citizen developer who is looking to get things done version:
I bought my domain name joyzo.in from Godaddy. and then began development in flutter. And when I had a poc built ready in flutter, I wanted to host it. So that end users can visit joyzo.in and use my app. Fairly clear requirement. And thus came firebase. I have some idea about how firebase works. so I hosted my app in firebase and the app was live with a firebase project url. Now I researched about adding custom domain. Just by following steps I was able to make few changes and add my custom domain joyzo.in to this firebase project url. And bam, the app was live. And in the process I had to do a lot of configurations in my Godaddy domain control panel. and a only a few in firebase. Why? because my domain joyzo.in was using Godaddy nameservers. That's why I had to do a lot of configuration changes in Godaddy control panel versus firebase where the only change I had to do was to add a custom domain. So nameservers is the place where we do many changes. But what are those many changes? Changes like adding CNAME , TXT, A etc.. these are called DNS records. and nameserver is where your DNS is hosted so that you can make these "lot of" changes there. How did I specifically learn about nameservers when trying Netlify? Nothing specific. I had a documentation about changing nameserver from domain registrar, Godaddy, to Netlify. And what is the benefit? Actually there is no outstanding benefit except the fact that now you can add/modify/remove DNS records from the place where you host, Netlify, than from your domain registrar, Godaddy. We'll be anyhow using hosting services from the web interface frequently. So this is a convenience to have your dns hosted there as well. And firebase did not speak about nameservers. I am unsure whether there is a nameserver option in firebase. But Netlify do have it. They did speak about it. And now I know about it.
3. Vercel
As much as I was excited, I was disappointed that Netlify allowed wildcard subdomains but only for pro version. So researched further and found Vercel. This release post from Vercel is actually the one that caught my eye while I was still exploring other hosting options like Cloudfare, AWS, GCP etc.. And it was a breeze. Just setup your repo, set the prod branch, build script, install script and that is it. you are done hosting. Previously learnt nameserver and custom domain setup knowledge helped. Then come the important part, wildcard. It was another breeze. Just following the steps in the release post made it work like a charm. And here I have, my poc running:
try changing the subdomain from "anything" to anything and see them all resolving to the same app.
Along side I got myself familiar with DNS records and their usages. Not expert level but I know when to change what and change what to what. I will follow up about DNS records with a post if asked for, in comments. If not, will be busy building Joyzo and sharing the journey here in dev.to exclusively.
Top comments (0)