Why We Ditched Vercel for Our NodeJS App
Tags: webdev, javascript, devops, startup
Published: 2024-07-12 19:57:23

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](https://www.reddit.com/r/nextjs/comments/13vi7rz/anyone_else_have_trouble_with_slow_serverless/). 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](https://x.com/zemotion/status/1798558292681343039) 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.

![Jetify Deploy Dashboard](https://res-3.cloudinary.com/jetpack-io/image/upload/q_auto/v1/blog/deployment.png)

Introducing [Jetify Deploy](https://www.jetify.com/deploy), a platform that incorporates the best properties of edge-function while avoiding its drawbacks:

1. 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](https://www.jetify.com/devbox/docs/configuration/) or Dockerfile if you want more control.
2. No application code change: there are no special libraries you need to import or hidden route splitting that happens behind the scenes.
3. Zero DevOps: no Terraform, Ansible, or shell scripts needed. Import your application code from GitHub, and we will handle the rest.
4. Stateless: deployments are as disposable assets, not precious pets. Past deployments are kept as idle copies until needed.
5. 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.
6. Write once, run anywhere: wrap your project with [Devbox](https://www.jetify.com/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](https://www.jetify.com/cache), and [Jetify Secrets](https://www.jetify.com/devbox/docs/cloud/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](https://twitter.com/jetify_com), or chat with our developers live on our [Discord Server](https://discord.gg/jetify). We also welcome issues and pull requests on our [Github Repo](https://github.com/jetify-com/devbox).