Skip to main content

Onboarding

Adding the initial users

Info

We have already completed the setup and configuration steps, we now want to register atleast two user, the admin an a user into the API.

Important

This will include extra Vastly security configuration.


Add a user

  • Before adding an admin we first need to register a normal app user

Start the Server

From the root directory ,start the development server by running the command below

npm run dev

Add a first user

Add an initial user. Ensure you have setup your project notification channel


Info

You shall also need to verify the account, refer to the verification documentation here

Set up CLI password

Create Techkey Command line interface password

  • We now need to set a password for the Techkey CLI controller to prevent reinstallation or unauthorised access

New CLI password

From the root directory navigate to a folder called setup/

In the setup folder you should find atleast 3 files class.js index.js and setup.js.

While in the directory set a CLI password using the following command

node index.js --i --s --cli <YOUR_PASSWORD>

Replace <YOUR_PASSWORD> with an actual password

Warning

The CLI password is not recoverable and cannot be reset if forgotten, ensure to use a password you are familiar with.

example

node index.js --i --s --cli 12345678

Update your CLI password

To update your CLI password use the following command

node index.js --i --s --cli <NEW_PASSWORD> --reset <OLD_PASSWORD>

example

node index.js --i --s --cli ABCDEFGH --reset 12345678

Add an admin account

To add an admin account we need to have

  1. A verified user account
  2. The CLI password

While in the (/setup) directory use the following command to start the admin creation wizard

node index.js --e <A_VERIFIED_USER_EMAIL> --p <A_VERIFIED_USER_PASSWORD> --cli <CLI_PASSWORD> --admin

Replace <A_VERIFIED_USER_EMAIL> and <A_VERIFIED_USER_PASSWORD> with the user details of the user account created here

Replace <CLI_PASSWORD> with the CLI password created here

example

node index.js --e user@example.com --p 12345678 --cli 12345678 --admin

Admin wizard

You shall then follow a 5 step wizard to add an admin account

1. Setup prompt

Question: Would you like to add an app Admin? (Y/n)

To continue with the installer type Y into the terminal, to cancel the Installation process type any other character

Y

Press Enter to continue


2. Admin name

Question: Enter the Full-Name of the admin

Provide the admin user full name

John Doe

Press Enter to continue


3. Admin email

Question: Enter the admin email address

Provide the admin user email address

ensure you use a valid and reputable email address

info@example.com

Press Enter to continue


4. Create the admin password

Question: Enter the admin password Min. 8 chars

Set an admin password, ensure its 8 characters long

12345678

Press Enter to continue

5. confirm the admin password

Question: Confirm the admin password

Repeat the set admin password

12345678

Press Enter to continue


Seeding

Once the wizard steps are completed, the API shall create a verified admin account with the default admin roles.

Read about the default roles and their importance here.

You should have the following log in your terminal

ADMIN registartion successfull

The wizard process can be spotlighted as

? Would you like to add an app Admin? Yes
? Enter the Full-Name of the admin John Doe
? Enter the admin email address info@example.com
? Enter the admin password Min. 8 chars 12345678
? Confirm the admin password 12345678

info

To add more admin accounts just repeat the admin creation wizard


Admin API functions

Once the you have an admin user registered you can then access admin ONLY API routes for example reading all users in the system

You can also login and use the API controlller

Admin CLI functions

Using the CLI controller the admin can

  1. Create a backup (.json files) of the database
  2. Seed roles
  3. Add an admin account

To access the CLI controller using an admin account use the following command

Note: you will need to be in /setup directory

node index.js --e <AN_ADMIN_EMAIL> --p <AN_ADMIN_PASSWORD> --cli <CLI_PASSWORD>

Replace <AN_ADMIN_EMAIL> and <AN_ADMIN_PASSWORD> with the user details of the admin account created here

example

node index.js --e info@example.com --p 12345678 --cli 12345678

CLI controller prompt

? What would you like to access (Use arrow keys)

> Backup & Export Database
> Seed Roles
> Setup Admin Account
> exit
Hurrah

At this point we have users onboarded in our project you can now continue to development