LogoLogo
Join our community
  • AdminJS
  • Contribute
  • Demo
  • Addons Marketplace
  • Installation
    • Getting started
    • Plugins
      • Adonis
      • Express
      • Nest
      • Fastify
      • Hapi
      • Koa
      • Community Plugins
        • FeathersJS
        • AdonisJS
      • Matrix
    • Adapters
      • TypeORM
      • Sequelize
      • Prisma
      • MikroORM
      • Objection
      • SQL
      • Mongoose
      • Community Adapters
        • AdonisJS
    • What's new in v7?
    • Migration Guide v7
  • Basics
    • Resource
    • Action
    • Property
    • Features
      • Relations
      • Upload
      • Logger
      • Import & Export
      • Password
      • Leaflet Maps
      • Writing your own features
    • API
      • List
      • New
      • Search
      • Show
      • Edit
      • Delete
      • Bulk Delete
    • Themes
    • Authentication
      • FirebaseAuthProvider
      • MatrixAuthProvider
  • How to write an addon?
  • UI Customization
    • Writing your own Components
    • Overwriting CSS styles
    • Dashboard customization
    • Changing the form view
    • Storybook
  • Tutorials
    • Role-Based Access Control
    • Internationalization (i18n)
    • Content Management System
    • Custom components library
    • Custom component internationalization
  • FAQ
    • PDF Generator
    • Charts
    • Forgot Password
  • ⚠️Legacy documentation
Powered by GitBook
On this page
  • Overview
  • ESM & CJS Support
  • Quickstart
  • Packages
  • Setup
  • Frontend bundling
  1. Installation

Getting started

PreviousAdminJSNextPlugins

Last updated 1 year ago

The "Getting started" section is an overview and quick explanation of AdminJS ecosystem. Detailed instructions for setting up your AdminJS application and connecting it to your database(s) are described in separate guides (scroll down to for quick links).

Overview

An AdminJS application consists of:

  • a core package

  • a plugin (for a framework of your choice)

  • an adapter for (for a ORM/ODM of your choice)

ESM & CJS Support

As of version 7, AdminJS only supports ESM and will no longer work with CommonJS syntax. When setting up your project you should follow the guidelines from Node.js documentation:

In the most basic scenario, the steps to get started with ESM are:

  • setting type to "module" in your package.json file,

  • using import/export syntax with explicit .js extensions instead of requires,

  • if using Typescript, you should set moduleResolution and module to "nodenext" and target to "esnext" in your tsconfig.json

If you use @adminjs/nestjs do not update to ESM as NestJS doesn't support ESM as of 2023/04. Instead, please see the so that you can import updated AdminJS packages into your CJS NestJS app.

Quickstart

AdonisJS (and Lucid) integration should be installed using Adonis CLI. Please refer to to see a thorough guide.

@adminjs/cli provides adminjs create command which you can use to quickly create your AdminJS application.

Installation

NPM:

$ npm i -g @adminjs/cli

Yarn:

$ yarn global add @adminjs/cli

Usage

$ adminjs create

You may also set up your AdminJS application manually by following the rest of this documentation.

Packages

First of all, install the core package:

$ yarn add adminjs

Next, install one of our plugins:

$ yarn add @adminjs/express                # for Express server
$ yarn add @adminjs/nestjs                 # for Nest server
$ yarn add @adminjs/hapi                   # for Hapi server
$ yarn add @adminjs/koa                    # for Koa server
$ yarn add @adminjs/fastify                # for Fastify server

Finally, install an adapter:

$ yarn add @adminjs/typeorm                # for TypeORM
$ yarn add @adminjs/sequelize              # for Sequelize
$ yarn add @adminjs/mongoose               # for Mongoose
$ yarn add @adminjs/prisma                 # for Prisma
$ yarn add @adminjs/mikroorm               # for MikroORM
$ yarn add @adminjs/objection              # for Objection
$ yarn add @adminjs/sql                    # for raw SQL, currently supports only Postgres

Setup

After you have installed AdminJS dependencies, proceed to:

Frontend bundling

AdminJS needs to generate its own frontend. In the production environment, you would bundle all frontend files during build step of your deployment process, but that would be quite annoying to do in development.

For this reason you should add adminJS.watch() function call after setting up all plugins and adapters. This only affects development environment (process.env.NODE_ENV === 'development') and launches a separate bundling process in the background.

import AdminJS from 'adminjs'

const adminJS = new AdminJS({
    // ...
})

adminJS.watch()

Without this step in development, AdminJS will start but won't display anything useful in the browser (except for some parsing errors in the console).

section for instructions on how to setup AdminJS with your framework.

section for instructions on how to connect your AdminJS instance to your database.

Plugins
Adapters
https://nodejs.org/docs/latest-v18.x/api/esm.html
updated guide for NestJS plugin
Adonis plugin documentation
Setup