AdonisJS — the best NodeJS framework of 2017

Published Jul 14, 2017Last updated Jul 23, 2017
AdonisJS — the best NodeJS framework of 2017

About six months ago I was searching for an alternative for SailsJS  —  an MVC Framework for node. Unfortunately, Sails sucked quite a lot in some things  —  it was slow on POST requests, it did not support many Postgres functions such as transactions and it lacked a few other features (for example, described here). But the worst of it is that it didn’t get a single major update in the last three years.

So we started to search for something to move our nodeJS projects to. We’ve tried Koa.js (but it was lacking too many things), Meteor.js (we don’t really need all-in-one solution, only API), Loopback (too much magic) and a few more.

Until I stumbled into AdonisJS. To be honest, even though the framework has 2.5k starts on github, it was not easy to find. But I immediately felt in love with it. I’ll try to explain why.


  1. Looking on the folder structure and logic behind, it is almost identical to a super popular PHP-framework — Laravel. And Laravel has a good thought-out structure, which allows you to keep the things clear. So if you’ve ever worked with it, you will learn Adonis real quick.

  2. Its ORM is made with SQL-databases in mind — such as Postgres or MySQL. It creates efficient SQL-queries and is based on active record idea. Its query builder is easy to learn and allows us to build simple queries quickly. For example:

const bicycles = yield Bicycle.query().whereIn('locationId', locationIds).with('locks').orderBy('label', 'asc').fetch()

But even when we need more complicated stuff like migrations, transactions, joins, chucks or completely “native SQL language” queries  —  it is all there and easy to use. As for MongoDB lovers — adonis supports it as well.

  1. It has a handy validation extension. Makes easy to write rules, for example:
const rules = {
  username: 'required|unique:users',
  email: 'required|email|unique:users',
  password: 'required|confirmed',
  group: 'existsIn:Group'
const validation = yield Validator.validate(userData, User.rules)
if (validation.fails()) throw new Errors.Validation(validation)

These checks can be both synchronous or asynchronous, can access database or whatever needed. And it can be extended very easily, for example, we’ve written a check to prove whether a record exists in our database.

  1. Just a bonus! Personally, I love how Adonis uses and utilises generator functions. For example:
// Classical aka spaghetti way
Users.all((err, users) => {
  users.bicycles().fetch((err, bicycles) => {
    res.send({ users, bicycles })

// Promise way
let users = null
.then(fetchedUsers => {
  users = fetchedUsers
  return users.bicycles().fetch()
.then(bicycles => {
  res.send({ users, bicycles })

// Generator way (aka AdonisJS way)
// Yielding pauses code execution until async function is finished
const users = yield Users.all()
const bicycles = yield users.bicycles().fetch()
res.send({ users, bicycles })

It makes the code a lot clearer! No more enclosed functions or promises, only simple code without tabulation.


  1. There is no default test setup. Writing code without tests — is a very naive way of developing 😃 So we had to invest time into implementing our own test setup around Adonis. Upd: official test setup and tutorial will be introduced in the following Adonis 4.0
  2. Because there are not many contributors and users, sometimes you can still catch a bug in core libraries. Some of them are quite obvious 😃
  3. Even though the docs are good, the community is still small. There are not many answers on StackOverflow and there are not many tutorials (except the official one)

Instead of conclusion

We are using AdonisJS in production for the last six months. It is stable and fast. We love it!

If you’re looking for a modern Node.js framework with ES6, Postgres support and a good structure — check Adonis.js

P. S. And if you need help or have issues with the framework, don’t hesitate to give me a message on Codementor. I also do tutorial sessions where I can show you the basics and a few cool hacks — only $120 for the first 3 hours of Adonis!

Discover and read more posts from Artem Golovin
get started
Enjoy this post?

Leave a like and comment for Artem

Al J
18 days ago


Adonis 4.0 is in pre-release –

The developer has put up a Patreon page where he hopes to get enough support to quit his day job and go full-time on Adonis –

Personally I use Adonis as a REST-ful backend with Aurelia for the SPA frontend – now that Adonis uses async/await the two are even more of a perfect match for me. I’m looking forward to graduating to a GraphQL backend.

Aurelia is the most unobtrusive framework I’ve ever seen, ES6 & Typescript native with async/await, fully web-compliant including shadow DOM, and inclusion of JS in the views leverages standard template literals. Their team just recently added webpack support into their cli, and they are on the brink of releasing the eagerly-awaited server-side rendering option. There’s a fairly clear argument for it here:

c.k. lester
a month ago

I’ve been developing a lot with Laravel recently, and I needed a Node.js back-end. I was considering Koa, Express (of course), Sails, Feathers, and Total. Then someone on reddit mentioned Adonis, and I started researching it. Your post here sealed the deal, I think. I’m going to install Adonis and see what’s what. Thanks! :-D

(Oh, and I want to use Vue on the front-end. Any tutes for an Adonis+Vue set-up?)

Esteban Negri
2 months ago

It looks really clean and concise, nice to see some common sense in the Javascript ecosystem.

Get curated posts in your inbox

Read more posts to become a better developer