I'm a little out of touch with these technologies (sveltekit, nextjs), but is there any advantage to using the same technology for both frontend and backend development beyond the rise of full-stack developers?
What about using React/Svelte for the frontend and a separate backend in Node.js or another stack? Is there any real advantage to having a single monolithic codebase for everything?
The main benefit is that it's very easy to have type safety and consistency between your client and your server. NextJS and the like make it feel almost like you're just calling a native JS function in your client, but it's actually doing lots of magic to make that work. The end result is your client is never out of date with your backend API, everything is type safe, you get full type hinting, and of course all of that helps LLMs write better code for you as well.
As long as you can get an accurate OpenAPI schema out of your API, it’s not much of a value add to have the same language throughout. Stuff like Orval and OpenAPI TS make this easy.
You can enforce keeping them in sync at CI time. This is more effective in a monorepo.
OpenAPI does a similar job and is great if you're using different languages, but I disagree it's not much of a value add. You can send way more types between client/server in e.g. NextJS without thinking about it like lists, dates, promises, etc. OpenAPI can't do that, and OpenAPI also needs a codegen step and then you have to work with janky generated clients.
I’ve been working with purportedly janky generated clients across an FE and BFF monorepo and it’s been painless. From where I’m sat, the benefits I’m missing aren’t significant enough to decide the stack.
gozzoo · · focus · HN ↗
What about using React/Svelte for the frontend and a separate backend in Node.js or another stack? Is there any real advantage to having a single monolithic codebase for everything?
mindwok · · focus · HN ↗
lelandfe · · focus · HN ↗
You can enforce keeping them in sync at CI time. This is more effective in a monorepo.
mindwok · · focus · HN ↗
lelandfe · · focus · HN ↗
But fair point on the complex types.