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

Поделиться
HTML-код
  • Опубликовано: 23 янв 2025

Комментарии • 245

  • @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 года назад +48

    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 года назад +49

    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 })

  • @alastairtooth6252
    @alastairtooth6252 3 года назад +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 3 года назад +10

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

    • @reddinagaravikumar1402
      @reddinagaravikumar1402 3 года назад +1

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

    • @alastairtooth6252
      @alastairtooth6252 3 года назад +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

  • @ailany
    @ailany 2 года назад +1

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

  • @AlekVila
    @AlekVila 3 года назад +6

    I learned so much here. Thank you!

  • @contentshark5122
    @contentshark5122 3 года назад

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

  • @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.

  • @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.

  • @adibpathan41833
    @adibpathan41833 Год назад

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

  • @A_Saban
    @A_Saban 3 года назад +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

  • @abhilashpoojary3812
    @abhilashpoojary3812 2 года назад +1

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

  • @helloworldxd1931
    @helloworldxd1931 3 года назад +2

    waiting for more MERN projects
    Thank You very much!!

  • @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.

  • @rondotexe
    @rondotexe 2 года назад

    7 minutes in but loving this video so far!

  • @kalyanking1080
    @kalyanking1080 3 года назад +1

    bhai saab itna kuch ek video me op bhai

  • @rainprahlad
    @rainprahlad 3 года назад

    Hitesh Sir alternative is here !, Great Work .

  • @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?

  • @ojestutorials8387
    @ojestutorials8387 Год назад +1

    Amazing video! Nice teaching! Good job👍

  • @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!

  • @tora3492
    @tora3492 3 года назад +1

    thumbnail is dope ♥️♥️

  • @Chad-ms4ym
    @Chad-ms4ym 2 года назад +2

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

  • @lakshmikesarwani1278
    @lakshmikesarwani1278 2 года назад +1

    Best video which I needed 🙏

  • @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 9 месяцев назад

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

  • @robinmahato
    @robinmahato 3 года назад +1

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

  • @mikayilgacek
    @mikayilgacek 2 года назад +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.

  • @Raj_Vishwa1
    @Raj_Vishwa1 3 года назад

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

  • @leranCoding
    @leranCoding 3 года назад

    I am excited to watch part 2

  • @thekannadacoder8134
    @thekannadacoder8134 2 года назад

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

  • @ayushchugh1797
    @ayushchugh1797 3 года назад

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

  • @saudkhan1080
    @saudkhan1080 3 года назад +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.

  • @pavankumar-gp9zx
    @pavankumar-gp9zx 3 года назад

    addicted to your video's

  • @Sonu-tg6tg
    @Sonu-tg6tg 3 года назад +4

    want this type of MERN projects

  • @muftaudeenjimoh9678
    @muftaudeenjimoh9678 2 года назад

    Amazing video btw 👌

  • @VijayKumar-pd7vv
    @VijayKumar-pd7vv 3 года назад

    Damn I'm flattered , thanks for the tutorial

  • @junior2441
    @junior2441 Год назад

    Awesome tutorial!!

  • @wojciechjarosz420
    @wojciechjarosz420 3 года назад

    Very nice tut, good explanation!

  • @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

  • @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

  • @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

  • @MrWarriyo
    @MrWarriyo 3 года назад +1

    Thanks buddy! this helps a lot.

  • @ckiv1992
    @ckiv1992 2 года назад

    Giant help!!!Thank you soooo much

  • @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.

  • @kirito6374
    @kirito6374 2 года назад +3

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

  • @mehr8248
    @mehr8248 2 года назад

    Thanks a lot for the great tutorial! ❤

  • @omkargavhane921
    @omkargavhane921 2 года назад

    Great tutorial 👍👏

  • @wdymidgaf
    @wdymidgaf 2 года назад

    Gem of a tutorial!

  • @ShubhamPatil-rr4on
    @ShubhamPatil-rr4on 3 года назад

    I love your content ❤️

  • @khanfaysal993
    @khanfaysal993 Год назад

    awesome thinking process

  • @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

  • @DeepakVishwakarma-li8wq
    @DeepakVishwakarma-li8wq 3 года назад +1

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

  • @HadiRazal
    @HadiRazal Год назад +1

    thank you so much 😍

  • @shaileshdubey3175
    @shaileshdubey3175 3 года назад

    Sir at time stamp 21:35 i did not see mongodb warning..just showing server running at 1337...i followed each step carefully cross checked it but still could not find...using vs code with npm ...please reply

    • @dylbraddb
      @dylbraddb 2 года назад

      Make sure mongodb service is running

  • @bmbm-n2m
    @bmbm-n2m Месяц назад

    Local storage or cookies which one is better approach

  • @saleh.a1994
    @saleh.a1994 2 года назад

    you make it so easy thank you so much :)

  • @365Pancakes
    @365Pancakes 3 года назад +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 3 года назад +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

  • @anonytribe
    @anonytribe Год назад +1

    Vscode theme u'r using??

  • @saajidhnawwar8505
    @saajidhnawwar8505 3 года назад +2

    can you do the logout function too

  • @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

  • @developer_hadi
    @developer_hadi 2 года назад +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

  • @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..

  • @shlomiyahbes4882
    @shlomiyahbes4882 Год назад

    Thank you ! great vide !~

  • @soulninjadev
    @soulninjadev 3 года назад

    NEEDED THIS 🤝🤝🙏

  • @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

  • @jannikstach3494
    @jannikstach3494 2 года назад

    Thanks, super tutorial

  • @עידןאמברמוביץ
    @עידןאמברמוביץ Год назад +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!

  • @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

  • @karanamkarthik356
    @karanamkarthik356 2 года назад

    amazing tutorial

  • @tejass817
    @tejass817 2 года назад

    Great Content

  • @freshersway
    @freshersway Год назад

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

  • @samadanvarov4264
    @samadanvarov4264 2 года назад

    Hello. I have some problem when I try to get token from local storage. It show me null when I print it. And in video doesnt say sometging about where we set actually this token to localstorage

  • @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

  • @Sonu-tg6tg
    @Sonu-tg6tg 3 года назад

    Thanks for such awesome videos, always waiting for your new videos, will be glad to get t-shirt giveaway

  • @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

  • @Orionzmx1723
    @Orionzmx1723 3 года назад +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?

  • @eshadas7572
    @eshadas7572 2 года назад

    I implemented this, when login successfull it will navigate to my dashboard page, since it's admin template, but got error like " is not able to match the url "/dashboard" because it does not start with the basement, so the won't render anything . Please help me it's urgent

  • @sachinrawat4815
    @sachinrawat4815 3 года назад +1

    But how to expire token on user logout?

  • @soulninjadev
    @soulninjadev 3 года назад

    shldve probably used typescript but yeah great video! thanks

  • @islomabdulloyev4860
    @islomabdulloyev4860 2 года назад

    I faced a problem when send x-access-token from react to node server. When I handle it in Node server. It says thats this toen is undefined. whats the problem. Who can help me

  • @md.farzan5596
    @md.farzan5596 2 года назад

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

  • @maniksi2855
    @maniksi2855 3 года назад

    i am impressed.

  • @keshavgarg7381
    @keshavgarg7381 3 года назад

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

  • @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.

  • @lisamannion2449
    @lisamannion2449 2 года назад

    Thank you so much!!

  • @xboy2374
    @xboy2374 6 месяцев назад

    why you not use refresh token

  • @siddharthjoshi3328
    @siddharthjoshi3328 2 года назад

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

  • @secondarypemail7181
    @secondarypemail7181 2 года назад

    How is vscode automatically suggesting the code can anyone tell the name of the extension?

  • @bishnudas3562
    @bishnudas3562 3 года назад +1

    13:34 when you get frustrated naming a file 😂

    • @talha6998
      @talha6998 3 года назад

      haha i noticed too XD

  • @aakashgoswami2356
    @aakashgoswami2356 2 года назад

    I am getting this error "MongooseError: Operation `userData.insertOne()` buffering timed out after 10000ms
    at Timeout. (C:\Users\aakashgoswami\Desktop\React Development\Authentication\server
    ode_modules\mongoose\lib\drivers
    ode-mongodb-native\collection."
    plz help me out.

  • @DIVYADIVYA-kl3ri
    @DIVYADIVYA-kl3ri 3 года назад

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

  • @HaifengZhu-pn3uq
    @HaifengZhu-pn3uq 9 месяцев назад

    hi, is MERN good for quick development?

  • @abhidadhaniya5701
    @abhidadhaniya5701 2 года назад

    Which VSCode Theme are you using?

  • @ambitionhut
    @ambitionhut 2 года назад

    When i use the value={whatever} it doesent allow me to write in it in the application. The form is like disabled, any idea why?

    • @ignatiusmusonda6658
      @ignatiusmusonda6658 2 года назад

      Hi,
      have you defined the onChange handler? i had a similar problem before defining

  • @suryapratap9915
    @suryapratap9915 Год назад

    @codedamn You encrypted the password on the server side, but user is sending the password in request body as plain text. what if someone attacks in between your frontend and and backend call? how would you handle that case. Please explain. Thank you .

  • @arod3295
    @arod3295 2 года назад

    I’m stuck at 13min. I can’t get the fetch output to appear. I don’t see the same errors or (in the network tab) ‘register’ routes under the “Name” column

  • @manogaransa2814
    @manogaransa2814 2 года назад

    Hi...
    I am getting a below error "Unable to get local issuer certificate". Please help on this
    heroku login
    Warning: Ignoring extra certs from `C:\path\to`, load failed: error:02001005:system library:fopen:Input/output
    error
    » Warning: heroku update available from 7.53.0 to 7.63.4.
    heroku: Press any key to open up the browser to login or q to exit:
    Error: unable to get local issuer certificate

  • @jasonperschcoding2474
    @jasonperschcoding2474 3 года назад +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  3 года назад +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 3 года назад +4

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

  • @costinelnedelcu1877
    @costinelnedelcu1877 Год назад

    Does anyone know what is the color theme of his VS ????

  • @mdakramkhan166
    @mdakramkhan166 9 месяцев назад

    What about logout flow?

  • @akshayboddhul
    @akshayboddhul 3 года назад

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