The Reddit Fire

Recently a thread on Reddit asking whether AdonisJs is ready for production and not? caught my attention towards the weird reasons shared by users on the thread.

One of the most popular ones was

Most of the packages are hand-written from scratch and that’s why the framework is not production ready.

Like seriously?

Before I really get into the specifics, I want to share the philosophy of the framework.

AdonisJs is not a toolset, it’s an experience. For example:

Now let’s dive into the criticisms.

The test runner #

A common complaint is related to japa, the test runner used by AdonisJs to write and run tests. Before writing the first line of the code, here were my requirements.

  1. Ability to write test using a concise syntax and avoiding too much nesting.
  2. Controlling the test flow, so that framework can hook into specific areas and offer better testing experience.
  3. Clean cli interface to filter and run tests.
  4. Extendible testing API, so that the framework users can plug add-ons when they need them. The trait is an example of same.

So I looked for all popular options.

These tools are great, but they were not written to be embedded into a framework, they are supposed to be used on their own.

Now Japa is an API first testing framework, it doesn’t care where and how your tests are written. Which means AdonisJs can do all sort of custom stuff and then register tests with Japa and execute them.

Here’s a working example.

const Emitter = require('events')
const { Test, Runner, Group, reporters } = require('japa/api')

// Some global options
const options = {
    timeout: 2000,
    emitter: new Emitter()

// Your test
const test = new Test('hello world', function (assert) {
    assert.equal(2 + 2, 4)
}, options)

// Add test to some group
const group = new Group('', options)

// Initiate runner
const runner = new Runner([group], reporters.list, options)

// Run tests
    .then(() => {
        console.log('tests over')
    .catch(() => {
        console.log('tests failed')

As you can see, there are no command line commands to execute, there are no globals. If you want me to leave this pure API and hack upon the existing test runners, which are not supposed to be embedded, then I am sorry, AdonisJs is not for you.

This philosophy is true for everything I wrote by hand. In places where existing tools are best suited, I have used them and commander.js is an example of same, which is used by Ace.

The use method #

Another criticism is the use method. Now Javascript never had any standards on module loading or dependency management. That’s why Node.js came-up with require and I with use.

I agree the custom implementation of module loading is painful since there is no support for autocomplete by editors.

Again as there were no standards, the editor chooses to implement the autocomplete for popular patterns. And once ES6 import/export will be a stable thing in Node.js. The IoC container of the framework will use it over the custom use method.

The IoC container will use the loader hooks to resolve dependencies and hence you will be able to use import statements over use method. Till then it’s a trade off.

You cannot maintain it #

How do you know? If you think maintaining a code base is all about more people, then you got it wrong.

A popular testing framework Mocha is looking for maintainers, because the guy who created it has moved on and expecting everyone else to share the same passion for the code base is false.

Screen Shot 2018-02-16 at 10.12.03 AM.png

Yes, I can also move on with something else, but until then maintaining all these reports is something that keeps me awake and happy.

Mmmm, Adonis is slower than express #

First, micro benchmarking is for suckers, but still here’s how Adonis slim boilerplate performs in comparison to ExpressJs.

Again, there are many another framework, which will perform better than AdonisJs and speed is not the main concern for me, until it’s not a bottleneck. So I am not going to talk about it at all.


Now read this

Using Socket.Io with Adonis3.0

Since inbuilt support for web sockets is missing in AdonisJs, using with AdonisJs is extremely simple. Setting Up Socket.Io # Using Existing Http connection is very common when starting a websocket server using Let’s... Continue →