| ▲ | mvdtnz 5 days ago |
| > Otherwise, just tread the well-trod path and stick to either a react-vite SPA or something like Rails doing ordinary SSR. Just write your SPA the grown up way. Write your APIs in a language and framework well suited to such work (pick your poison, Rails, Spring, whatever Microsoft is calling this year's .NET web technology). And write your front-end in Typescript. There's absolutely no reason to tightly couple your front-end and backend, despite how many Javascript developers learned the word "isomorphic" in 2015. |
|
| ▲ | matt-p 5 days ago | parent | next [-] |
| Having front-end and backend in the same language and mono repo is such an outrageous productivity booster for me. Obviously the opposite may still be true if you've got big, separate frontend and backend teams but if you just want to ship.. I wouldn't have it any other way. |
| |
| ▲ | webdevladder 5 days ago | parent | next [-] | | Full-stack rich schemas, not the poor lossy JSON Schema or other language-agnostic ones, are so nice for long-term quality and development velocity. You get to categorically avoid bugs that drag teams down. Zod 4, ArkType, and Valibot are all great. | | |
| ▲ | smaudet 5 days ago | parent [-] | | This is the problem inherent in web dev I suspect. JS developers thought they reached the zenith of programming because they had a type system and could realize some gains via strong typing checks applied to what would otherwise be network calls. However, at a certain point, you're better off not writing a web app anymore, just an app with a somewhat wonky, imprecise runtime, one that lacks any sort of speed and has many drawbacks. And you lose one of the most fundamentally important parts of the web, interop. I'm sure other langs can be made to speak your particular object dialect, however the same problems that plague those other type systems will still plague yours. Which circles back to my issue, no, sticking your head in the sand and proclaiming nothing else exists, does not, in fact, make things better. | | |
| ▲ | webdevladder 5 days ago | parent [-] | | You've missed the point, it's inherent in any serialized communication, and the gains are far greater than a type system. Protobuf and friends, and every type system in existence, pale in comparison to runtime capabilities and guarantees. |
|
| |
| ▲ | happimess 5 days ago | parent | prev [-] | | You can have a monorepo with any tech stack you'd like. You can write your front-end and back-end in the same language. No shade to you for finding a productive setup, but Next.js tightly couples your front-end and back-end, no question. | | |
| ▲ | evilduck 5 days ago | parent | next [-] | | > Next.js tightly couples your front-end and back-end, no question. I'd question that statement, since it's wrong. There's no requirement to connect your NextJS server to your backend databases, you can have it only interact with your internal APIs which are the "real backends". You can have your NextJS server in a monorepo alongside your APIs which are standalone projects, and Next could exist solely to perform optimized payloads or to perform render caching (being the head of a headless CMS). It seems like a weird choice to make but you could also build almost a pure SPA have have Next only serve client components. The tightness of the coupling is entirely up to the implementor. | |
| ▲ | matt-p 5 days ago | parent | prev [-] | | I don't use next.js really any more. That's exactly what I do. |
|
|
|
| ▲ | zarzavat 5 days ago | parent | prev | next [-] |
| I don't agree. Having front-end and backend in the same language is so convenient I would never go back to doing it the old way. I'd rather compile the frontend to WASM than introduce a mismatch. I used to use Django and there were so many issues that arose from having to duplicate everything in JS and Python. |
| |
| ▲ | turtlebits 5 days ago | parent [-] | | What about HTML? Are you writing HTML via JS - if not you're already writing multiple languages. | | |
| ▲ | zarzavat 4 days ago | parent [-] | | HTML is not a programming language. But yes, I don't write much HTML anymore. The issue with mixing languages is that they have different data models, even simple things like strings and integers are different in Python and JS, and the differences only increase the more complex the objects get. Sometimes I write some code and I realise that this code actually needs to execute on the client instead of the server (e.g. for performance) or the server instead of the client (e.g. for security). Or both. Using one language means that this is can be a relatively simple change, whereas using two different languages guarantees a painful rewrite, which can be infectious and lead to code duplication. |
|
|
|
| ▲ | b_e_n_t_o_n 5 days ago | parent | prev | next [-] |
| Agreed. It's a bit insane that updating a button padding redeploys your entire backend. |
| |
| ▲ | matt-p 5 days ago | parent | next [-] | | Not the same problem though is it? You can have a express backend and react-vite frontend both in typescript and in a mono repo. | |
| ▲ | fragmede 5 days ago | parent | prev [-] | | Are you paying for computer time by the CPU cycle? |
|
|
| ▲ | nchmy 5 days ago | parent | prev | next [-] |
| or dont even write a SPA. Send hypermedia from your backend language/framework, use HTMX + Alpine or Datastar, and call it a day. |
| |
| ▲ | icedchai 5 days ago | parent [-] | | I’ve been experimenting with HTMX and it feels so much simpler. |
|
|
| ▲ | jakubmazanec 5 days ago | parent | prev [-] |
| > There's absolutely no reason to tightly couple your front-end and backend I'll give you one reason: Gel [1] and their awesome TypeScript query builder [2]. [1] https://www.geldata.com/
[2] https://www.geldata.com/blog/designing-the-ultimate-typescri... |