Deleting a Role

To delete a role that's available for users, the accounts.roles.remove() method can be utilized:


import joystick, { accounts } from '@joystick.js/node';{
}).then(() => {

Above, we tap into the .then() callback that's triggered internally by after our server starts up. Inside, we call to accounts.roles.remove('manager') to delete the manager role in our database.

When we run accounts.roles.remove(), the passed role is removed from the global roles collection/table, but also from all users who currently have it granted. This is a great way to migrate between roles, or, to bulk remove a role that no longer exists without having to worry about security leaks.

API Reference


Function API

accounts.roles.remove(role: string) => void;


  • role string Required

    A string defining the name of the role to remove.

On This Page