'How do I decide a way to handle password management in MERN stack?

I am creating my blog application with MERN stack. I have finished creating admin pages where I can edit, delete and create blog posts. To login this admin pages, I need to input email and password.

I want to know what is a better way to authenticate a user?

One way of doing this is to create a database specifically for admin (only me) and store hashed password with bcryptjs so that my password is secure. I create a collection only one time and delete a function used for making the admin. But I feel that creating a collection for only one user is not great way.

Another way that I came up with is to store password to env file in backend server. I think this is not as secure as the idea above.

What do you think that I should do? If there is a better way, Please tell me.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source