
Leaving Serverless
After diving head first into serverless cloud hosting for months I have realised that serverless might not be the future for everybody.
Why did I go serverless in the first place?
I have to be honest it was because I discovered programming content on YouTube. There I found a video tutorial that suggested using many serverless services, like Planetscale, Vercel, Upstash, etc. It really rekindled 🔥 my enthusiams for software development as a whole.
The implied simplicity, speed and scalability of serverless truly intrigued me. Each new service seemed like unlocking another adventure with the promise of finding something revolutionary.
When to use serverless?
Static Websites
Go serverless if all you do is host a static website. There is a reason why Google’s Firebase (for example) offers free hosting. It requires virtually no resources. All you need to do is configure a CDN and your site opens blazingly fast all over the globe 🌎.
Server Side Rendering
Do you really need to render something on the server?
So you are sure that you need to use SSR. Go serverless. You most likely use Nodejs for SSR, which uses too many resources and will not run on a small server. Especially next.js in my experience only runs well on Vercel. For example, as of version 13.4.8 next.js crashes 💥 if you host it yourself.
Server Time!
Database
As soon as you need a database you should get yourself a server. It is faster, simpler and so much more versitile.
It takes only a minute or two to spin up a vm, connect with a terminal and install MySQL. You end up with a no-compromises database with virtually infinite documentation on the internet.
- Simple: You can ask Google or ChatGPT for everything. You will immediately get an answer.
- Fast: You can run big queries in milliseconds, even on minimal hardware.
- Veristile: Your database is not limited in features, because it is “serverless”.
REST API
Put your API on the same VM as your database and watch it go brrr 🚀
My most recent application has API response times of under 100 ms. In the meantime serverless has to resort to tricks like skipping SSL/TLS to keep request times acceptable. The truth is that most of the time is lost waiting on the network.
Static Websites
You have a server for your database and REST API? Why not use it to host your static website as well? It is literally free!
Conclusion
If you have some personal projects that you would like to share with the world. You are most likely better off getting a nano server.
It does not automagically scale to millions of users. But it scales with your creativity and ideas.
There is more to come …
I am currently working on written tutorials teaching you how to set up and managing your server with ease.