NestJS Admin
A generic administration interface for TypeORM entities
Description
Ready-to-use user interface for administrative activities. Allows to list, edit, create, delete entities.
This is heavily, heavily inspired by Django admin, from the concept to the API.
This is still very much a work in progress. Your help is more than welcome!
Installation
Let's get you started with a minimal setup.
- Add nestjs-admin to your dependencies:
yarn add nestjs-admin # With yarn npm install nestjs-admin # With NPM
- Then add the provided
DefaultAdminModule
to your app modules:
Note that the DefaultAdminModule will introduce an AdminUser entity. If you want to be able to use your own User entity to authenticate to the admin interface, you'll have to write your own module instead.
// src/app.module.ts
Need customization? You can use the AdminCoreModuleFactory to create your own admin module instead.
- Create a first AdminUser to log in with
yarn nestjs-admin createAdminUser # with yarn npm run nestjs-admin createAdminUser # with npm
By using the
DefaultAdminModule
you can create more AdminUsers directly from the administration interface!
For now, the
DefaultAdminModule
is the only documented way to use nestjs-admin. If you need customisability, you'll have to dive into the source code.
- Register entities in the admin site
// user.module.ts
- You can now login to access the admin interface at
/admin/login
!
Check the rest of the docs for more details.
Contributing
Any contribution is welcome. If you want to implement a feature, you need to know that we are following django-admin's API as closely as possible. Why?
- It's been well-thought-out by smart people
- Python translates well to Typescript
- It allows us to not have to think about what the API should look like and just use Django admin as a list of desirable features
Start the example app
This repo is actually an example of how to use nestjs-admin. You can start it with:
yarn installcp .env.example .envdocker-compose upyarn migration:runyarn start:debug
Then go to localhost:8000/admin
to see an admin interface for a complex entity. The code for the actual library is in libs/nestjs-admin
.
Tooling
If you use VSCode, a .vscode/
is committed that contains a good configuration to contribute. In particular, it contains a config for a ready-to-use debugger.
ADRs
You'll find ADRs in docs/adr