<!-- actual file is stored in /public/style.css -->
<link rel="stylesheet" href="/style.css" />
You are viewing the legacy version of AdonisJS. Visit https://adonisjs.com for newer docs. This version will receive security patches until the end of 2021.
The AdonisJs directory structure may feel overwhelming at first glance since there are a handful of pre-configured directories.
Gradually you’ll understand the benefit of separating your entities into multiple directories, keeping your code maintainable and easy to search.
A standard AdonisJs installation looks something like so:
.
├── app/
├── ...
├── config/
├── app.js
├── auth.js
└── ...
├── database/
├── migrations/
├── seeds/
└── factory.js
├── public/
├── resources/
├── ...
└── views/
├── storage/
├── start/
├── app.js
├── kernel.js
└── routes.js
├── test/
├── ace
├── server.js
└── package.json
The app directory is the home of your application logic.
It’s autoloaded under the namespace App.
The config directory is used to define the configuration of your application.
AdonisJs ships with a number of config files, but feel free to create your own.
The database directory is used to store all database related files.
The public directory is used to serve static assets over HTTP.
This directory is mapped to the root of your website:
<!-- actual file is stored in /public/style.css -->
<link rel="stylesheet" href="/style.css" />
The resources directory is used to store presentational files for your application like view templates, LESS/SASS files, uncompiled JavaScript, or even images.
The start directory is used to store files that are loaded at the boot of your application.
By default, you’ll find app.js, kernel.js and routes.js.
The app/Commands directory is used to store all your CLI commands.
This directory is automatically created when you run adonis make:command <name>.
The app/Controllers directory is used to store all your Http and WebSocket controllers.
This directory is automatically created when you run adonis make:controller <name>.
The app/Exceptions directory is used to store the global exception handler and all of your custom exceptions.
This directory is automatically created when you run adonis make:ehandler or adonis make:exception <name>.
The app/Listeners directory is used to store all event listeners.
This directory is automatically created when you run adonis make:listener <name>.
The app/Middleware directory is used to store all your middleware.
This directory is automatically created when you run adonis make:middleware <name>.
The app/Models directory is used to store all your models.
This directory is automatically created when you run adonis make:model <name>.
The app/Validators directory is used to store all your route validators.
This directory is automatically created when you run adonis make:validator <name> (you need to have installed the Validator Provider to use this command).