AdonisJs Commands

Learn to install AdonisJs, look at a list of some frequently used commands, and learn to install some common packages.

Install AdonisJs

Install the dependencies (Node.js and npm)

Go to nodejs.org and download the installer according to your operating system. Run the installer and follow the instructions. Note that the Node.js installer includes npm.

At the time of writing (2020), AdonisJs requires the Node.js version to be 8.0.0 or above and the npm version to be at least 3.0.0.

Install AdonisJS via the AdonisJs CLI

You can use the Adonis CLI command-line tool to install the framework. Run the following command on your terminal to install AdonisJs globally:

npm i -g @adonisjs/cli

Install packages

You can download some commonly used packages as shown below:

Install the validator package

adonis install @adonisjs/validator

Install Node.js driver for MySQL

npm install mysql--save

Install the mail provider

adonis install @adonisjs/mail

Install the testing engine

adonis install @adonisjs/vow

Install the provider to run browser tests

adonis install @adonisjs/vow-browser

AdonisJs commands

The following are some frequently used commands:

Create a new application

adonis new projectname

Create a middleware

adonis make:middleware middlewarename

Create a controller

adonis make:controller controllername

Create a view

adonis make:view viewname

Create a migration

adonis make:migration migrationname

Run all pending migrations

adonis migration:run

Run specific seed files

adonis seed --files='SeederFile1.js,SeederFile2.js'

Run all seed files

adonis seed

Create a model

adonis make:model modelname

Create a test file

adonis make:test filename

Check the version of AdonisJs

adonis --version

For a more comprehensive list, type the following in the terminal:

adonis --help

Get hands-on with 1200+ tech skills courses.