AdonisJS
adonisjs.com
adonisjs.com
However, you can rectify this, by just not trying to share a class with any of those. In .NET Steve Smith, aka Ardalis shows how to do this with his Clean architecture [1]. One idea is to make a class for each endpoint. This also makes it easier for "Update" classes to share functionality with other "Update" classes and so on.
[1]: https://github.com/ardalis/CleanArchitecture/tree/main/sampl...
What's more egregious to me is that the methods should just match HTTP method names and have 1 controller per route.
As a convention I don't think one method per verb in a controller is inherently bad just because they don't share state. Plenty of long running, maintainable projects follow this practice.
You could use your constructor as a shared place to set up the requirements for your method.
Adonis/Redwood/Nest is something you will regret in few years because it will lock you down to "their" ways of doing things instead of something with replaceable components.
Admitted, Adonis looks most sensible out of these 3. Redwood is poisoned with needless GraphQL and Nest is written like 2008 java. In Adonis you can at least pick the db layer.
But even Adonis locks you to their validator instead of Zod or his cousins, they use their own Request/Response classes instead of the platform ones, has yucky inheritance and annotations magic etc.
Compare that to the wild west that is Javascript land. Multiple libraries that all do the same thing in different ways. Stuff being deprecated or completely changed.
Sure, if you want "choice", there's plenty of stuff out there for that. You can cobble together your own framework or pick a light framework pick and then add your "batteries" to it. I hope AdonisJS only has 1 way of doing things and that those ways are good, then it will truly go a long way.
As you say, js world is fickle and I wouldn't count on Adonis being here for a long time. Mix and match is more pragmatic in this setting.
Nor can you count on your JS library to survive until next winter.
In Js world it's better to not bet everything on a single horse
Adonis is starting to get there, but I don't know much about the core team and how long they've been working on it. If they are able to focus on delivering core features and not getting distracted by every wave that hits the JS world, eventually the level of convenience they provide will reach a tipping point and developers will flock to it.
- JS libs often target browser as well and that's a fast moving target
- JS is primary language of serverless which is also moving fast
- it attracts younger devs chasing hot trends
- the fragmentation is already there, people got used to it and some even embrace it
I lead development on a 12 year old SPA. It's a Ship of Theseus where there is almost zero original code but we never had to rewrite from scratch, instead we were swapping piece by piece as we went. The time investment was reasonably small and we never endangered the business with the full rewrite. I shudder at possibility that someone before me picked "batteries included" AngularJs (the V1). A sibling project is still fighting it today!
Consider choosing Oracle as your database. It is a great database maintained by a big company so it will be around in future too. But you will be locked-in to very expensive licensing because when big businesses are "locked in" Oracle can and will raise their prices.
Until the next dev comes to the project and doesn’t agree with your opinions, right? I’ve seen this movie far too many times.
The main benefits of these frameworks is that they remove all the bike shedding decisions. And I trust more something used by a lot of people and battle proven even if I don’t 100% agree with everything.
What you think is the best library for validations is just an opinion as theirs, and for example I don’t think Zod is good at all. See? Now on a team of 5 people we have 6 different preferences and we have to schedule 10 meetings to decide what library is best. And next month we will regret using it anyways.
There is a reason Rails, Laravel, Django etc are so popular in their ecosystem.
I honestly don’t believe the “I can do better all of this by myself”. It’s usually an undocumented, unproven, buggy and insecure mess that only the main author knows how it works.
And/or are we talking minimum memory footprint?
i'm building https://www.plainweb.dev/, which uses htmx + react style components for templating.
We played a bit with Kita too and its great
- Locks you to their own Validator. Nope, Run npm install Zod and you have it working
- Their own Response/Request classes. Isn't it same with Fastify, Express and other frameworks?
- Annotations, Aren't they part of JavaScript?
Annotations are not part of Js, they are part of Ts and are a concession to OOP people coming from other languages. It's a personal opinion but I don't like them and I enjoy this opinion is not uncommon because only few libs are riddled with them.
Going to nitpick a little here
Hono docs language says, they wrap the standard Request object that you can access via HonoRequest.raw https://github.com/honojs/hono/blob/main/src/request.ts#L26
Annotations/Decorators are in stage3 of JavaScript. But I agree they are not super common in JS world except TS heavy libs or frameworks. Btw we aren't big fan of them and use them sparsely in models and commands only
Anyways, don't take it seriously and have fun
Adonis and Redwood are both trying to be the JavaScript version of Rails/Laravel - a traditional active-record based MVC rapid development server application framework.
The last time I looked for one of these (2018) they were immature and now at least in terms of website and documentation they both appear very capable. But if there’s one thing that JS libraries are good at, it’s marketing and slick documentation.
So, curious to hear any experiences with either and especially both.
Is it actually good?
These days I use DRF because I like getting the built in Django admin for free. I know it is a bit dated in some ways, but I love the way Django structures things, works for my mental model.
Personally though, I'm just done with server side JS and the dependency hell coming with it.
but I probably should've mentioned it anyway since it has been my node backend framework of choice for quite a while.
I'm kinda with you on that though. I'm actually currently prototyping new services in DotNet Core and am really enjoying it so far.
I've also just lost my trust in JS for any serious long term projects. Things work at first and then a year later all the underlying dependencies have changed and stuff stops working.
Btw, its hard to compare two ecosystems with a checklist. For example, Rails doesn't have inbuilt support for Auth, Authorization or Model factories and you rely on community solutions for those.
Similarly AdonisJS is missing some core integrations like queues and you have to rely on community solutions
In the short term, it's fine to use community solutions, but over time, Adonis should bring those things in-house. They also need to find a proper way to monetize the framework so that the core team has the incentive to stick around for a few years to build something truly great. I think this has been the biggest issue with JS world, very few people can and will stick to working on something for long periods of time to make it really good.
The Laravel team figured out the monetization by building out pro-level tools in their ecosystem that people are willing to pay for.
Looks like a really beautiful framework.
EDIT: Nevermind, it's in the docs, just not on the main landing page so feels a little more secondary. TLDR they recommend you use Edge/Pug/Nunjucks, htmx, vite for css bundling. Nice!
https://docs.adonisjs.com/guides/views-and-templates/introdu...
Maybe it's because it's (mostly) markup, but Pug is the only whitespace language that I really gel with. I wish it had more support across the board! Maybe it's the years of Emmet use that's got me biased. I remember getting excited about both of these before they each changed names.
And lastly, this project specifically has been in the making for a good number of years now. So it makes sense that there are quite a few people out there using it.