A First Glance at AdonisJS 5.0 Preview
Tags: javascript, opensource, typescript, webdev
Published: 2020-03-03 23:30:27

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
{% twitter 1214979022322581513 %}
and just 4 days ago
{% twitter 1233613509570813954 %}
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`
```bash
npx create-adonis-ts-app blog
```
# Documentation
[The new documentation](https://preview.adonisjs.com/guides/quick-start) 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](https://dev-to-uploads.s3.amazonaws.com/i/zrby0owajawgn883zqvr.PNG)
# 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](https://blog.adonisjs.com/introducing-adonisjs-v5/) 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](https://trello.com/b/3klaHbfP/adonisjs-roadmap-2020) 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
{% twitter 1234585662344482816 %}

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!