DEV Community

loading...
Cover image for Introducing AdonisJS

Introducing AdonisJS

amanvirk1 profile image Aman Virk Updated on ・3 min read

Hello everyone 👋. I am Aman Virk, the creator of AdonisJS (a fully-featured web framework for Node.js). Today I am starting a blog posts series to introduce you to the framework, where we together build a little todo app.

If you are someone who is just starting with Node.js or looking to explore a framework that you can use going forward, then I welcome you to follow the entire series and also become part of the AdonisJS community 🙂

Outline

Even though the app we are building doesn't have many features, this series will still get quite long, as I will be covering a lot of fundamentals initially.

The outline briefly looks as follows:

  • Introduction ( this post )
  • Setup
  • Get to know AdonisJS
  • Routing & Controllers
  • Creating & designing pages
  • Building frontend assets
  • Planning the todo app
  • ORM setup
  • Creating models & migrations
  • Using the AdonisJS REPL
  • Rendering todos
  • Creating a todo
  • Marking a Todo as done
  • Deleting a todo
  • Deploying to Digital ocean via Cleavr
  • Deploying to Digital ocean via App platform

Why AdonisJS?

This might be the first question you have in your mind. "Why should I even give AdonisJS a try?"

Luckily, answering this question is easy enough for me, since AdonisJS proposes a different paradigm for writing your web servers in Node.js. It's possible that you may or may not like the paradigm altogether, but the framework itself is unique enough to not cause any confusion for its existence.

The popular approach I have always witnessed in Node.js is to start with microframeworks like Express, Koa, or Fastify and then build things on top of it. Even the basic stuff like parsing the request body, validating forms, the logger has to be pulled in separately and AdonisJS is the opposite of this.

Philosophically AdonisJS follows the approach of Laravel, Ruby on Rails, or Django. We believe that baseline features for creating a web server are pretty much settled and asking someone to configure them manually has no upsides. Features like

  • Parsing the request body
  • Validating form data
  • File uploads
  • Logging throughout the framework
  • Cookies + session management
  • Authentication
  • SQL ORM
  • Template engine
  • Support for sending emails

and much more are already baked into AdonisJS so that you can kick start your projects vs spending time assembling your projects.

Along with the benefits of rapidly developing your apps. There are a few more advantages of using a fully-featured framework like AdonisJS.

  • The API across all the packages of the framework is consistent and follows similar naming and code conventions. In turn, there is a less cognitive load on you.
  • Since the framework already knows a lot about your application, it can ship exclusive tooling to further improve your development experience. AdonisJS REPL is a great example of the same.

Closing thoughts

The goal of this post was to mainly introduce you to the framework. Moving forward, we will be writing a lot of code using AdonisJS, Tailwind CSS, and a little bit of AlpineJS.

I will be writing one blog post every day and all you need is to take out 30-45mins and follow along as we create our little todo app. Meanwhile, you can visit the following links to learn more about AdonisJS and show some love ❤️

Twitter: https://twitter.com/adonisframework
Github: https://github.com/adonisjs/core
Website: https://preview.adonisjs.com

Cheers!

Discussion

pic
Editor guide
Collapse
xyn profile image
Mydrax

The best advice I can give you is to just not build a todo app. You wouldn't build a todo app using a framework. Adonis is a framework meant for production-grade apps, you just can not express the potential, flexibility and what really makes Adonis unique by making a simple todo app. It's like trying to cut a branch with a high-end chainsaw.

Yes, this will make it difficult for you to execute but it will bring in a lot of people, because they'll really understand what it means to build a web app using Adonis and how it compares with the rest. For example, during the series you can highlight how frameworks like NestJS handle certain things compared to Adonis but if it's a todo app that comparison will just be too shallow.

Regardless, I'm gonna look forward for this. I've used both Adonis and Nest for about an year now :)

Collapse
guledali profile image
guledali

Totally agree, like Michael Hartl building a twitter clone or some basic social network clone. Or even just a simple forum but where you can demonstrate the relationship and the associations between different models. Like how is table A connected to table C

About the comparison to NestJS, is not a web framework it does not concern itself with the view layer. It's like if using rails you have the routes, models and controllers that's basically Nest.JS

It's really really good for building API, but that's about it. You still have figure out how and where to render stuff.

Collapse
dcsan profile image
dc

So Adonis is more designed for server side rendering than an API for react etc. ?

Collapse
dendihandian profile image
Dendi Handian

I have used and learn AdonisJS a long time ago (maybe 2 years ago), the framework was fun especially when you are Laravel Developer. But I didn't have much time to follow the framework update and learn more about it.

Looking forward to the series tutorial here.

Collapse
sm0ke profile image
Sm0ke

Really nice project.

Collapse
guledali profile image
guledali

You should include testing, btw nice to see a server-rendered html framework like rails but in the node.js space

Collapse
dcsan profile image
dc

Could you compare with nest or redwood js? Both quite full stack Frameworks