Folder structure

In this guide, we learn how AdonisJs apps are structured and how gracefully it scales as your project grows.

The philosophy of AdonisJs is always to start lean and grow big on demand. The adonis command-line comes with a bunch of commands to create new directories/files whenever you need them.

Run adonis --help to see list of available commands

Slim structure

Slim structure is the bare minimum you need in order to work with AdonisJs.

├── ace
├── package.json
├── public
├── server.js
└── start
    ├── app.js
    ├── kernel.js
    └── routes.js

File/Directory Description


The ace file bootstraps the command line tool for your project-specific commands. Running node ace <commandName> executes the command.


The standard Node.js packages file.


The public directory is used to store static assets like Css, Javascript files or images


This file bootstraps the HTTP server. Running node server.js starts the HTTP server on the port defined inside the .env file.
Whereas in development it is recommended to use adonis serve --dev.


This file is required to register the providers, commands, and aliases. You can ignore this file for now especially if you are not familiar with providers.


The HTTP Middleware are registered inside this file.


This file is used to define HTTP routes.

The app directory

The app directory stores all of your application code such as Controllers, Models, Commands.

AdonisJs has the concept of autoloading the app directory. This means that instead of requiring files with the relative path, you can require files with a namespace. For example:

├── app
│   └── Services
│       └── User.js

Normally you would require the above file as

const UserService = require('../app/Services/User')

With autoloading in place, it can be imported as

const UserService = use('App/Services/User')

The benefit of the latter approach is that the namespace always remains same and you never have to deal with relative paths by typing ../.

The autoloading namespace is defined inside the package.json file. You are free to define more/unique namespaces.


The application views are stored inside resources/views directory. Each view file ends with .edge and uses edge as the templating engine.

You can create new views using the adonis make:view command.

adonis make:view welcome

For nested views running the following command

adonis make:view users.list

Static assets

The public directory in your app is dedicated to store all of the frontend related assets like css, images or javascript files.

You access these files without adding /public to the URL. For example:

The public/style.css file can be accessed by visiting


To keep your applications away from configuration debt, AdonisJs gives you a dedicated directory /config to store all of the application configuration.

It is recommended to keep configuration at one place and make use of Environment variables for manging secrets. Learn more


All of the application tests are stored inside in the test directory. The testing package is not included by default and hence you can install it as defined here.

Once the package has been setup, you can run the following command(s).

adonis make:test user

And run tests as follows.

adonis test