Let's Learn AdonisJS 5 Preview
1.0Let's Learn Adonis 5: Prerequisites & Creating A New Project02:482:47
2.0Let's Learn Adonis 5: Project Structure and the Ace CLI07:024:42
3.0Let's Learn Adonis 5: Routes and Route Handling11:426:07
4.0Let's Learn Adonis 5: Controllers, Services, Resources, and Namespacing11:438:16
5.0Let's Learn Adonis 5: Installing and Configuring Lucid06:495:27
6.0Let's Learn Adonis 5: Migrations18:068:21
7.0Let's Learn Adonis 5: Altering Tables with Migrations04:193:46
8.0Let's Learn Adonis 5: Intro to Models16:0010:07
9.0Let's Learn Adonis 5: Defining Model Relationships16:3811:52
10.0Let's Learn Adonis 5: Intro to Creating, Reading, Updating, and Deleting (CRUD)23:5315:06
11.0Let's Learn Adonis 5: Creating Data & Relationships Records18:2912:29
12.0Let's Learn Adonis 5: The Query Builder23:318:34
13.0Let's Learn Adonis 5: Querying, Checking Existence, and Aggregating Relationships17:0811:05
14.0Let's Learn Adonis 5: Writing Reusable Queries with Query Scopes09:266:01
15.0Let's Learn Adonis 5: Validating Requests17:5214:37
16.0Let's Learn Adonis 5: Introducing The Edge Template Engine12:035:21
This series is outdated
Let's Learn AdonisJS 5 Preview
Let's Learn Adonis 5: Prerequisites & Creating A New Project
We'll be learning a little about what Adonis is, the prerequisites to get started, and how to create a new project.
Today we'll be starting our first Let's Learn. In these series we'll do deep-dives into particular topics, covering all the core concepts involved. In this Let's Learn, we'll be covering Adonis 5. Adonis 5 is a type-safe and extensive NodeJS framework.
Out of the box, Adonis includes routing, form validation, the Edge template engine, JSON serializers for your APIs, it's active-record ORM called Lucid, migrations, seeds, factories, multi-driver authentication, security, and more.
Adonis 5 Is Still In Preview
Adonis 5 is still in preview, however, as things progress toward the final release of Adonis 5 I will update this series accordingly. If you'd like to learn more on your own about Adonis 5, you can find more information on their site at: https://preview.adonisjs.com/.
There are a couple prerequisites you'll need to meed in order to progress with Adonis 5 and this series. You'll need NodeJS version
12.0.0 or later and NPM version
6.0.0 or later. You can check your versions in your terminal by running:
$ node -v # v14.15.1 $ npm -v # v6.14.8
Upgrading Using NVM
If you're using Node Version Manager (NVM) like I am, you can upgrade your node version to the latest release by running:
$ nvm install node # Now using node v15.3.0 (npm v7.0.14)
This will install the latest release for both NodeJS and NPM.
To set this version of NodeJS and NPM as your default versions you can run the below.
$ nvm alias default 15.3.0 # replacing 15.3.0 with whatever version of node was installed for you
Upgrading Using Installer
If you're not using NVM, you can upgrade both NodeJS and NPM by downloading and running the latest Node installer from https://www.nodejs.org.
Just download the latest LTS or Current version, run the installer, and progress through the steps.
Creating Our Project
Now that we meet the requirements for Adonis 5, we're ready to create our application! To do this we can run the following in our terminal. Note that
adonis5 below is where the project name goes, feel free to name your project whatever.
$ npm init adonis-ts-app adonis5
For the purposes of this series, when we're referencing our project path you'll see
Next we'll be asked a couple of questions.
Select the project structure: Web Application
Web Applications will include the Edge template engine, the sessions module, static asset support, and CSRF protection.
API Servers will be more suited for an API application including things like CORS and JSON content negotiation.
For this series, we'll be building a Web Application, so be sure to select Web Application.
Enter the project name: adonis5
Feel free to enter whatever here.
Setup eslint? false
Again, your call here too. eslint will enforce codebase standards if you decide to set it up.
Congratulations! Your first Adonis 5 application has now been created. Now we can go ahead and change into our new project's directory.
$ cd adonis5
Then we can start the local server by running:
$ node ace serve --watch
Note that by adding
--watch we're telling our server to watch for changes. You can alternatively run this command using NPM by running:
$ npm run dev
Now that our server is running we can open up our new project at the specified server port, the default port is
Once you open your application in the browser you should see a "It Works!" welcome page.
In the next lesson, we'll discuss the project's structure and the basics of routing within our Adonis 5 application.