Skip to content
KeystoneJS LogoKeystoneJSv5

KeystoneJS Admin UI App

A KeystoneJS App which provides an Admin UI for content management.

Usage

const { Keystone } = require('@keystonejs/keystone');
const { GraphQLApp } = require('@keystonejs/app-graphql');
const { AdminUIApp } = require('@keystonejs/app-admin-ui');

const authStrategy = keystone.createAuthStrategy({ ... });

...

module.exports = {
  keystone: new Keystone(),
  apps: [
    new GraphQLApp(),
    new AdminUIApp({
        adminPath: '/admin',
        authStrategy,
    }),
  ],
};

Config

OptionTypeDefaultRequiredDescription
adminPathString/adminfalseThe path of the Admin UI.
apiPathString/admin/apifalseThe path of the API provided to the Admin UI.
graphiqlPathString/admin/apifalseThe path of the graphiql app, an in-browser IDE for exploring GraphQL.
authStrategyObjectnullfalseSee Authentication Guides
pagesArraynullfalse
enableDefaultRouteBoolfalsefalseIf enabled, the path of the Admin UI app will be set to /.
schemaNameStringpublicfalse
isAccessAllowedFunctiontruefalseControls which users have access to the Admin UI.

isAccessAllowed

This function takes the same arguments as a shorthand imperative boolean access control. It must return either true or false.

If omitted, all users with accounts will be able to access the Admin UI. The example below would restrict access to users with the isAdmin permission.

Usage

new AdminUIApp({
  /*...config */
  isAccessAllowed: ({ authentication: { item: user, listKey: list } }) => !!user && !!user.isAdmin,
}),

Have you found a mistake, something that is missing, or could be improved on this page? Please edit the Markdown file on GitHub and submit a PR with your changes.

Edit Page