MERN Stack Full Tutorial | User authentication, JWT, Node.js, MongoDB, React and more

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ต.ค. 2024

ความคิดเห็น • 244

  • @codedamn
    @codedamn  3 ปีที่แล้ว +15

    Learn Complete MERN Stack Web Development on codedamn: cdm.sh/fullstack

    • @skulldot5495
      @skulldot5495 3 ปีที่แล้ว +2

      Sir you don't think that we should avoid using mongoose and use mongodb driver's ???

    • @neeshsamsi
      @neeshsamsi 3 ปีที่แล้ว

      What vsc theme is that?

  • @davibentim6080
    @davibentim6080 2 ปีที่แล้ว +47

    Awesome tutorial.
    Fair warning as a beginner, it took me much longer than the 49 mins of the video to be able to code along and get everything working. There's a lot of things that were deprecated in newer versions of React and took some digging and googling to figure things out, but in the end, that made the learning better.
    Also, if you just clone the repo he provided, you won't be able to follow along as well since the final code is much different than the beginning. Better to code along to understand his thought process.
    Thanks for the video, Mehul

    • @sbc498
      @sbc498 2 ปีที่แล้ว

      can you please provide the new code bro?

    • @Krimson5pride
      @Krimson5pride ปีที่แล้ว +1

      True, although compared to other channels, I was able to keep up with this video quite easily.

  • @yagami-light
    @yagami-light 2 ปีที่แล้ว +48

    for those who are following this now, useHistory is no longer a part of react-router-dom, instead make use of useNavigate() hook such as navigate("/login", { replace: true })

    • @ddhruvarora
      @ddhruvarora ปีที่แล้ว

      Thanks

    • @prashantanayak6061
      @prashantanayak6061 ปีที่แล้ว

      U r right

    • @godismyway7305
      @godismyway7305 6 หลายเดือนก่อน +1

      So so helpful! Thanks!

    • @kst.1999
      @kst.1999 4 หลายเดือนก่อน

      Also, You can use window.location.replace("/login")

  • @alastairtooth6252
    @alastairtooth6252 2 ปีที่แล้ว +99

    Love the video mate. Just a note though that the React-Dom-Router process you listed has since been updated in their V6. You need to add a 'Routes 'bracket around the 'Route' (as well as adding 'Routes' to your import), then swap out your 'component' for 'element', and wrap Login and Register in a self-closing tag (i.e. component={Login} becomes element={})

    • @alastairtooth6252
      @alastairtooth6252 2 ปีที่แล้ว +10

      Further to this - useHistory is deprecated, and replaced with useNavigate 😀

    • @reddinagaravikumar1402
      @reddinagaravikumar1402 2 ปีที่แล้ว +1

      I just blindly did that thing and got error, later reinstalled old version

    • @alastairtooth6252
      @alastairtooth6252 2 ปีที่แล้ว +1

      Yeah the easier is to follow and to stick with v5, but thought i'd post in case anyone needs to use v6 for other reasons

    • @dash7519
      @dash7519 2 ปีที่แล้ว

      @@alastairtooth6252 then you have learned nothing and just copy pasting...

    • @dash7519
      @dash7519 2 ปีที่แล้ว

      @@reddinagaravikumar1402 then you are just imposter between programmers

  • @gunjanrajtiwari1435
    @gunjanrajtiwari1435 3 ปีที่แล้ว +8

    Cleared so much of my confusion from this video. Mainly the development vs production part in many things like server, cors etc. Great video Mehul.

    • @codedamn
      @codedamn  3 ปีที่แล้ว +1

      Glad to help!

  • @mikayilgacek
    @mikayilgacek ปีที่แล้ว +4

    If you're watching that tutorial a few months after that video do yourself a favour and do not follow it.
    Or at least try to install the node dependencies used in that video. If you're using newer versions a lot of stuff won't work.
    I wasted a lot of time trying to fix NPM issues.

  • @contentshark5122
    @contentshark5122 2 ปีที่แล้ว

    Owo you are just 22 years old and doing amazing things...hats off

  • @A_Saban
    @A_Saban 2 ปีที่แล้ว +2

    I mean it when I say, you don't know how much you have help me. I have been struggling to get this right and thanks to you I finally got it

  • @ailany
    @ailany 2 ปีที่แล้ว +1

    this is the most to-the-point video on this subject I have yet found. thank you!

  • @Ayush_kumar123
    @Ayush_kumar123 2 ปีที่แล้ว +4

    This was a great tutorial. You have explained how things will work in production as well as development in a very easy manner.

  • @ridl27
    @ridl27 3 ปีที่แล้ว +6

    Mehul, please! Docker and all CI/CD stuff in the part 2! it would be fantastic! big please here :D
    and yep, thank you!

  • @AlekVila
    @AlekVila 3 ปีที่แล้ว +6

    I learned so much here. Thank you!

  • @abhilashpoojary3812
    @abhilashpoojary3812 ปีที่แล้ว +1

    man your content is awesome and command on the language is cool i didnt skipped a beat till i finished 👌👌

  • @adibpathan41833
    @adibpathan41833 ปีที่แล้ว

    i have never seen this type of video on youtube. Thank you so much sir 💗

  • @bhavyagada6027
    @bhavyagada6027 2 ปีที่แล้ว +3

    Hey Mehul, can you make the video on how to deploy mern stack applications?
    I am facing some issues each time I try and takes hours to figure out so a proper guidance would help.

  • @henriquealarcon7389
    @henriquealarcon7389 2 ปีที่แล้ว +4

    You are so good at teaching! Thanks for the tips, helped a lot!!

    • @alanmoreno6330
      @alanmoreno6330 2 ปีที่แล้ว +1

      I hear the MEN stack is your favorite, is that true?

  • @jackielegs7436
    @jackielegs7436 ปีที่แล้ว +7

    When you start implementing jwt, if you get the 'BREAKING CHANGE' error in regards to webpack 5 then do the following.
    npm i jwt-decode
    **instead of importing jwt from 'jsonwebtoken'**
    import jwt from "jwt-decode";

    • @zohebahmad9633
      @zohebahmad9633 ปีที่แล้ว

      but i then get error jwt.sign is not recognized

  • @helloworldxd1931
    @helloworldxd1931 3 ปีที่แล้ว +2

    waiting for more MERN projects
    Thank You very much!!

  • @thirdyraza7878
    @thirdyraza7878 2 ปีที่แล้ว +3

    hey, i would like to know your extensions, especially in predicting the next lines. THANK YOU FOR THIS VIDEO, IT HELPED ME A LOT FOR OUR CAPSTONE PROJECT

  • @Sonu-tg6tg
    @Sonu-tg6tg 3 ปีที่แล้ว +4

    want this type of MERN projects

  • @newborn7850
    @newborn7850 2 ปีที่แล้ว +1

    Q1 How to deploy it on free cloud / host for testing. Q2. How can admin upload files so that users can access them . Rest your teaching is valuable Thanku

  • @DeepakVishwakarma-li8wq
    @DeepakVishwakarma-li8wq 3 ปีที่แล้ว +1

    Hey! Express is pretty smart. They can automatically select (application/json)

  • @sebastiankoziel8055
    @sebastiankoziel8055 2 ปีที่แล้ว +1

    Great stuff man. Helped me a lot. But at the end it is very chaotic like you were going against the time :) Beside that it is awesome. Everything i neeeded in one place.

  • @thekannadacoder8134
    @thekannadacoder8134 ปีที่แล้ว

    Bro❤❤❤thanks It’s an ultimate course …🥺🥺🥺 I don’t know how to thank you brother

  • @Raj-iz9uz
    @Raj-iz9uz 3 ปีที่แล้ว

    Right now liked & shared this video.. currently learning javascript so in future I'll work on this 😊 thanks 🙏🏻

  • @Chad-ms4ym
    @Chad-ms4ym 2 ปีที่แล้ว +2

    Brilliant explanations. Brilliant video structure. Excellent video overall. Subscribed!

  • @robinmahato
    @robinmahato 3 ปีที่แล้ว +1

    @codedamn such a gem, for learner like me. Thanks for all your efforts.

  • @ojestutorials8387
    @ojestutorials8387 ปีที่แล้ว +1

    Amazing video! Nice teaching! Good job👍

  • @saudkhan1080
    @saudkhan1080 2 ปีที่แล้ว +7

    i can't use 'import jwt from 'jsonwebtoken' due to a webpack v5 issue. Pleaseee helpppp ?

    • @FreeLeaks
      @FreeLeaks 2 ปีที่แล้ว +3

      First do 'npm i jwt-decode'.
      After installing jwt-decode, go to the Dashboard file and change the import statement to 'import jwt_decode from "jwt-decode"'
      Then in the useEffect statement change jwt.decode to jwt_decode.

    • @JD-hq1kn
      @JD-hq1kn 2 ปีที่แล้ว +2

      @@FreeLeaks You saved me from a heart attack... Thanks man.

  • @devendradangare440
    @devendradangare440 ปีที่แล้ว +2

    Strange. Installing jsonwebtoken on server side was fine. But in order to use it on the dashboard page which is in the client side. cd client and npm i jsonwebtoken is giving me tons of error about crypto and stream!!!!!!!!!!!!!!!!!!!!!!!!!!! THEN USE in client u can remove it and install
    >npm i jwt-decode
    its work to me

  • @kalyanking1080
    @kalyanking1080 3 ปีที่แล้ว +1

    bhai saab itna kuch ek video me op bhai

  • @pastuh
    @pastuh 3 ปีที่แล้ว +1

    I think most peoples struggle to launch production app.
    Confusing which server to choose, need to think about server limits and when to switch to cloud services for images and so on..

  • @leocode128
    @leocode128 2 ปีที่แล้ว +1

    Hi sir , a big fan of how to teach, please continue using vs code as the coding ground , its much more easy to use and understand all small bits and pieces than codedamn playground

    • @codedamn
      @codedamn  2 ปีที่แล้ว

      What is something you find fundamentally difficult with playgrounds right now? Trying to improve the experience there too

  • @lakshmikesarwani1278
    @lakshmikesarwani1278 2 ปีที่แล้ว +1

    Best video which I needed 🙏

  • @rondotexe
    @rondotexe 2 ปีที่แล้ว

    7 minutes in but loving this video so far!

  • @rainprahlad
    @rainprahlad 3 ปีที่แล้ว

    Hitesh Sir alternative is here !, Great Work .

  • @tora3492
    @tora3492 3 ปีที่แล้ว +1

    thumbnail is dope ♥️♥️

  • @kirito6374
    @kirito6374 2 ปีที่แล้ว +3

    u cannot just import jsonwebtoken inside react
    after webpack 5. its give polyfill error

    • @sarthakmoriya541
      @sarthakmoriya541 ปีที่แล้ว

      how to solve that ??

    • @ddhruvarora
      @ddhruvarora ปีที่แล้ว

      @@sarthakmoriya541 use react-jwt instead

  • @jasonperschcoding2474
    @jasonperschcoding2474 2 ปีที่แล้ว +5

    Great tutorial! That helped me alot. Just one note: I did some queries with mongosh in parallel and it seems to have problems with the collection name 'user-data' (doing an db.user-data.find() produced an error message). After renaming the collection to (e.g.) 'users', problem was gone.

    • @codedamn
      @codedamn  2 ปีที่แล้ว +6

      Yes, that’s because you had a dash in collection name. In that case write it like this: db['user-data'].find... and it would work

    • @jasonperschcoding2474
      @jasonperschcoding2474 2 ปีที่แล้ว +4

      @@codedamn Ah.... thank you! Didn't know this solution yet.

  • @DEV_XO
    @DEV_XO 3 ปีที่แล้ว +8

    Still worthy to build a mern app isntead of a nextjs app? I used to love mern, until I discovered next, what do u think about it?
    Nice videos also!

    • @kaushikrishi01
      @kaushikrishi01 3 ปีที่แล้ว

      hey, can you simplify what you found good in next

    • @DEV_XO
      @DEV_XO 3 ปีที่แล้ว

      @@kaushikrishi01 nothing much, the fact that you can deploy your project anytime with 1 click. Im a mern lover, but we have to choose productivity from time to time.
      And ofc, the SEO, the SEO my friend.

    • @chetan9533
      @chetan9533 3 ปีที่แล้ว

      @@DEV_XO I haven't explored nextjs yet. Does nextjs somehow remove the need to connect your app to a mongodb + express back-end? Or is it like a mern stack app only with nextJS used instead of reactJS?

    • @mitejmadan8672
      @mitejmadan8672 3 ปีที่แล้ว +1

      @@chetan9533 In next js you don't need to create two seperate app like the node server and react server. It is a mixture of both. There are actually multiple ways in which you can connect to db in next js. It depends on the size of data. You can check out the course on next js from codedamn. There are many great resources available on yt also.

    • @chetan9533
      @chetan9533 3 ปีที่แล้ว

      @@mitejmadan8672 ohhhh ok thanks.

  • @ayushchugh1797
    @ayushchugh1797 3 ปีที่แล้ว

    I watched tons of videos for auth this is the best one

  • @MrWarriyo
    @MrWarriyo 2 ปีที่แล้ว +1

    Thanks buddy! this helps a lot.

  • @saajidhnawwar8505
    @saajidhnawwar8505 2 ปีที่แล้ว +2

    can you do the logout function too

  • @pavankumar-gp9zx
    @pavankumar-gp9zx 3 ปีที่แล้ว

    addicted to your video's

  • @leranCoding
    @leranCoding 3 ปีที่แล้ว

    I am excited to watch part 2

  • @HadiRazal
    @HadiRazal ปีที่แล้ว +1

    thank you so much 😍

  • @soulninjadev
    @soulninjadev 3 ปีที่แล้ว

    shldve probably used typescript but yeah great video! thanks

  • @עידןאמברמוביץ
    @עידןאמברמוביץ ปีที่แล้ว +1

    Am I the only one who has problem with the line "import jwt from 'jsonwebtoken'" in the client side in the dashborad file? if anyone had this problem and was able to solve it, please let me know how!

  • @anonytribe
    @anonytribe ปีที่แล้ว +1

    Vscode theme u'r using??

  • @wallstudios962
    @wallstudios962 ปีที่แล้ว +1

    Nice video! But I get this error when using jwt in frontend: Module not found: Error: Can't resolve 'crypto' in '/home/miguelangel/dev/computerscienceia/screenser/client/node_modules/jsonwebtoken'

    • @NerdRishu
      @NerdRishu ปีที่แล้ว +1

      Hey I am have same issue did you find any solution to it

  • @developer_hadi
    @developer_hadi ปีที่แล้ว +1

    Bro please, make a video on how to don't let any url to send requests to my api, using cors, I mean that I want only a specific urls to send requests with specific methods to my api, and also do the front end because I could implement the server but with the front end there's an error i don't know how to do the headers thing

  • @dwivedi6037
    @dwivedi6037 2 ปีที่แล้ว

    Sir your communication skills really amazing I'm big fan of your voice and communication ♥️♥️
    Where are you from

  • @ramziosta
    @ramziosta 2 ปีที่แล้ว +2

    @15:22 I am still getting an empty object {}, I can see the data in payload in network tab in browser, and If i send a request using POSTMAN it logs it in the console and to the database

    • @ayushjalan5964
      @ayushjalan5964 5 หลายเดือนก่อน

      Same error bro. did you find any solution to it?

  • @wojciechjarosz420
    @wojciechjarosz420 3 ปีที่แล้ว

    Very nice tut, good explanation!

  • @JorgeBlancoPhotography
    @JorgeBlancoPhotography 3 ปีที่แล้ว +2

    would be nice if you used mysql, more usable in the real world

  • @ckiv1992
    @ckiv1992 ปีที่แล้ว

    Giant help!!!Thank you soooo much

  • @vaalarivan_p
    @vaalarivan_p 2 ปีที่แล้ว +1

    im getting the following error:
    Uncaught ReferenceError: process is not defined in node_modules/jsonwebtoken/lib/psSupported.js. please help me resolve this error, ive searched over an hour

  • @soulninjadev
    @soulninjadev 3 ปีที่แล้ว

    NEEDED THIS 🤝🤝🙏

  • @codencamp
    @codencamp 2 ปีที่แล้ว +1

    if you get this error message Error message "error:0308010C:digital envelope routines::unsupported", try writing this line on your start script: "start": "react-scripts --openssl-legacy-provider start".
    if you get this error "'React' must be in scope when using JSX" try writing this to your imports:
    import React, { Component being use goes here } from 'react';

  • @VijayKumar-pd7vv
    @VijayKumar-pd7vv 3 ปีที่แล้ว

    Damn I'm flattered , thanks for the tutorial

  • @mehr8248
    @mehr8248 2 ปีที่แล้ว

    Thanks a lot for the great tutorial! ❤

  • @dustinjohnson5500
    @dustinjohnson5500 2 ปีที่แล้ว +1

    How do you use localStorage? I think I initially was following another person when attempting to work on my project and he had created a localStorage.js file in a util folder inside his client directory. So just curious as to how you are actually making use of it

  • @saleh.a1994
    @saleh.a1994 2 ปีที่แล้ว

    you make it so easy thank you so much :)

  • @dhruvsharma2399
    @dhruvsharma2399 3 ปีที่แล้ว +1

    Its better to show the final app in the intro of the video,

  • @Orionzmx1723
    @Orionzmx1723 2 ปีที่แล้ว +13

    Hi you can't use 'import jwt from 'jsonwebtoken' on the frontend due to a webpack v5 issue. Does anyone know how to solve this?

  • @sachinrawat4815
    @sachinrawat4815 2 ปีที่แล้ว +1

    But how to expire token on user logout?

  • @khanfaysal993
    @khanfaysal993 ปีที่แล้ว

    awesome thinking process

  • @junior2441
    @junior2441 ปีที่แล้ว

    Awesome tutorial!!

  • @365Pancakes
    @365Pancakes 2 ปีที่แล้ว +1

    What is the purpose of the quote functionality (for example, see 48:45)? Also, anyone figured out how to implement the logout feature?

    • @garbjorn1757
      @garbjorn1757 2 ปีที่แล้ว +2

      1. Its just populating the data for the user. A function like posting in facebook.
      2. jwt.sign({ id }, process.env.JWT_SECRET, {
      expiresIn: maxAge
      }); // create jwt with expiration. maxAge is in seconds
      to log out the user, create a function that sets the expiration to 1 second

  • @leonardohurovich3381
    @leonardohurovich3381 2 ปีที่แล้ว +2

    Module not found: Error: Can't resolve 'jsonwebtoken'
    Do you have any idea how to solve this error? It happened when I was halfway through the authentication part

    • @roshangeorge97
      @roshangeorge97 2 ปีที่แล้ว

      it seems there was some syntax changes in jwt, view their latest documentation

  • @arvindshelke8889
    @arvindshelke8889 3 ปีที่แล้ว

    Great tutorial so far....👌👌
    btw is it fine to skip semicolons
    or is it a bad impression ?

  • @user-RJT123
    @user-RJT123 ปีที่แล้ว

    Hi, this is very good, well done! But can't you do it a bit slower anyway this is a beginner type like me😉. with respect!

  • @wdymidgaf
    @wdymidgaf ปีที่แล้ว

    Gem of a tutorial!

  • @keshavgarg7381
    @keshavgarg7381 2 ปีที่แล้ว

    Which theme and font you are using. Please 🙏 tell me bhaiya!!!

  • @gamegem574
    @gamegem574 2 ปีที่แล้ว +1

    VM34:1 Uncaught (in promise) SyntaxError: Unexpected token '

    • @sarfarazpycoder7870
      @sarfarazpycoder7870 ปีที่แล้ว

      I have solved that, what I did is I remove /api/register i just put only /register

    • @zohebahmad9633
      @zohebahmad9633 ปีที่แล้ว

      @@sarfarazpycoder7870 i faced this issue specifically for the /api/quote fetch call found in Dashboard.js

  • @omkargavhane921
    @omkargavhane921 2 ปีที่แล้ว

    Great tutorial 👍👏

  • @HaifengZhu-pn3uq
    @HaifengZhu-pn3uq 5 หลายเดือนก่อน

    hi, is MERN good for quick development?

  • @muftaudeenjimoh9678
    @muftaudeenjimoh9678 2 ปีที่แล้ว

    Amazing video btw 👌

  • @osamaayub405
    @osamaayub405 5 หลายเดือนก่อน

    can you make a video on google authentication in mernstack

  • @rajan-u6b
    @rajan-u6b 3 ปีที่แล้ว

    instead of using mongoose or monk, Why no one prefer mongodb driver?

  • @ShubhamPatil-rr4on
    @ShubhamPatil-rr4on 2 ปีที่แล้ว

    I love your content ❤️

  • @nacerkraa9549
    @nacerkraa9549 ปีที่แล้ว

    Thank you so much!

  • @akshayboddhul
    @akshayboddhul 3 ปีที่แล้ว

    Which theme is this and share extension list... awesome theme I think is it dark one pro???

  • @jannikstach3494
    @jannikstach3494 ปีที่แล้ว

    Thanks, super tutorial

  • @shlomiyahbes4882
    @shlomiyahbes4882 ปีที่แล้ว

    Thank you ! great vide !~

  • @abhidadhaniya5701
    @abhidadhaniya5701 2 ปีที่แล้ว

    Which VSCode Theme are you using?

  • @Mohammad-sm3sk
    @Mohammad-sm3sk 3 ปีที่แล้ว

    plese tell about mern stack future
    mern vs wp devvloper which best|?

  • @karanamkarthik356
    @karanamkarthik356 2 ปีที่แล้ว

    amazing tutorial

  • @siddharthjoshi3328
    @siddharthjoshi3328 2 ปีที่แล้ว

    Can I use a postgres database and follow the same process as shown ?

  • @DIVYADIVYA-kl3ri
    @DIVYADIVYA-kl3ri 2 ปีที่แล้ว

    sir, what does that 22 years indicate on your home screen?

  • @xboy2374
    @xboy2374 2 หลายเดือนก่อน

    why you not use refresh token

  • @bishnudas3562
    @bishnudas3562 2 ปีที่แล้ว +1

    13:34 when you get frustrated naming a file 😂

    • @talha6998
      @talha6998 2 ปีที่แล้ว

      haha i noticed too XD

  • @sarfarazpycoder7870
    @sarfarazpycoder7870 ปีที่แล้ว

    I have tried so much but req.body is giving undefined every time 15-16 min

  • @maniksi2855
    @maniksi2855 2 ปีที่แล้ว

    i am impressed.

  • @freshersway
    @freshersway ปีที่แล้ว

    Iam getting error at user registration if I entered new email but response showing duplicate email

  • @taetaereporter
    @taetaereporter ปีที่แล้ว +1

    what on earth is a quote

  • @sabrinalzbh
    @sabrinalzbh 3 ปีที่แล้ว

    Hey there,
    Do you have a project for a bug tracker using MERN?

  • @md.farzan5596
    @md.farzan5596 2 ปีที่แล้ว

    I think it's vulnerable to store jwt inside localStore, including anyone can get access if they has token?

  • @mdakramkhan166
    @mdakramkhan166 6 หลายเดือนก่อน

    What about logout flow?

  • @Inthenorthen
    @Inthenorthen ปีที่แล้ว

    why dont you guys show the project link?