Sakura Dev
Sakura Dev
  • 109
  • 1 372 625
GraphQL Authentication & Authorization in NestJS
Unlock the full potential of GraphQL in NestJS with this deep dive into Authentication and Role-Based Authorization! 🚀
In this video, we'll explore:
Setting up GraphQL in a NestJS project with a focus on security.
Implementing JWT Authentication for secure access.
Building a robust Role-Based Authorization system to manage user permissions effectively.
Real-world examples and best practices to keep your application secure.
Whether you're a beginner or an experienced developer, this step-by-step tutorial will guide you through securing your API like a pro.
Don't forget to like, subscribe, and hit the bell icon for more tutorials on NestJS, Next.js, and full-stack development!
#NestJS #GraphQL #Authentication #Authorization #RoleBasedAuthorization
Переглядів: 828

Відео

NestJS GraphQL Course
Переглядів 1,1 тис.Місяць тому
Welcome to the channel! In this video, we’re exploring how to use GraphQL with NestJS. Learn the basics of GraphQL, how it works, and how to set it up in a NestJS application. Whether you're new to GraphQL or NestJS, this video will help you understand the concepts and build your own APIs effectively. Chapters: 0:00 :00 Intro 00:01:54 What is the GraphQL? 00:02:22 How Does GraphQL Differ From R...
Is It Really Useful? JS Currying Real Use Cases in React & Next.js
Переглядів 784Місяць тому
In this video, we’ll demystify currying and explore its practical applications in React and Next.js. Learn how currying can help you write cleaner, more reusable code for managing state, handling events, and building dynamic higher-order components. Whether you're new to currying or looking to see it in action, this video has you covered with real-world examples and easy-to-follow explanations....
What Do These Signs Means in Node.JS Packages?
Переглядів 395Місяць тому
Confused about the caret (^) and tilde (~) symbols in your package.json file? 🤔 In this video, I'll explain what these symbols mean, how they affect your dependency updates, and when to use each one. Whether you're a beginner or looking for a quick refresher, this guide will help you master package.json versioning in under a minute! 🚀 📌 Topics Covered: What does ^ mean in package.json? What doe...
Secure Forms in Next.js: Honey Pot Technique
Переглядів 1,2 тис.2 місяці тому
Secure Your Forms in Next.js with the Honey Pot Technique! Tired of spam bots flooding your web forms? In this tutorial, I’ll show you how to use the honey pot technique to secure your Next.js forms effectively-no frustrating CAPTCHAs required!
All in One NextJS And NestJS Full Authentication Monorepo Project
Переглядів 21 тис.3 місяці тому
Hey everyone, welcome back to Sakura dev channel! In today's video, we're diving into full stack authentication using Next.js and Nest.js with Turborepo. I'll walk you through setting up a powerful and scalable authentication system step-by-step. You will learn everything you need to know about authentication in a monorepo of Nextjs and NestJS projetcs. We’ll handle most of the authentication o...
Build a NestJS & NextJS Monorepo with Turborepo - Step by Step Tutorial
Переглядів 9 тис.5 місяців тому
Build a NestJS & NextJS Monorepo with Turborepo - Step by Step Tutorial
Drizzle ORM in NestJS: Step By Step Crash Course
Переглядів 6 тис.5 місяців тому
Drizzle ORM in NestJS: Step By Step Crash Course
NestJS Google OAuth 2 + React App
Переглядів 10 тис.5 місяців тому
NestJS Google OAuth 2 React App
A Trick For Enabling Global Auth In NestJS
Переглядів 1,3 тис.5 місяців тому
A Trick For Enabling Global Auth In NestJS
Mastering Role Based Access Control in NestJS
Переглядів 6 тис.5 місяців тому
Mastering Role Based Access Control in NestJS
How To Revoke JWT Tokens In NestJS : Easy Step-by-Step Guide
Переглядів 3,1 тис.6 місяців тому
How To Revoke JWT Tokens In NestJS : Easy Step-by-Step Guide
NestJS Refresh Token: Step By Step Guide With Passport.JS
Переглядів 4,6 тис.6 місяців тому
NestJS Refresh Token: Step By Step Guide With Passport.JS
NestJS Authentication With JWT Strategy
Переглядів 4 тис.6 місяців тому
NestJS Authentication With JWT Strategy
NestJS Authentication With Local Strategy
Переглядів 2,9 тис.6 місяців тому
NestJS Authentication With Local Strategy
NestJS Full Course -13: Hashing
Переглядів 1,8 тис.6 місяців тому
NestJS Full Course -13: Hashing
NestJS Config Module: Using environment variables
Переглядів 4,7 тис.6 місяців тому
NestJS Config Module: Using environment variables
NestJs Full Course -11: Pagination
Переглядів 2,9 тис.6 місяців тому
NestJs Full Course -11: Pagination
NestJs Full Course -10: TypeORM Seeding
Переглядів 3,6 тис.6 місяців тому
NestJs Full Course -10: TypeORM Seeding
NestJs Full Course -9: Many To Many Relationships with Type ORM
Переглядів 2,7 тис.6 місяців тому
NestJs Full Course -9: Many To Many Relationships with Type ORM
NestJs Full Course -8: One To Many Relationship in Type ORM
Переглядів 2 тис.6 місяців тому
NestJs Full Course -8: One To Many Relationship in Type ORM
NestJs Full Course -7: One To One Relations
Переглядів 1,8 тис.6 місяців тому
NestJs Full Course -7: One To One Relations
NestJS Full Course -6: CRUD
Переглядів 2,9 тис.6 місяців тому
NestJS Full Course -6: CRUD
NestJS Full Course 2024 -5: TypeORM
Переглядів 4 тис.6 місяців тому
NestJS Full Course 2024 -5: TypeORM
NestJS Full Course -4: Dependency Injection
Переглядів 3,1 тис.7 місяців тому
NestJS Full Course -4: Dependency Injection
NestJs Full Course -3: Headers Access and Validation
Переглядів 3,3 тис.7 місяців тому
NestJs Full Course -3: Headers Access and Validation
NestJs Full Course 2024 -2: Validation In NestJs (ZOD Included)
Переглядів 9 тис.7 місяців тому
NestJs Full Course 2024 -2: Validation In NestJs (ZOD Included)
NestJS Full Course 2024
Переглядів 21 тис.7 місяців тому
NestJS Full Course 2024
Stripe Online Payments In Next JS 14 - Full Guide
Переглядів 3,9 тис.8 місяців тому
Stripe Online Payments In Next JS 14 - Full Guide
Search Bar With useDebounce - Next.JS 14 Full Stack Real Project - Part 9
Переглядів 3,2 тис.8 місяців тому
Search Bar With useDebounce - Next.JS 14 Full Stack Real Project - Part 9

