This is a Role Based Access Control application using Nodejs, Express, Passport Js, etc. You can use this application as the starting point for whatever project you are going to build which needs authentication and authorization.
For authentication we have only Email & Password option but other authentication options using OAuth/OAuth2.0 like Google, Facebook, Apple, GitHub, etc, can be easily incorporated.
The application is based on the MVC pattern i.e. Model View Controller.
Mongoose is used as an ORM for MongoDB for storing Users in Database.
Passport JS is used for local(email, password) authentication.
The application is almost production ready.
Step 1: Clone the repo
git clone https://github.com/trulymittal/role-based-access-control
Step 2: cd into the cloned repo and run:
npm install
Step 3: Put your credentials in the .env file.
PORT=3000
MONGODB_URI=YOUR_MONGODB_URI(example: mongodb://localhost:27017)
DB_NAME=YOUR_DB_NAME
Step 4: Install MongoDB (Linux Ubuntu)
See https://docs.mongodb.com/manual/installation/ for more infos
Step 5: Run Mongo daemon
sudo service mongod start
Step 6: Start the app by
npm start
You can fork this repo and send me a PR.
This project is licensed under the MIT License.