7 ms·
Can’t write your backend in react. So presumably someone else is writing an API in their sleep that your app will consume.
by theappsecguy 4y ago
Can’t write your backend in react. So presumably someone else is writing an API in their sleep that your app will consume.
- p1necone 4y agoWell, no. But you can write your backend in JS/TS. I find backend code needs much less of a "framework" anyway (depending on use case, I'm thinking of CRUDdy-ish stuff). You just need to nail the API between frontend and backend, and using the same language means you don't have to do anything fancy with your domain model.
- whatshisface 4y agoIf you combine together all the static web 1.0 sites in the world with all the backend-as-a-service companies (Commercelayer, Stripe not exactly, the weather ones), and mix in the mostly-just-plumbing backends you can come up with by stitching together AWS offerings, and top it off with all the things you can do by writing less than 100 lines to run a Lambda function, you have covered a huge number of use cases without ever needing to learn Rails.
- theappsecguy 4y agoYou can do a lot of things, depends on your goals I suppose. You seem to be really sold on the concept of not learning Rails, so I won’t argue with you further. I personally found Rails much easier to learn and use than React or pretty much anything I use in the JS world. Rails is built with developer happiness in mind. JS though became the answer to all questions for reasons that are beyond me. You can’t escape it entire so I try to limit how much I have to use it.
- whatshisface 4y agoI don't know if there's a rails-of-js yet, but Svelte is pretty nice.
- theappsecguy 4y agoIt is nice. I’m not seeing enough adoption unfortunately which is negative in terms of work opportunities
- 0xblinq 4y agoFor me that's Adonis.js. I've been using it for over a year and it's great. Although it's more the "Laravel of js" than the "Rails of js". P.S: Yes, I know Nest.js and I don't like it and don't think it's better or even closer to the developer experience you get with Adonis.
- theappsecguy 4y agoHave you tried Sails.js? Seems like Adonis is not very actively developed?
- komali2 4y agoYou can, sort of, if you write it using next.js. Also presumably if you know react you know node, so you could write an express server or something. I'm assuming this is what OP meant.
- 0xblinq 4y agoUsing 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.
- Bilal_io 4y agoIf I write an SPA in my sleep, and my partner writes a backend using her preferred language/framework in her sleep, we'd be a dream team.