A simple multi tenancy for AdonisJS.

Usage no npm install needed!

<script type="module">
  import siroladAdonisjsPolis from 'https://cdn.skypack.dev/@sirolad/adonisjs-polis';


AdonisJs Polis

This is a clone of Polis by JMiranda. A simple AdonisJs package that allows you to use multi tenancy in your application.


Install package with adonis install:

adonis install @sirolad/adonisjs-polis

In case of installation using npm or yarn, you must copy the config/index.js file into your app config directory as config/polis.js.


Register Polis provider inside start/app.js file:

const providers = [

Set up the middleware in start/kernel.js file:

const namedMiddleware = {
  tenant: 'Adonis/Middleware/TenantDetector'


Add Polis trait to your multi tenant models:

const Model = use('Model')

class User extends Model {
  static boot () {

And use Polis middleware in the related routes:

Route.group(() => {
  Route.post('/login', 'SessionController.create')

You can override the default tenant source in config/polis.js file for certain routes by specifying the source of tenant as property of the middleware(header, url_query, url_param, subdomain). For example: middleware(['tenant:subdomain']).


This package is based on @brainnit/adonisjs-feud.