Developers March 21, 2020

Experience with Adonisjs?

jones_spencera

Anybody have experience with Adonis.js? https://adonisjs.com/

What did you think of the experience? Was it elegant and easy to use (as the docs suggest)?

Reading the docs, it looks to meet a lot of what I’m looking for to power my next project.

  1. 2

    glad you ask this. I'm currently researching a simple Node framework for my end-to-end (and minimalist) SaaS boilerplate. I'm leaning towards Feathers.js. Adonis came up a lot as a great alternative.

    1. 1

      @indiepanda I actually have a lot of production experience with Feathers.js. It's a decent framework, although really different from Adonis. Adonis has taken a ton of inspiration from Laravel, and in some ways feels like a Laravel clone in Node.

      Feathers is a nice framework for building DB backed services. It abstracts over protocol so you can use either HTTP or websockets, and provides an abstraction over DBs that supports both SQL and NoSQL. Hooks also offer some nice improvements over raw express middleware. I have a couple of quibbles, but overall feathers is a good framework IMO.

      (One trap with feathers is that it's easy to bind your DB model to your view. This isn't a problem with the framework, just that the framework makes it easy to fall into.)

      Btw, found this SaaS boilerplate built on Adonis: https://github.com/aloysius-tim/saas-react-starter-kit-boilerplate

      1. 1

        Thanks for the rundown. I'm curious why are you looking to adopt Adonis when you have plenty of production experience with Feathers?

        Holy moly the SaaS React starter boilerplate includes the whole enchiladas. The underlying react-start-kit has 20K stars!

        As for my case I'm still validating the hosted boilerplate idea. Personally I feel overwhelmed when a framework gives me too many things.

        1. 1

          @indiepanda, yeah, good question :)

          Feathersjs is great for the API layer, but I'm looking for something that gives me more than feathers provides... something more like Laravel (PHP) or Rails (Ruby). I want to spend more time solving business problems and less time wiring tech together... bunch of discussion over here: https://www.indiehackers.com/post/unpopular-opinion-node-js-insert-spa-framework-is-the-wrong-choice-for-my-next-indie-hacker-project-a7c16fd319

          Not sure what you mean by "hosted boilerplate".

          1. 2

            If you're looking for something like Laravel or Rails, then look no more. Adonis is an excellent alternative to those for the Nodejs world. There are sailsjs, but they feel very obsolete/not maintained compared to Adonis.

            I've built some medium-sized apps on it and can say that it does precisely what it promises. A decent dev experience when a lot is taken care for you, in the background. It also provides a similar feeling for other full-featured frameworks. I mean, it might not be a good fit for a few pages website - it might feel too large. And it might not be a good fit for super complex or performance (as in milliseconds) oriented apps, just like neither Laravel or Rails. However, it's great for anything in the middle, for casual medium-sized projects. There is some learning curve, but it's not too steep.

            Production hosting of adonis is as simple as with any other nodejs framework.

            One thing to mention is that I'm talking about Adonis v4. I haven't yet worked with the 5th (typescript) Adonis.

            Hope this helps.

            1. 1

              It does! Thank you, @arminas! I think my idea falls in the middle tier somewhere.

              Looks like v5 is still in earliest of previews, so I'd probably build on v4 for now.

          2. 1

            @jones_spencera Ha I owe you a reply on that thread! I'd be happy to share once I'm done with it this coming week.

            Hosted boilerplate: the idea is I'll be maintaining a full stack (open source) SaaS boilerplate git repo. For example, React + Feathers/Adonis + Auth0 + database.

            Paid users can have their git repo instantly set up with CI + deployment to my private Kubernetes clusters. Similar to Laravel Forge but running on Kubernetes instead of bare VM.

  2. 1

    I'm building my product (kickasstuber.com) using Adonisjs. I choose that framework because the original version which I didn't code was built with Laravel, so I thought I would be easier to port some code base. At the beginning I was missing some Feathers features. I really like how feathers hooks work and how you chain middlewares to manipulate requests. But I ended liking it a lot and enjoying writing my backend with Adonisjs. At the moment I'm just missing the TypeScript support which is already coming with Adonis 5, and you can start using it, but there are some of the core packages missing, like Auth, which makes difficult to adopt now.

    I will try to start with Adonis 5 if is a small project and you can avoid use those packages or if you can wait them to be available.

    1. 1

      Thanks @gperales. V5 is looking really promising... but thinking that I’ll wait until it’s really stable and full-featured before I’d migrate. (I’m not the early adopter type :) ).

      Hopefully there’s a clean migration path.

      1. 1

        Main maintainers are saying that it is quite stable. It just doesn't have all the packages we usually need (mainly auth), but mailing package also doesn't have all the drivers etc. Sometimes is easier to be an early adopter than migrate late ...

  3. 1

    I have a large, non-trivial app in production that's built on adonis. It works great, and is a breeze to maintain. Adonis is very similar to Laravel, upon which it's based. Great for rapid application development, especially if you like the ActiveRecord concept that the ORM is built around.

    1. 1

      Thanks @willvincent! Appreciate your thoughts.

      Do your app use an SPA on the frontend or Adonis's built in templating (SSR)?

      Mind sharing about how many models or tables your app has?

      I'm trying to size up the project I'm thinking about and I expect it will be 15-30 tables and most likely use Adonis's templating, with maybe Stimulus (https://stimulusjs.org/) to do anything that has a bit more frontend functionality.

      1. 1

        Yeah it's a SPA built in vue and served via netlify.. the adonis backend is running on AWS (fargate), 6 instances, one single (large) RDS database. I'm also using MQTT to push notifications/etc back to the UI.

        Am using adonis' templates for emails, otherwise it's strictly a rest-ish api.
        ~30 models, ~40 tables, half a dozen or so materialized views of search index data.. largest of the tables has 3.2million records.. most of the others average somewhere in the 250k-500k records range.

        It's very performant... WAY faster than when this was built on meteor with mongodb for the database.

        1. 2

          Thanks! This is probably roughly the size my app would be ... if it was wildly successful after a few years :)

          I’ve used a target cluster once before and it was a good experience.

          Appreciate all the insight! I’m giving [email protected] a try now to see how it goes.

  4. 1

    I have worked with adonis 3-4 years ago and found it quite clumsy (it was using es6 generators).
    I have tons of experience with express and after some time i really wanted to save myself time and avoid boilerplate so i gave it a go.

    You know when you become a more experienced programmer you realise the importance of convention over configuration. What i've noticed is that with custom code you end up redoing the same boilerplate (and often worse) than what is provided by famous frameworks. So I gave it a go recently and I loved it!

    What I don't really like is the database layer.
    Knex is not my fav way to talk to the database though, the Lucid ORM i think needs more built-in functionalities. I actually love typeorm, so something like that with adonis would be great.

    The second thing I don't like is their inversion of control. In the sense that I can't jump to the source code within vscode (ctrl/cmd + click) and have to manually navigate to the source file.

    But to be honest the rest of the package is amazing. Testing suite saves me so much time, jwt, social providers, session, validators. All out of the box.
    Adonis is now my go-to backend framework along with react for apps and gatsby for public websites/landing pages.

    PS: Adonis will soon release version 5 which has typescript support and imports support instead of their use(). So the second point regarding the inversion of control will be solved.

    1. 2

      Thanks for the insight. Could you easily rip out Knex and replace it with something else?

      1. 2

        There'd be no real reason to use adonis if you ripped out the DB layer.

      2. 1

        I think you could. But again that's not the point :)
        I don't want to spend hours configuring my projects. That's the very same reason why I don't use typescript, nor do I write my own webpack config files.

  5. 1

    I just started using Adonis a few days ago.
    I love that I get testing out of the box with:

    • Truncate the database between each test
    • Browser tests (with puppeteer)
    • Functional tests (like client.get(/your-route) )

    I also get migrations out of the box.

    And finally setting up relations seems pretty easy