News for hackers. Stuff that matters.
Re:The balance has shifted away from SPAs by jcmontx on Saturday May 21, 2022 @01:26PM (#31459885)
Can anyone point me in the direction of any SPA framework well integrated with a backend framework that can make me as productive as Django, Laravel or Rails?
Re:The balance has shifted away from SPAs by DangitBobby on Saturday May 21, 2022 @05:08PM (#31461823)
I think remix (remix.run) is really close. You can use it to easily build a site that fully functions with JavaScript disabled (seriously, at one point while building the demo app I disabled JavaScript and there was no observable difference in functionality), or one that just does SSR with hydration and client-side navigation. The framework is built and maintained by the people who did react-router and you can tell that it's very well thought out. It seems to fill a similar niche to Next.js but it has some clear "second system" advantages, IMO.

I find myself very productive in it, especially compared to trying to build a highly interactive frontend on top of a Django app. The tutorial app on their website does a great job of demonstrating the capabilities of it and the patterns you'll expect to use, and you should be able to follow along in one long coding session.

It doesn't have built in auth, admin, or ORM, but it heavily advocates for the use of Prisma which is probably your best option for ORM in js. So far, no node ORM really comes close to Django's in terms of capabilities. They don't really even try on the production-ready migrations system. However, you could always use Django to get auth (change your hashing to bcrypt and get a bcrypt lib from npm) and admin for free and use `prisma db pull` to keep your Prisma schema definitions (and corresponding type modules) in sync.

Re:The balance has shifted away from SPAs by vosper on Saturday May 21, 2022 @01:31PM (#31459938)
It’s hard to know hot productive you are in those frameworks, but I’ll take your question at face value: if you were an expert with NextJS, Typescript, and Prisma or Hasura then you’d be pretty dang productive.
Re:The balance has shifted away from SPAs by tpetry on Saturday May 21, 2022 @04:19PM (#31461421)
This is not really what you had been asking for but inertia.js is doing a spectacular approach of combining Laravel and a SPA. All the benefits you have with MPAs and no need to build APIs for the SPA view part.

That‘s the only SPA model I have seen which is a real productive approach.

Re:The balance has shifted away from SPAs by jcmontx on Sunday May 22, 2022 @01:55PM (#31470902)
This might be what I was looking for
Re:The balance has shifted away from SPAs by floucky on Saturday May 21, 2022 @01:51PM (#31460160)
SPA just use APIs so most of frameworks are compatible
Re:The balance has shifted away from SPAs by Nextgrid on Saturday May 21, 2022 @03:45PM (#31461125)
The problem is that you now need to either make resource-oriented APIs for every model in your DB that your frontend may need to access (even if just for internal business logic) or make RPC-style endpoints that do the business logic.

That's significantly more work than just doing whatever logic you want on the server to begin with where you have access to all tables directly (they're an ORM call away) and not have to worry about access control because all of this still happens within the trusted environment of the server.

Re:The balance has shifted away from SPAs by hombre_fatal on Saturday May 21, 2022 @10:03PM (#31464229)
Perhaps you could elaborate on what you mean, but from my viewpoint there isn't much daylight between DB-queries in most server-rendered apps vs. SPAs.

Instead of this:

    def endpointAB:
        a = db.getA()
        b = db.getB()
        return template('ab.html', {a=a, b=b})
You tend to have this:

    def endpointAB:
        a = db.getA()
        b = db.getB()
        return json({a=a, b=b})
When I think of ways you may want to generalize over arbitrary queries on the server, I run into the same challenges you'd have in a SPA rather than fewer.
Re:The balance has shifted away from SPAs by abraxas on Saturday May 21, 2022 @10:30PM (#31464374)
Vaadin