3 ms·
Using Next.js for writing your backend is pure masochism. You'll only understand why I say this if you've ever used a real batteries included backend web framew
by 0xblinq 4y ago
Using Next.js for writing your backend is pure masochism. You'll only understand why I say this if you've ever used a real batteries included backend web framework.
- komali2 4y agoSuch as I guess you mean like Django or Rails? I have used Django but because I'm more comfortable building pure client software (games and stuff included, where all logic is happening on the client CPU and RAM), I found it a bit uncomfortable. To be fair I also find next.js somewhat comfortable: I prefer a clean delineation between the client and server, and often find myself fighting next.js when I'm thinking "no, i DEFINITELY want this run ONLY on the server, TRUST me!" But I could just be out of date, I hear "running on the edge" is the hot new thing and I probably just don't know yet how to dev that way. Could you expand what you mean?
- 0xblinq 4y agoWhat I mean is that if you enjoy using React, Next.js is your best option in my opinion and from my experience with similar tools (heavy SPA meta-frameworks...). But that's it, it's there for the *frontend* of your application. And the more your application looks like a landing page with a form than a real full stack application, the better it fits. A lot of problems arise when you want to use it to build a "full stack" application with just Next.js and no "real" backend framework. Many people will tell you Next.js is "full stack" because it can execute JavaScript in the server. For me that's not "full stack"... Maybe when I say "full stack" I'm actually meaning "batteries included" because that's what I need when I'm building a "full stack" application. For any non trivial application, you'll need things such as authentication, authorization, migrations, orm, background jobs, translations, logging, error reporting, rate limiting, security guards (cors, brute force attacks, etc, etc, etc). Most, if not all of these things come out of the box in real "full stack" frameworks such as Laravel, Django, Rails or Adonis. A few months ago I had to deal on a Next.js application which needed server side rendering, internationalization and data validation. Making the error messages from the server show correctly and making the i18n library work together with the authentication, the SSR, the half-assed orm/wrappers around prisma, etc.... it... worked... but you end up looking at the code and asking yourself "Why am I doing this?... Adonis.js or Laravel would do it for me already". Of course some people here will say "but there's a library for each one of those things in the Next.js ecosystem"... yes, but picking the right ones, integrating them so they work in a seamless, secure and battle proven way, keeping it up to date, maintainers abandoning them, trends making them out of fashion, etc, etc it becomes a TON of (business wise) useless work. So Next.js for the frontend? Great. Next.js for a non-trivial full stack application or for your backend? Sure, but you're not using the right tool, it's like trying to put a screw with a hammer. Might work. Just far from ideal.