TDD course with AdonisJs - 1. Let's build a reddit clone

Published 9/7/2019

AdonisJs is great for test driven development. Let's build an API for a simple version of reddit using TDD. It will consist of subforums, threads, comments and users. You can find the GitHub for it here:

Without further ado, let's get the project set up!

Install CLI and framework

npm i -g @adonisjs/cli

In this course we want to focus only on the adonis part and not the frontend, so let's create the project using the "api only" flag.

adonis new forum --api-only
cd forum

Install testing library

Adonis comes with its own testing library, let's install it with

adonis install @adonisjs/vow

We have to add the vowProvider under "start/app.js" in the aceProviders array to register the adonis test commands.

const aceProviders = [

The installation of vow comes with an example test, run adonis test, npm test or simply npm t to run it.

To make sure things are working, run the project using adonis serve --dev and head to the url in your browser!

And that's all there is to it, in the next blog post we will create our first test!