Skip to content

Adminmate.js

config/adminmate.js is the main configuration file of the Data API. It exports the object passed to Adminmate.init():

const { models } = require('../database');
module.exports = {
projectId: process.env.AM_PROJECT_ID,
secretKey: process.env.AM_SECRET_KEY,
authKey: process.env.AM_AUTH_KEY,
masterPassword: process.env.AM_MASTER_PWD,
models: [
{
slug: 'users',
model: models.users,
segments: [],
actions: [],
options: {
canCreate: true,
canUpdate: true,
canDelete: true
}
}
],
charts: [],
authorizedIps: []
};
Property Required Description
projectId Yes The ID of your Adminmate project.
secretKey Yes The secret key of your Adminmate project.
authKey Yes A long random string used to sign the session tokens of this Data API.
masterPassword Yes The password required to open the back-office on this Data API.
models Yes The models to manage in Adminmate. See below.
charts No Your custom charts. See Dashboards & Charts.
authorizedIps No A list of IP addresses allowed to call the Data API. Empty means no restriction. See Data security.

Each item of the models array accepts:

Property Required Description
slug Yes A unique identifier for the model, used in the Dashboard URLs, permissions and activity log. Avoid changing it once in use.
model Yes Your Sequelize or Mongoose model.
segments No Predefined subsets of records. See Segments.
actions No Your custom actions. See Actions.
options No canCreate, canUpdate, canDelete. See Options.