Hacker News new | ask | show | jobs
by solardev 1281 days ago
Front end dev here, formerly full stack. For moderate to high complexity apps, I would choose Next.js on Vercel for its incredible developer experience relative to either vanilla JS or React without Next.

If you don't care about React (for its popularity) it might also be worth considering other frameworks.

I would remove as much of the backend as possible and store whatever I could on the edge and use serverless functions extensively (also built into Vercel and Next). Failing that, I would outsource the backend to a headless CMS or a managed database. I would abstract as much of it as possible instead of having to manage containers and VMs.

Javascript is incredibly powerful these days and the backend can often just be a dumb data store. Vercel is incredibly innovative and IMHO one of the two companies really pushing the Web forward (the other being Cloudflare).

My rationale is that this stack allows you to spend the vast majority of your code on business logic instead of infrastructure.

You can write each page in a few minutes, git push, and it's automatically built and hosted and cached. Stacks that used to take days to set up now takes mere minutes. It's so much better than it was even 4 or 5 years ago.

Next took me from hating React and JS to falling in love with it. I enjoy every new project I write in this stack, something I've never experienced before in any other language, frontend or back. It feels like the only stack that was designed with developer experience in mind. It's purpose built for web apps.

2 comments

The Vercel CEO https://twitter.com/rauchg/status/1603965931293536257 and I would agree.

Also, many others and I would leverage a few extras. Typescript is practically a given these days, preventing a huge class of compilation and runtime bugs. Along with TailwindCSS for much improved styling, and NextAuth for auth.

Hah, that was unexpected. Thanks for sharing.

And yeah, Next's built-in Typescript support is great. And not just TS, but dealing with the other parts of the buildchain that are traditionally a PITA to individually configure (the server, linter, bundler, package manager, etc.). Next sets it all up for you for ease of use and interop. It's beautiful.

Funny, this is my exact approach. Love it. Only comment, is that even if storing "dumb data" is the goal, we use Cloudflare KV, you still need some backend CMS or database to ensure some data integrity. So we build a simple bridge between the CMS/database and KV.
Do you use KV as a read-only cache, then, or?
Mostly read-only, with ocassional writes when we update the database/CMS. The writes handled by a webhook which hits the Cloudflare worker upon any update. Workers is so fast, the data and website is updated in milliseconds. We use Vercel's on demand revalidation.

Honestly, the real revolution at Vercel with NextJs in my opinion is the ability to easily use Edge functions now in any NextJs project. It's strange to me how so few developers use this, and understand how powerful the Edge is with Cloudflare. Even at Vercel itself they are focusing on the App folder and React Server Components (RSC). But, if you store everything at Edge and use Edge functions, everything is so incredibly fast, and easy to hook up/maintain that all the tooling around RSC is entirely useless.

Well, edge functions have a really good case but costs have to be taken into consideration. We use them if the logic is unique to the app and access is minimal. Our backend handles the rest. This way we can control costs.
The Vercel $20 plan comes with a million edge function invocations. Are they really that expensive at scale vs all the maintenance you have to do for a traditional backend?