AdonisJs - Introduction

tngeene

Ted Ngeene

Posted on August 12, 2021

AdonisJs - Introduction

When we talk about modern software development, it's hard to overlook the role of JavaScript. With so many frameworks to choose from, choosing the 'perfect one is often a conundrum that many newbie developers and experienced ones face when they want to learn new skills. In this series, I will highlight why you should go with AdonisJs. By the end of the tutorial, I believe you will be able to handle most, if not all of the common tasks involved in any backend application.

All source code of the application we'll be building can be found here.

Table Of Content

  1. What is AdonisJs?
  2. Why Use AdonisJs?
  3. Series Outline
  4. Prerequisites
  5. Communities and Resources in AdonisJs

What is AdonisJs?

Some of you are wondering, "what in the world is AdonisJs in the first place?". AdonisJs describes itself as, "a backend framework for Node.js." However, you can do both back-end and front-end development using the framework. It follows the Model View Controller(MVC) architecture, therefore, you can create fully functional web apps using a single framework. It has its own templating engine called edge. It was created by Aman Virk.

Why AdonisJs

A couple of weeks ago, I started using the framework. Being torn between express and Adonis, I finally swayed the Adonis way. The reason for this is;

  1. It has a robust Object Relational Mapper(ORM), which provides first-class support for SQL databases, Query builder with active records, seeds, migrations, and Redis support. This to me was the biggest factor in choosing it as I didn't have to go through the extra step of manually configuring the ORM.
  2. Typescript support outside the box🎊
  3. Well-written and thorough documentation. You can build a web app by just using the documentation.
  4. Multi driver auth support, which lets you choose between JWT, session, and opaque API tokens.
  5. It is easy to set up and use.
  6. It follows good design patterns on what should encompass a web framework.
  7. Strong emphasis on web security
  8. A growing community. I personally see Adonis cementing itself as a top backend framework in the next couple of years.

I could go on and on about why I like the framework, but for that, I'll link some communities at the end of the post for you to have a look at the discussions around it.

Outline

Before we make any development I'll highlight what we'll be building and the requirements you'll need to set up an Adonis project.

We're going to be making a sports apparel store, called FitIt. The goal of the series is to highlight a couple of concepts that are important in your journey to becoming a top-notch Adonis developer. The store will be multi-tenant, meaning users can own different stores and post their gear for that particular shop.

The Database model is illustrated below;

https://res.cloudinary.com/practicaldev/image/fetch/s--e9nyVRxq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pzn7uhf6fh7om3u017g5.png

Topics

These are the features we'll be going over, which are essential to understand while working on any project.

  1. Installation and setup(using typescript)
  2. Login and registration
    • Different authentication schemes
    • Account activation
    • social signup
  3. Relationships
    • one to many
    • many to many
  4. CRUD operations
    • Pagination
    • Filters
    • File uploads
    • Validators
    • Success and error messages
    • Slug system
  5. Lifecycle hooks
  6. Events in AdonisJs
  7. Mailing
  8. Database Seeders
  9. Hook up to vue.js frontend.
  10. Deployment.

Prerequisites

  1. Node.js - AdonisJS is a Node.js framework and hence it requires Node.js to be installed on your computer. To be precise, we require at least the latest release of Node.js 14.
  2. A package manager. I will be using npm However, you can use yarn.
  3. A code editor. My go-to editor is Visual Studio Code.
  4. Postman for API testing.

Communities and Resources

If you've made it this far, then I'm sure I've picked your interest in learning this framework. AdonisJs has a growing community, where you'll get assistance in your journey. For more info on the framework, you can check out;

  1. AdonisJS Discord
  2. Twitter account
  3. Official Github Repo
  4. official Documentation

You can also follow me on dev as well as check out my personal website where I'll be writing more on Adonis and full stack development.

💖 💪 🙅 🚩
tngeene
Ted Ngeene

Posted on August 12, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

AdonisJs - Introduction
adonisjs AdonisJs - Introduction

August 12, 2021