Skip to main content

How To Add, Delete, and Change The User Entity

The User entity is required in order for you to enable authentication on your service.

If you choose to create a service without authentication then the User entity will not be created.

Adding The User Entity

First, go into your service's Entities page. Click on the Add Entity button in the top right hand corner. Type User into the entity name text field and then click on the Create Entity button.

Add a new User entity to your Amplication service

A popup will appear and give you additional context on restoring the User entity. Click on the Restore Default button and the original User entity provided by Amplication will be restored.

note

You have to add the User entity first and then enable the NestJS Auth Module plugin. If you try to install the auth plugin first without the User entity, you will be offered to create it.

Deleting The User Entity

Usually, it's possible to delete any Entity that you create on your service. But, the User entity is special. In order to delete it, you must first disable the NestJS Auth Module.

caution

It's possible to restore the original User entity provided by Amplication, but any additional fields or permissions you added will be permanently deleted.

Follow these steps to delete the User entity:

  1. Visit your service's Plugins page and toggle the NestJS Auth Module into the off state.

Disable the NestJS Auth Module

  1. Visit your service's Entities page. You will notice that you can now click the User entity's delete button. Click it and a popup will appear.

Delete the User entity popup

  1. Click on the popup's Delete button. Now the User entity is deleted.

Changing The Default User Entity

Amplication also gives you the ability to change the default User entity for each service.

Change the default User entity

Follow these steps to change the default User entity:

  1. Go to your service's Settings.
  2. Go to the Authentication Entity page.
  3. Pick the new Entity you want to be the User entity from the Entity List dropdown.
  4. You have now set a new User entity.