This content originally appeared on DEV Community and was authored by John Lago
In the world of web development, the search for the ideal hosting solution is never-ending. Like many others, we initially fell in love with Vercel for its user-friendly interface and near-zero setup. Vercel is an excellent solution for static sites, perfect for our websites and documentation. CDN caching makes everything fast, efficient, and cost-effective.
Given our positive experience with Vercel for static sites, we decided to host our NodeJS servers there as well. We had several Remix servers we thought could be supported by edge functions. After all, isn't the future all about going serverless? We decided to host our authentication flow and dashboard app on Vercel using edge functions. Spoiler alert: it did not go well.
Why Vercel Doesn’t Cut It
Speed Issues: The Dream Dies
Our first red flag was performance. Serverless functions on Vercel were not up to par in terms of speed. And it wasn’t just us—many developers have voiced similar frustrations. For an application handling critical user interactions like authentication, speed is paramount. The delays were noticeable, often around 600ms to 1 second.
Debugging Nightmares: The Endless Cycles
Vercel detects the framework of your NodeJS server in an attempt to turn each route into an edge function. Server-side libraries may build successfully for edge functions yet encounter issues at runtime without notice. With most bugs not reproducible locally, and the remote environment is not something you can SSH into, endless trial and error becomes the norm. What’s worse, you may find out the package you need is not edge-function compatible at all.
Cost Explosions: The $96K Surprise
For customers, calculating usage is no longer as simple as total billable hours for a single EC2. To make it more concrete, a single JS server that contains ten routes will split into ten different edge functions. While Vercel gives you uptime and scalability guarantees, a shocking $96K bill may knock on your door if you get a spike in usage.
The bottom line
Going serverless for an app that clearly needs a backend server? In hindsight, that should make us pause for a second. Just because the server is written in JavaScript, does not mean we should treat it differently from a server written in Go, Rust, or Python. The bottom line — infrastructure should be language and framework-agnostic.
The ultimate dream: an edge-function-like platform for Backend
Without a good substitute for Vercel’s edge functions, we Jetifiers like to build our own.
!https://res-3.cloudinary.com/jetpack-io/image/upload/q_auto/v1/blog/deployment.png
Introducing Jetify Deploy, a platform that incorporates the best properties of edge-function while avoiding its drawbacks:
- No Dockerfiles needed: don’t know how to write Dockerfiles or Kubernetes YAMLs? No problem, you don’t have to. However, you can provide a devbox.json or Dockerfile if you want more control.
- No application code change: there are no special libraries you need to import or hidden route splitting that happens behind the scenes.
- Zero DevOps: no Terraform, Ansible, or shell scripts needed. Import your application code from GitHub, and we will handle the rest.
- Stateless: deployments are as disposable assets, not precious pets. Past deployments are kept as idle copies until needed.
- Easy cost management: Your server spins up when it gets a request and spins down when idle. You won’t get a hundred edge functions just to handle a surge in requests.
- Write once, run anywhere: wrap your project with Devbox to get an identical environment for local, preview, and production. Any issues encountered on production can be reproduced locally. Or anywhere.
Looking ahead
We have successfully migrated our authentication flow and dashboard app from Vercel edge functions to Jetify Cloud. The transition was smooth, and we have seen significant improvements in speed, debuggability, and cost.
We are excited to share our journey and encourage others facing similar challenges to explore new possibilities. You can try Jetify Cloud for your own solo projects with a 30-day free trial. Jetify Cloud accounts also come with access to the Jetify Cache, and Jetify Secrets:
Stay tuned as we continue to refine our setup and share more insights. If you are struggling with your current hosting solution, we hope our story inspires you to find your perfect fit. You can follow us on Twitter, or chat with our developers live on our Discord Server. We also welcome issues and pull requests on our Github Repo.
This content originally appeared on DEV Community and was authored by John Lago
John Lago | Sciencx (2024-07-12T19:57:23+00:00) Why We Ditched Vercel for Our NodeJS App. Retrieved from https://www.scien.cx/2024/07/12/why-we-ditched-vercel-for-our-nodejs-app/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.