I am looking for alternative solution after Heroku free dynos are no longer available. Basically what I am trying to achieve is to host my API services and I stumbled upon serverless solution. It is a very small application with only 3 endpoints to serve, and I am thinking to give serverless a try.
There are two options that are viable for me.
After experiment with Cloudflare workers. Here are my thoughts about it.
Very easy to get started
With the wrangler
tool and good documentations. I managed to get a worker up and running and publish it in no time.
Development experience is good
Changes in files are reflected immediately without having to restart dev server.
Deployment is simple
Hassle free and quick. Make changes and deploy and the endpoints are live.
APIs are fast
Not to mention the API response are pretty fast, that's a bonus.
Managing environment variables for staging and production are easy
Even come with encrypted options for sensitive data and can be configured from dashboard or CLI.
However
It is JS runtime, not node environment.
For my case, it's not working for some of the existing API, due to dependency on external node package, stripe
.
However I managed to get it to work with node_compat = true
, but other packages doesn't work well, like firebase-admin
.
I can get around that with Restful API provided by Firebase and Google, but I need to rewrite existing code that is working already from using SDK to using Restful APIs.
Despite I didn't go with Cloudflare workers, given that it's not the right tool in my use case, cause I need to run the existing project without rewriting it, but it is very promising product and I would definitely revisit it for my future projects.
That's it!
Cheers.