Skip to content

Comment on Ask HN: Which full stack framework (NextJS, Remix, SvelteKit) would you use?parent

Comments

The problem with writing raw queries is that you don’t get that sweet sweet type checking

I would even say type checking is a must. We use Zod to define data schemas and have type completion and runtime checking. We even define request and response schemas in Zod for our APIs (inspired by protobuf/GRPC schemas, but without the code generation step).

I'd say you almost never need file-based routing, I'd even go that far to say you don't need routing DSLs for backend (just use if statements, performance will be fine without compiled regular expression to match all routes). The fetch API has request and response objects, and URL and URLSearchParams. But in frontend I find react-router-dom very practical. I think they introduced file-based routing in NextJS and co, because it's easier to generate frontend code bundles per route by listing files at build time. Other than that it's just a gimmick.

And as already mentioned ORMs (object-relational mappers) will give you headaches really soon, it's probably not worth it.

You can use Vite for the frontend part which is more lightweight than NextJS and co. I'd say if you have or your team has already build a web application with such full stack framework once you probably know what is needed and what is not needed in frontend with Vite.

Wrapper functions with typed parameters :)

This. I can’t live without Prisma anymore.

I do like Prisma, but I find that for quite a few queries it's ridiculously inefficient - things like getting counts, or where you have to get 20 of some model with a bunch of relations - that I find myself using a lot of queryRaw calls. Apparently this is because it doesn't use joins at all, it's all done sequentially. For some of the stuff where I'm getting counts grouped by month it goes down from 20+ seconds to under 200ms using raw SQL.

Wow, had no idea but it's madness that they don't use joins. I think it says a lot about the state of our industry that an ORM can get so popular in 2024 without leveraging such an essential SQL feature. I mean, Entity Framework had this covered 15 years ago... But it's not cool i guess.

Looks like there's preview support for joins now, so at least they are getting there...

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.