КОМЕНТАРІ

  • @ezeanichucks3728
    @ezeanichucks3728 20 годин тому

    This only works when you make calls from within your component. How about external axios calls from Redux Tool Kit, for instance. We can't use hooks like const {update} = useSession() outside nextjs components!

  • @suhaib_nisar
    @suhaib_nisar День тому

    Great 👍🏻

    • @SakuraDev
      @SakuraDev День тому

      Thanks! Glad you liked it 👍

    • @SakuraDev
      @SakuraDev День тому

      By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from Tech books. I would be very glad if you subscribe to my new channel: ua-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html

    • @suhaib_nisar
      @suhaib_nisar 23 години тому

      @@SakuraDev I subscribed it 👍🏻

  • @Igor-o9w
    @Igor-o9w 3 дні тому

    Great tutorial! 🔥 I really enjoyed how thoroughly you explained the authentication process in a Next.js and Nest.js monorepo with Turborepo. Everything is clear and to the point, without any unnecessary fluff. Thanks for such high-quality content-keep up the amazing work! 💪🚀

    • @SakuraDev
      @SakuraDev День тому

      Thanks so much! I'm glad you enjoyed the tutorial, and I appreciate your kind words! 💪

    • @SakuraDev
      @SakuraDev День тому

      By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from Tech books. I would be very glad if you subscribe to my new channel: ua-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html

  • @anna_sudol664
    @anna_sudol664 3 дні тому

    Thanks Sakura for amazing tutorial

  • @LodeStarYT
    @LodeStarYT 3 дні тому

    I'm a little confused why you split the work of session Management between servers. All nextjs session functions you wrote in nextjs app using cookie function could just call our backend (nestjs) as well right? Like instead of doing cookies in nextjs server actions, these actions could just call our nestjs server? You probably did the splitting due to distribution of load but I think it was a little confusing. If there's any other reason please let me know.

    • @SakuraDev
      @SakuraDev День тому

      Great observation! 😊 Yes, you’re absolutely right that session management can be fully handled in NestJS. The reason I split it between Next.js and NestJS was mainly for performance optimization and reducing backend calls. By handling cookies in Next.js server actions: ✔️ We reduce unnecessary API requests to NestJS, improving response times. ✔️ It allows better integration with Next.js middleware for SSR/SSG workflows. ✔️ In some cases, it simplifies authentication flows (e.g., checking session validity before making a request to NestJS). That said, centralizing everything in NestJS is also a valid approach, especially if you want strict backend control. Hope that clears it up! Let me know if you’d like a deeper dive into either approach. 🙌

    • @SakuraDev
      @SakuraDev День тому

      By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from Tech books. I would be very glad if you subscribe to my new channel: ua-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html

    • @LodeStarYT
      @LodeStarYT 21 годину тому

      @@SakuraDev oh yea this makes sense. Thnx for clarification. Also amazing content

  • @RagnarBarnsby
    @RagnarBarnsby 6 днів тому

    Thanks for making these videos. On this one I think you might be missing the .unique() constraint on userId. You have implemented the one-to-one in Drizzle 'relations' but your database schema looks like a one-to-many rather than a one-to-one. I was expecting the below: userId: integer("user_id").notNull().unique().references(() => users.id) Without the unique constraint it seems that many profiles could reference the same user, making it a many-to-one. Let me know if I have missed something, and thanks again.

    • @SakuraDev
      @SakuraDev День тому

      Great catch! 🎯 You’re absolutely right that without the .unique() constraint, the database schema allows multiple profiles to reference the same user, effectively making it a one-to-many relationship instead of one-to-one. I’ll double-check the implementation and update it if needed. Thanks for the keen eye and for supporting the channel! 🚀

    • @SakuraDev
      @SakuraDev День тому

      By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from Tech books. I would be very glad if you subscribe to my new channel: ua-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html

  • @fatoyeoluwaseun
    @fatoyeoluwaseun 7 днів тому

    Great! Now you have saved me some future confusion 😆

    • @SakuraDev
      @SakuraDev 6 днів тому

      Glad to hear it! 👍

  • @joshdevofficial
    @joshdevofficial 7 днів тому

    fake filler settings can ignore hidden inputs

  • @mohamedyoussef8835
    @mohamedyoussef8835 9 днів тому

    Awesome tutorials +++++++++++++++++

    • @SakuraDev
      @SakuraDev День тому

      Thanks for watching and I'm glad you found it helpful!

    • @SakuraDev
      @SakuraDev День тому

      By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from Tech books. I would be very glad if you subscribe to my new channel: ua-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html

  • @samihabuawad3023
    @samihabuawad3023 9 днів тому

    Hi Thanks for the walkthrough I have faced one issue when having API and front-end (nextjs) in different domains, and after hours, I had solved it by opening the API endpoint related to getting the google oauth url in a NEW TAB so it will be in the same origin -- this cause CORS error I was getting to gone and successfully logging in I hope this may help someone later having similar situation as it is common having FE and API in different domians.

    • @khaledamr5023
      @khaledamr5023 9 днів тому

      im facing this problem , thanks for you comment

    • @SakuraDev
      @SakuraDev День тому

      Hey! 👋 Thanks for sharing your solution! This will definitely help others facing the same issue! 🚀 Appreciate you taking the time to share your experience. 🙌

    • @SakuraDev
      @SakuraDev День тому

      By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from Tech books. I would be very glad if you subscribe to my new channel: ua-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html

  • @mochamadrizky5056
    @mochamadrizky5056 9 днів тому

    Thanks for the explanation sir. May I ask why you don't directly include the role in the jwt payload?

    • @SakuraDev
      @SakuraDev День тому

      Great question! 🎯 Keeping roles in the DB ensures real-time accuracy-if a role changes, it's immediately reflected. Storing it in the JWT means users need to re-login to get updated roles. Both approaches have trade-offs! 🚀

    • @SakuraDev
      @SakuraDev День тому

      By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from Tech books. I would be very glad if you subscribe to my new channel: ua-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html

  • @TheFeRaZinha
    @TheFeRaZinha 10 днів тому

    Very nice video! Thanks for your effort, I've learned some great concepts

    • @SakuraDev
      @SakuraDev 9 днів тому

      You're welcome! I'm glad it was helpful.

    • @SakuraDev
      @SakuraDev 9 днів тому

      By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from popular tech books. I would be very glad if you subscribe to my new channel: ua-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html

  • @pantelisfan7144
    @pantelisfan7144 10 днів тому

    You should do a full guide with all of these resources in udemy. I would definitely buy it and I have a few people who would be interested in buying it too. Very good stuff and well explained. Some other topics to cover: - Caching with reds (using nestjs cache-manager) - Queues (nestjs-bullmq) - File uploading/streaming files - Websockets - Interceptors?

    • @SakuraDev
      @SakuraDev День тому

      Thank you for the kind words! 🙌 I’m glad you find the content helpful. I’ll definitely consider covering those topics in future tutorials. Stay tuned for more! 🚀

    • @SakuraDev
      @SakuraDev День тому

      By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from Tech books. I would be very glad if you subscribe to my new channel: ua-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html

  • @marcofari532
    @marcofari532 11 днів тому

    Hi brother, but shouldn't the jwt useguard decorator be put first and then the role useguard decorator? Otherwise how is the user id obtained to find the user in the DB and then insert it in the request, if the jwt token is not decoded first? I would have written it like this: @Roles (Role. EDITOR) @UseGuards (JwtAuthGuard) @UseGuards (RolesGuard) @Delete(':id')

    • @SakuraDev
      @SakuraDev 10 днів тому

      Hi, great question!. The guard that is closer to the function is run first. Because the function is passed as callback to the closet guard and then it returns a new function. The new function is passed to the next closest guard and so on

    • @marcofari532
      @marcofari532 10 днів тому

      @@SakuraDev OK thanks. I thought the first decorator was performed at the top until it went down to the last one that is the closest to the function

  • @xd-uj4xu
    @xd-uj4xu 12 днів тому

    thanks so much bro, this is not a common video like only javascript for example, this is more specific and so useful!

    • @SakuraDev
      @SakuraDev 10 днів тому

      You're welcome! It's always great to help others with more specialized topics like GraphQL and NestJS.

  • @AntNZ
    @AntNZ 12 днів тому

    Absolute Genius. Thank you so much for sharing this. My env handling just got 100% easier 🙏 Keep up the great work!

    • @SakuraDev
      @SakuraDev 10 днів тому

      Happy to help! 🙏

  • @AGM140580
    @AGM140580 13 днів тому

    As always excellent content! I look forward to the release of your new videos on the use of GraphQL in NestJS!

    • @SakuraDev
      @SakuraDev 10 днів тому

      I’m glad you find the content helpful, and I’m excited to share more about GraphQL with you soon!

  • @bilalqadri5312
    @bilalqadri5312 13 днів тому

    Excellent and easy to understandable content...💖💖💖

    • @SakuraDev
      @SakuraDev 13 днів тому

      Thanks so much for the love! ❤️

    • @SakuraDev
      @SakuraDev 13 днів тому

      By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from CS books. I would be very glad if you subscribe to my new channel: ua-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html

  • @AGM140580
    @AGM140580 13 днів тому

    Hello, Vahid! It's Great tutorial! Please write a lesson about testing in NestJS using the JWT Strategy example.

    • @SakuraDev
      @SakuraDev 13 днів тому

      I'm glad you found it helpful! Testing in NestJS is a crucial topic, and I'll definitely consider adding a video about it in the future.

  • @KrzysztofJerzyk-k6s
    @KrzysztofJerzyk-k6s 15 днів тому

    At 10:45 I got an ts error in the super(): Expected 0 arguments, but got 1 I have same code as you, same imports and problem (probably) with PassportStrategy(Strategy), got something changed recently in this library?

  • @AvikNayak_
    @AvikNayak_ 16 днів тому

    I have a question. Why are we using Promise.all here? Can't we just use prisma transaction?

  • @AGM140580
    @AGM140580 16 днів тому

    Incredible course! Thank you very much!

    • @SakuraDev
      @SakuraDev 13 днів тому

      You're very welcome!

  • @AGM140580
    @AGM140580 16 днів тому

    Tell me, please! Is it permissible to register a service of another module as a module provider? Or is it better to import another module to the current module, the service of which we want to use in the current module? At the same time, of course, the module that owns the service must export it in order to make the opportunity to use this service in the modules that import it.

    • @SakuraDev
      @SakuraDev 13 днів тому

      Hi @AGM140580! Great question! 😊 In NestJS, it’s better to import the module that exports the service rather than re-registering it as a provider. This ensures the service remains a singleton (if provided in the root) and follows NestJS's modular architecture. Just make sure the owning module exports the service in its exports array. Thanks for engaging!

  • @maso4u
    @maso4u 17 днів тому

    great tutorial

    • @SakuraDev
      @SakuraDev 17 днів тому

      I'm glad you found it helpful!

    • @SakuraDev
      @SakuraDev 17 днів тому

      By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from popular programming books. I would be very glad if you subscribe to my new channel: ua-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html

  • @swarnakadeepashan5277
    @swarnakadeepashan5277 18 днів тому

    <3

    • @SakuraDev
      @SakuraDev 18 днів тому

      Thank you so much 🙏. Hope it was helpful for you.

    • @SakuraDev
      @SakuraDev 18 днів тому

      By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from CS books. I would be very glad if you subscribe to my new channel: ua-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html

  • @swarnakadeepashan5277
    @swarnakadeepashan5277 19 днів тому

    <3

  • @swarnakadeepashan5277
    @swarnakadeepashan5277 19 днів тому

    Thank you

    • @SakuraDev
      @SakuraDev 19 днів тому

      Thanks for your feedback. Hope it was helpful for you!

  • @El-anrif_SB
    @El-anrif_SB 20 днів тому

    Thanks 👍

    • @SakuraDev
      @SakuraDev 19 днів тому

      You're welcome! Hope you found it helpful.

    • @SakuraDev
      @SakuraDev 19 днів тому

      By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from CS books. I would be very glad if you subscribe to my new channel: ua-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html

  • @AhmedMansour-tg5ez
    @AhmedMansour-tg5ez 20 днів тому

    a Great tutorial for those who wants to get a solid grip about the implementing the jwt authentication in nest Good Job, Vahid

    • @SakuraDev
      @SakuraDev 20 днів тому

      Thank you, Ahmed! I’m glad you found the tutorial helpful. JWT authentication is such an important topic in NestJS, and I’m thrilled it provided you with value.

  • @AGM140580
    @AGM140580 20 днів тому

    Please explain! Is it necessary to use Nextjs api route to set cookies in the browser? Isn't it better to do this using Nestjs? Will this help eliminate unnecessary redirects and the need to pass sensitive information to searchParams?

    • @SakuraDev
      @SakuraDev 20 днів тому

      Yes, you’re absolutely right! Using NestJS to handle cookies directly is often a better approach, as it centralizes logic and avoids unnecessary redirects or exposing sensitive information in searchParams. It’s a cleaner solution, especially in production-level applications. Let me know if you’d like more details or examples!

    • @AGM140580
      @AGM140580 13 днів тому

      @@SakuraDev Thank you very much for the answer! You are the best teacher. Please write down a lesson on how to properly process cookies in Nestjs. He really needs him!

  • @AGM140580
    @AGM140580 20 днів тому

    Your training video covers the topic of authentication perfectly! I haven’t seen anything better even in paid courses! I like the way you explain the material: repeating important aspects whenever possible. This way the information is absorbed better and everything becomes clear.

    • @SakuraDev
      @SakuraDev 20 днів тому

      Wow, thank you so much for such amazing feedback! 😊 I’m truly honored to hear that you found the video so helpful, even compared to paid courses.

    • @SakuraDev
      @SakuraDev 20 днів тому

      By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from CS books. I would be very glad if you subscribe to my new channel: ua-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html

    • @AGM140580
      @AGM140580 13 днів тому

      @@SakuraDev Signed! Serious topics. Great content. I will study. I recommend everyone.

  • @johnholanda7798
    @johnholanda7798 21 день тому

    very nice video, thanks from brazil!! you helping very very much

    • @SakuraDev
      @SakuraDev 21 день тому

      Thanks for watching! I'm happy to hear you found it useful. 👍

    • @SakuraDev
      @SakuraDev 21 день тому

      By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from CS books. I would be very glad if you subscribe to my new channel: ua-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html

  • @سليمنجم-ت1ش
    @سليمنجم-ت1ش 21 день тому

    man we are thankful for this course for real thank you

    • @SakuraDev
      @SakuraDev 21 день тому

      Thank you so much! 🙏 Hearing that means the world to me.

    • @SakuraDev
      @SakuraDev 21 день тому

      By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from CS books. I would be very glad if you subscribe to my new channel: ua-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html

  • @peterkisvaradi8488
    @peterkisvaradi8488 21 день тому

    Query params are strings when they arrive to the controller. In case of number validation error, modify the PaginationDTO properties with this decorator: @Type(() => Number) This will transforms the incoming string param to number. (class-transformer lib)

    • @SakuraDev
      @SakuraDev 21 день тому

      Nice tip 💯. Thanks for your feedback

  • @AhmedMansour-tg5ez
    @AhmedMansour-tg5ez 21 день тому

    A dense, yet fruitful video didn't know .env and config can do all fo that Thank You Vahid

    • @SakuraDev
      @SakuraDev 21 день тому

      Thanks for watching, I'm glad you found it helpful!

  • @AhmedMansour-tg5ez
    @AhmedMansour-tg5ez 21 день тому

    I got a question, by just passing the 'local' parameter to the AuthGuard, how did nest knew you meant the LocalStrategy? in 13:46 Thank you in advance for your efforts : )

    • @SakuraDev
      @SakuraDev 21 день тому

      Great question, Ahmed! 😊 Nest knows to use the LocalStrategy when you pass 'local' to the AuthGuard because the name 'local' is set in the LocalStrategy class using the @Injectable() decorator, typically through the super({}) call in the constructor of PassportStrategy. This name acts as an identifier, allowing the AuthGuard to link the strategy with the parameter you pass. Thank you for your thoughtful question, and I’m happy to explain further if needed! 🙌

  • @AhmedMansour-tg5ez
    @AhmedMansour-tg5ez 22 дні тому

    Well wow, this was kinda alot, thus I recommend watching this video either as sections, or at least one more time completely I appreciate your effort to simplify such a complicated topic actually

    • @SakuraDev
      @SakuraDev 22 дні тому

      Thanks for the feedback! I'm glad you found the explanation helpful. Thank you so much for support 💖

  • @aawave
    @aawave 24 дні тому

    I come from another language/framework. Some solutions you apply seem strange to me: 1. It seems hard to believe that such a basic feature as .env file support requires so much setup in NestJS. Is this the general way to do it, or is this applicable for your specific use case in your specific project? What is the basis that is generally enough for production level NestJS applications? 2. Why don't you use ConfigService? Your approach without ConfigService leads to manual type conversion, which does not seem to be a good practice. 3. Why would you disable TypeORM synchronize in prod, but enable it in dev? Won't this hide incorrect migrations and lead to bugs in stage/prod?

    • @SakuraDev
      @SakuraDev 21 день тому

      Thank you for your detailed questions! 😊 Let me address each point:

    • @SakuraDev
      @SakuraDev 21 день тому

      1- .env Setup in NestJS: Great observation! While .env support can feel more straightforward in some frameworks, NestJS intentionally separates concerns to align with its modular architecture. Using the @nestjs/config package for .env management is considered the standard way in NestJS, providing flexibility and scalability for larger applications. While it may seem like more setup initially, this approach ensures you can easily manage configurations across modules, which is particularly helpful for production-grade applications.

    • @SakuraDev
      @SakuraDev 21 день тому

      2- ConfigService Usage: You’re absolutely right about the benefits of ConfigService-it abstracts away manual parsing and type conversion, making configuration handling cleaner and more robust. In this project, I chose a more direct approach to show how the system works at a lower level, but I agree that using ConfigService is a better practice for production. I'll make a note to cover this in future videos to highlight the advantages!

    • @SakuraDev
      @SakuraDev 21 день тому

      3- TypeORM Synchronize: Enabling synchronize in development is helpful because it simplifies schema updates during active development. However, in production, it’s best to disable this and rely on proper migrations to ensure controlled and predictable database changes. You're correct that failing to test migrations thoroughly in a staging environment can lead to bugs in production. Best practice is to rigorously test migrations in a staging environment before deployment.

    • @SakuraDev
      @SakuraDev 21 день тому

      By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from CS books. I would be very glad if you subscribe to my new channel: ua-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html

  • @johnholanda7798
    @johnholanda7798 24 дні тому

    Very nice, thanks, Will you post this project on github?

    • @SakuraDev
      @SakuraDev 21 день тому

      Thanks for watching, I hope you enjoyed it! Here is the github Link github.com/vahid-nejad/nestjs-graphql-course

    • @SakuraDev
      @SakuraDev 21 день тому

      By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from CS books. I would be very glad if you subscribe to my new channel: ua-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html

    • @johnholanda7798
      @johnholanda7798 21 день тому

      @ of course

  • @sebasmrl
    @sebasmrl 24 дні тому

    Thank you for the video bro, but you have a conceptual error about modules because you don't inject the classes, you don't export the services, nor do you import the modules between them. The idea is to import modules and with them comes everything that is exported in "exports"

    • @SakuraDev
      @SakuraDev 24 дні тому

      Thanks for your feedback. Actually, I didn't understand your point. Could you please clarify that?

    • @sebasmrl
      @sebasmrl 23 дні тому

      When you create a module you must make sure that what you create in it only works within it. If you need to use things from module A in module B you must export in "exports" the functionalities or services that you want to provide to other modules; and in "providers" are the services that you provide in your own module. This is called module dependency, when module A depends on module B to work, therefore, module A should only contain in "imports:[ModuleB]" and would have access to all the functionalities of B (obviously when you use the services they will appear to come from the path where they are created, but internally the creation of the classes will be handled by the Dependency Injection Container). //Module A @Module({ imports:[PrismaModule, JwtModule, UserModule], controllers: [AuthController], providers: [AuthService], }) export class AuthModule {} //Module B @Module({ imports:[PrismaModule, JwtModule], controllers: [UserController], providers: [UserService, ], exports:[UserService], }) export class UserModule {}

  • @maso4u
    @maso4u 24 дні тому

    great tutorial

    • @SakuraDev
      @SakuraDev 24 дні тому

      Thanks for the feedback! 👍

    • @SakuraDev
      @SakuraDev 24 дні тому

      By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from CS books. I would be very glad if you subscribe to my new channel: ua-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html