You are viewing the legacy version of AdonisJS. Visit for newer docs. This version will receive security patches until the end of 2021.


Ignitor is the package that powers bootstrapping of an AdonisJs application. In this guide, we learn about some features and functionalities offered by this package to manage our code.


Ignitor provides a bunch of hooks that you can use to customize the application behavior. The hooks are registered inside start/hooks.js file. Feel free to create this file, if it is missing.

Let’s start with an example of register a view global after all the providers have been booted.

const { hooks } = require('@adonisjs/ignitor')

hooks.after.providersBooted(() => {
  const View = use('View')'time', () => new Date().getTime())

Just like hooks.after, you can make use of hooks.before to hook into before something happens. Below is the list of available hooks.

Hook Description


Before/after all providers have been registered


Before/after all providers are booted.


Before/after pre loading registered files.


Before/after HTTP server has been started.


Before/after ace command is executed.

Preloading files

Ignitor also makes it easy to preload a bunch of files after HTTP server has been started. For this, you need to modify server.js file and call the following method.

new Ignitor(require('@adonisjs/fold'))

The preLoad method takes a relative path from the application path or an absolute path to any .js file. To load multiple files, just call the preLoad method for multiple times.

new Ignitor(require('@adonisjs/fold'))

Ignitor methods

Below is the list of methods available on the ignitor instance.


Define absolute path to the application root.



Relative path to the app file. By default start/app.js file is used.



Instruct ignitor to load ace providers and commands. It is done when running an ace command. However, you can also load commands when starting the HTTP server.