Ask HN: Why is there no Django/Rails equivalent in JavaScript world?
...But why none of them are getting a real traction while node.js is popular for many years now? Does people in the JS world usually prefer picking and connecting tools themselves? While I admit this philosophy can have benefits in some cases, it has true and obvious downsides too IMO.
I mean, in Python, you are able to chose your philosophy by picking up Django (all batteries included) or Flask (pick and connect tools of your choice). Both framework are kind of equally popular.
But I have the feeling if you decide to pick JS/TS language (a good reason could be: you build a SPA and want to use only same language for back and front), the only viable option is the "pick and connect tools of your choice" philosophy.
I'm wondering why this is NOT a problem for most of developers I talk to. I think some of them has never deal with full featured framework like Django and don't get all the benefits. But it can't be the only explanation.
87 comments
[ 7.1 ms ] story [ 161 ms ] threadRails, Flask, Django (and PHP, purely server side JS that generate HTML with templates like express) are basically all "backend serving frontend and templating".
Front end JS is more of a "frontend + backend with frontend serving backend" in the form of server side rendering being more akin to running a browser, loading the frontend, and then serialising that to a page. This is the complete opposite of the above.
It's kind of a different mindset, but at the same time you frequently see flask serving an API, and JS consuming that API from the browser.
Node.js was THE first back-end JS thing, and its "micro" philosophy kind of set the precedent for everything else that follow in that space. It was the time when people started to feel Django/Rails are cumbersome for some of their needs, too, so the MVC approach never caught on for JS devs.
So I think it's just popularity. Pick whatever tool you deem suitable!
Then the SPA frameworks came into the fray, and I never really saw node.js being used server side like that much anymore.
When you do need to start adding libraries, they have strong installation hooks so most of the time it's one CLI command everything is scaffolded/wired up.
Is there something I'm missing?
https://www.slant.co/topics/2428/~best-full-stack-node-js-fr...
To answer your question, there is not one but many simply because the ecosystem is huge compared to anything we have seen in the past.
thats at least not reflected in weekly downloads. NodeJS MVC backend is really unpopular compared to other options if you trust these numbers.
weekly downloads:
FeatherJS, LoopbackJS, koaJS, TotalJS, hapiJS, NextJS, AdonisJS, DerbyJS, BlitzJS, RavelJS, DenoJS and probably many others I have not even heard of.
Now, each of those frameworks has a decent size community behind them, some of them received huge funding (NextJS, MeteorJS etc), some of them launched only recently. Keep in mind that NodeJS is only 10 years old, JavaScript itself had a decent revesion just recently in 2015. I do think the ecosystem is larger and more active than anything we have seen before and it is still growing aggressively, as more php and ruby developers make a switch and new developers join the field.
You can't get anything near as sober, sane, predictable, and idiomatic as it IMHO. Just try it.
--
To me, it remains different from Django (or Rails) in a sense Django developed all the framework components themselves, which has major implications.
It seems closer to something like Laravel than Django or Rails. And even that comparison is hard because it's trying to orchestrate a lot of 3rd party stuff where Laravel is orchestrating mostly it's own stuff.
than to take over new "microservices" area, which JS successfully did.
I feel like you could build a good Rails-clone (trails?) in typescript that serviced regular old HTML well and have something extremely useful.
Selfishly I want this so I can pair it with htmx.
Hence you end up evolving a large community of people who could stay employed by keeping company's on the hook vs developers who actually managed to get their project into a fully working state and become obsolete.
Also Django was created at a time when AJAX was at its infancy. Most apps needed to generate HTML and the server side had to include templates, routing, authentication, etc...
More modern applications rely a lot more on client side code for routing, and HTML generation and the backend is mostly an API for a non-relational database. Plus a lot of other services for random things like Auth, caching, etc... To the point a lot just opt to go serverless and connect directly to a Firebase for storage for instance.
Django doesn't feel so at home in those "newer style" apps. Most features go unused and the ones you want don't have great support and you have to rely on other tools such as django-rest-framework. If you want to use a NoSQL database, then the nice ORM goes out of the window and you usually lose the Admin interface.
So in other words I think a Javascript Django would have very low usage, because people just don't build apps like that anymore. People prefer light backends reliance on external services and more specialized data storage options. So they want something that is lighter, easier to deploy and scale.
The only reason I still would use Django today is the amazing Admin interface you get in exchange for using its ORM with a relational database.
There is no dominant framework because there are manny good ones focusing and different things. That is because nodejs is larger than anything we've seen thus far.
Some people do still build apps like that – but they have no need to use Javascript for it, as it adds no value to their architecture. So they keep using Rails and Django, and don't waste time on making a JS framework instead.
What framework might you use if you had to build a multi-vendor marketplace with hundreds of forms and only 1% of the form fields require JavaScript for interaction? Would Django be a bad choice? I don't have experience with Django, but I have experience with Rails and Node.js, and I would pick Rails over Node.js for such a project without any hesitation.
So I'd say Django gives you some tools to implement large forms but don't necessarily is a big advantage compared to something you might find in node or ruby
- Rails controllers and plug-in architecture come from MERB (absorbed for Rails 3) https://en.m.wikipedia.org/wiki/Merb
- ERB templates, the default for Rails view layer, have been in the Ruby standard library since at least 2007 (which is as far back as the docs go)
- Rails adopted Rack web server interface and the first versions of the asset pipeline in 2.3, neither of those were written by Rails community.
Rails 1 was released in 2004, almost 10 years after the release of Ruby in 1995. Node was released in 2009 - so maybe one of the frameworks mentioned here —- Next.js /Blitzjs, Nest, Meteor, Redwood —- could be a Rails 1.0 or 2.0. Give them another 5 years or so to mature and then you’ll have your Rails.
Personally, I’ve been trying out Blitz and it seems pretty good, feels like a Rails 2ish kind of thing, where you can do a lot of stuff by following convention but can’t “plug in” as deeply as with Rails 3+.
Meteor is good for prototyping but I would highly recommend against it for anything serious.
Also, in my opinion, Django is a terrible framework, full of magic and impossible APIs - e.g. the ORM adds fields at runtime that are otherwise impossible to inspect or reason about, as well as firing off synchronous database queries in getters/setters, which means there's no way to understand the side effects of seemingly innocuous code.
Django feels like PHP's Magento - bloated, cumbersome, poorly designed, and ultimately a giant footgun.
Yes it hides a bit of complexity if you want to follow the easy route, but you don't have to write Django apps as if it's the year 2010.
I personally use the ORM where suitable, but I do profiling and sometimes I see the need to optimize busier views and API's. Django lets you strike a good balance between productivity and performance (to the extent that is feasible with Python - and even then you can go into layers of caching etc).
Any other opinions?
Never again.
Seems like you're close to, or perhaps the creator of, the project - nothing against you or the team. I just don't have a lot of positive things to say about Django after having worked with it.
I have a high traffic product in use, but the backend is written in Java w/ Undertow.
What I enjoy about Python is that it's great at getting stuff and ideas out quickly. In fact, I just added a new feature tonight to a Django project and that took me ~45 min for something that would likely take 3 hrs to implement in Java.
Plus I don't want SSR most of the time in my apps. If I had a landing page, I might consider Next.js. But at the same time, I might just do static HTML in such a case.
https://github.com/layrjs/layr
We are using feathersjs now, which solves most of the same problems Django did, but is easier to understand.
I haven't worked with rails yet though.
But there are many things the programmer can do to defend against csrf attacks. But you have to know about the problem and know how to defend against it. When I made my first Django site 20 years ago I hadn’t even heard of csrf, yet was protected against it by the framework. It has many such benefits included, so you can make a secure site while knowing little about web security. And an efficient one: it caches DB data for you, for example.
On the downside, as others have mentioned, it’s built using Python class inheritance magic, so can be a headache to modify its behavior.
It's also not what I said :-)
Admin is a good point though. I actually do miss that when working with node.
I’ve seen it combined with next.js which sounds great but I feel in practice you’d end up fighting these frameworks and deciding who gets to be dominant over the other for any specific problem.
https://medium.com/retention-science/ruby-is-still-a-diamond...
Alhough, compiling Javascript to binary makes code even faster https://nectar.js.org , although I wish that project would get more love with bugfixes https://github.com/NectarJS/nectarjs/issues
The only problem with Angular is everything else.
I think some of the original devs moved on to develop Koa.js.
Express only offered routing, middleware to plug-in things like Auth and templating. So yeah, we are very anemic in the Node world when it comes to anything that even resembles a Laravel.
Because there isn't enough time. Every twenty minutes there is a new framework. Things cannot mature. "AngularJS is now scheduled to reach the end of its life on December 31st, 2021." Time to learn yet another crappy soon to be EOF SPA junk language. People want html. People want a back button that works, people are sick of popups with CSS transitions - just show the information. Let my browser show html.