Day 2 of my full stack project

So continuing with yesterday I started with User and password Authentication in the Backend

Using a lot of packages to make a professional product application

  • Bcrypt - To encrypt the details into hash (Password)

  • JsonWebToken - So the user can directly log in after registration

  • Validator - for validations

  • nodemailor - Auth for forgot password

  • cookie-parser - for cookies


Made a new collection in postman to test the Register and it works pretty well as you can see the password is getting encrypted.


Users collection is also added in the Mongodb


This is the current structure of my project where today I added userModel, controller and Routes i.e defined what parameters the user will take etc.

Here's the example of userSchema

name:{
        type:String,
        required:[true,"Please Enter your name"],
        maxLength:[30,"Name cannot exceed 30 characters"],
        minLength:[3,"Name should have more than 4 characters"]
    },
    email:{
        type:String,
        required:[true,"Please Enter your Email"],
        unique:true,
        validate:[validator.isEmail,"Please enter a valid email"]
    },
    password:{
        type:String,
        required:[true,"Please Enter your password"],
        minLength:[8,"Password should be greater than 4 characters"],
        //when used find method it will give everything except password
        select:false,

    },

Concluding today's progress had a productive session overall, haven't finished the whole user authentication-related stuff yet so tomorrow I'll continue.