DEV Community

Cover image for There was Rails, then Laravel and now Adonis js (part 2)
Eric The Coder
Eric The Coder

Posted on • Updated on

There was Rails, then Laravel and now Adonis js (part 2)

Follow me on Twitter: Follow @justericchapman

Adonis = MVC Framework for Node

Recently, I stumbled across a framework that had been around for quite some time but for some reasons had gone under my radar. This framework is Adonis.js

What is Adonis? In summary, this is the Node.js version of Laravel. It is a framework that contrasts with other Node.js frameworks. Like Laravel, Adonis has for mission the happiness of the developer and also as mandate to provide all the necessary tools to carry out a project from A to Z.

Being an MVC framework just like Laravel, the learning curve is much shorter.

In part 1, I present you code sample of both framework to show you the similarities. Today we will get a notch further and create a first Adonis project and will compare Adonis commands with Laravel commands.


To create a Adonis project the only requirement is to have Node.js install on your machine. Since Node is use a lot in dev world, good change you already have it.

Type this command in the terminal to check your installed Node version:

node --version
Enter fullscreen mode Exit fullscreen mode

If version >= 12.0.0 you ar ok. If not go to and install the last version. (

Create a Laravel vs Adonis Project

In Laravel to create and launch a new web app we type in the terminal:

laravel new myapp
cd myapp
php artisan serve
Enter fullscreen mode Exit fullscreen mode


In Adonis.js to create and launch a new web app we type in the terminal:

npm init adonis-ts-app myapp
cd myapp
node ace serve --watch
Enter fullscreen mode Exit fullscreen mode


Project folders structure

Here is Laravel folder structure:
laravel folder structure

Here is Adonis.js folder structure:
adonis folder structure

Here a list of main folder location:

Laravel Adonis.js
routes routes/web.php start/routes.ts
controllers app/Http/Controllers app/Controllers
models app/Models app/Models
migrations database/migrations database/migrations
views resources/views resources/views

As you can see both are very similar!

Project CLI commands

In Laravel (and in Adonis) to create project element we can use CLI. For example if we want to create a migrations there is a command for that. Same for models and controller.

Here a list of main CLI commands:

Laravel Adonis.js
create model php artisan make:model Post node ace make:model Post
create controller php artisan make:controller Post node ace make:controller Post
create migrations php artisan make:migration post node ace make:migration post
Run migrations php artisan migrate node ace migration:run

Install Adonis database module

In Laravel all module are include with default install. In Adonis.js only the core module is install by default. For example, to use a database we have to install the database module:

Installing that module is easy. Here the CLI commands to install and run first config:

npm i @adonisjs/lucid@alpha
node ace invoke @ajonisjs/lucid
Enter fullscreen mode Exit fullscreen mode


That's it for today. Stay tune because I will post many more articles on Adonis.js in near future.

You can follow me on Twitter: Follow @justericchapman

Top comments (0)