DEV Community

Cover image for A First Glance at AdonisJS 5.0 Preview
Jacer Omri
Jacer Omri

Posted on • Updated on

A First Glance at AdonisJS 5.0 Preview

Tree days ago there was a BIG update. AdonisJS 5.0 Preview is released and we have waited for this for so long.
This tweet is from January


and just 4 days ago

reasonably, this isn't that long. But for me at least, I wanted to test it so badly that I couldn't wait. I forked some modules and played with them before the release date. I liked the ideas behind Adonis from the beginning and even built and shipped projects with it back when version 3 was the latest.

I had so much fun when this was released! I'm in their Discord channel (if you're not, I recommend you joining). The moment I received the notification I started downloading and testing.

So I had an idea of what is inside and what to expect when this hits a stable version.

Release Process

The first big change is the release process. It's now a 6-week release cycle. This is important for a framework that is increasing in popularity very rapidly. This can help keep expectations in alignment with what is realistically possible, and for community modules and their maintainers to follow changes.

Typescript

Now everything is in Typescript. And I mean rewritten in Typescript, not just Javascript with typing. This means that everything can become typed, from request body (after validation), events, models to custom classes and modules.
This is so cool because this aspect can be a huge plus to code quality (especially in a large team setting), allows for more (accurate) help from the IDE and above all and provides ahead of time type checking and all the cool stuff that comes with Typescript.

use no longer, import instead

If you have tried AdonisJS before, you know the long story of use and how it magically solves bindings from the IoC and falls back to good old require call if the binding is not resolved.
This was a great technique that I actually liked very much and built my module provider around.
With the 5.0 release, this is no longer the case. We can now use standard ESM imports and prefix it with @ioc: if we intend to resolve a name from the IoC container.

Ace

The adonis CLI is being dropped in favor of ace. This way, ACE will always live inside your project and no longer need a global package to be installed. This should save us so much trouble with maintaining the right versions of tools across different projects.
To start a new project, all you have to do is npx

npx create-adonis-ts-app blog
Enter fullscreen mode Exit fullscreen mode

Documentation

The new documentation is so good to follow!
For the time being it's still incomplete, but this makes it no less interesting. It's even been structured into smaller guides.
Adonis documentation categories

Performance

There has been an interesting effort put towards making small parts (that count) perform much better. The announced parts to receive most of the performance gain are the validator and the HTTP server (which is now decoupled in a standalone package)

Additions (aka new goodies)

Introduced in the new release are some new features and additions that personally felt the need for before (and thus find very interesting):

  • Signed Routes
  • Health Checks
  • Support for read/write replicas
  • Support for configuring runtime connections
  • RBAC
  • Queues
  • Caching

Progress

At the time of writing this, some work still needs to be done to have a final release of the 5.0. An overview of the ready to use feature vs pending ones are explained in this blog post by Harminder Virk, the creator of AdonisJS. I'll list here the content of that section of the blog post (don't hesitate to take a look at it though):

Functionality ready to be used

  • Router
  • Request, Response, and Templates
  • Cookies and Sessions
  • Lucid and its Active Record ORM
  • The Bodyparser with support for file uploads
  • Validator (some of the validation rules are missing)
  • Health checks
  • Logger
  • Mailer (some of the drivers are missing)
  • Events
  • Encryption and Hashing
  • Redis
  • Ace Commands

Packages that are not migrated yet

  • Authentication
  • Social Authentication
  • Websockets
  • Tests Runner
  • and Intl

New Functionality to be added

  • Support for RBAC
  • Queues
  • Caching (including Database queries)

You can also follow the roadmap on trello for more details about what is coming next weeks.

I have been testing this release in isolation, I haven't tried to migrate one of my projects yet (understandably because it's not a final release yet), but I've read some tweets from people saying it was really easy to do it

In the end, if you haven't tried AdonisJS yet, I recommend you give it a try. Consider the bigger picture and all the good stuff that comes with it, and expect some missing features here and there (temporarily).

I hope you enjoyed reading this! Cheers!

Top comments (6)

Collapse
 
chill_whisper profile image
Chill Whisper

It's interesting, I'm happy to see this news! But I'm very curious from the forum, how many people who work frequently with Node.js who many use adonis if not, what use ...

If Adonis is based on Laravel , it's more good than Laravel or needs more improvements?

Collapse
 
jaceromri profile image
Jacer Omri

it's not better than Laravel, and it's not really based on Laravel. Adonis is based on ideas used in Ruby on Rails and Laravel (like active record, validator implementation...). Its real value is it's the most advanced web framework for Node.js. I have to say the other web frameworks are not as complete as Adonis.

Collapse
 
guledali profile image
guledali

I saw the tweet on the weekend that they just released preview of V5 which is amazing!

Some comments may only be visible to logged-in visitors. Sign in to view all comments.