Nestjs: Build A Real-Time Social Media Api (/W Websockets)
Published 5/2025
MP4 | Video: h264, 1920x1080 | Audio: AAC, 44.1 KHz
Language: English | Size: 19.78 GB | Duration: 26h 57m
Published 5/2025
MP4 | Video: h264, 1920x1080 | Audio: AAC, 44.1 KHz
Language: English | Size: 19.78 GB | Duration: 26h 57m
Build a real-time social media API with NestJS & WebSockets featuring chat, notifications, and live user updates
What you'll learn
Understand the fundamentals of WebSockets, from TCP and HTTP handshakes to persistent connections
Build a real-time chat application using raw WebSocket APIs to gain foundational knowledge
Use Socket IO to implement custom events, rooms, and namespaces for scalable communication
Apply NestJS fundamentals (modules, services, controllers, gateways, guards) in a real-world API
Integrate JWT authentication with WebSockets for secure real-time communication
Build real-time features like messaging, conversation, post, comment
Design a scalable real-time social media backend from scratch
Structure WebSocket gateways and services cleanly within a NestJS codebase
Think from a frontend perspective to shape and deliver real-time data effectively
Requirements
Basic knowledge of JavaScript and TypeScript
Familiarity with Node.js fundamentals (functions, modules, async/await)
Some experience with HTTP APIs (e.g., building or using REST APIs)
No prior experience with WebSockets or NestJS is required — everything will be explained step by step!
Basic knowledge of MongoDB is helpful
Description
You may have heard the phrase: "To build a chat app, you need WebSockets." But have you ever stopped to ask — why?In this hands-on course, you’ll learn to build a real-time social media API using NestJS and WebSockets (Socket IO) — not just by memorizing syntax, but by understanding the fundamentals behind real-time communication. We’ll explore how sockets work under the hood, how data flows between client and server, and how to architect a system that can scale and respond instantly.Rather than spoon-feeding you code, this course teaches you how to read documentation, think critically, and apply these skills to your own projects. You'll gain the confidence to build and extend real-time features independently.We start with a deep dive into the fundamentals of WebSockets, from how the TCP handshake works to the HTTP upgrade process that opens a persistent WebSocket connection. You’ll clearly understand what’s happening behind the scenes before writing a single line of code.Next, you'll build a simple chat app using raw WebSocket APIs, giving you a solid foundation before introducing any libraries. Once you understand the basics, we’ll transition into Socket IO, where you’ll explore its core concepts including custom events, rooms, and namespaces — and how they simplify real-time communication.Once your WebSocket knowledge is solid, we shift gears and jump into NestJS fundamentals. You’ll learn about modules, controllers, services, and guards — and then apply them to build a complete, real-time social media backendWhy This Course?This is not just another crash course. It’s a practical, project-driven guide that helps you think like a backend engineer. If you’re comfortable with JavaScript/TypeScript, have some Node.js or NestJS experience, and want to level up your backend skills with real-time architecture, this course is for you.By the end, you’ll walk away with a complete real-time backend — ready to power your own chat app, live feed, or social platform.
Overview
Section 1: Introduction
Lecture 1 Introduction
Section 2: WebSockets Fundamental
Lecture 2 HTTP vs Websocket Protocol
Lecture 3 Build a chat app with http protocol
Lecture 4 TCP Handshake
Lecture 5 HTTP Handshake
Lecture 6 Websocket Usecase
Section 3: WebSockets in Practice
Lecture 7 Open a ws connection
Lecture 8 Send & receive data
Lecture 9 What's exactly a socket?
Lecture 10 Refactor chat app with websocket protocol
Section 4: Socket.io Library
Lecture 11 Why we need socket io library?
Lecture 12 Setup socket io
Lecture 13 Send & receive data
Lecture 14 More on send & receive data
Lecture 15 Chat App: Send message
Lecture 16 Chat App: Broadcasting
Lecture 17 Chat App: Room - part 1
Lecture 18 Chat App: Room - part 2
Lecture 19 Namespace
Lecture 20 Chat App: List users online
Section 5: NestJS Fundamental: Core Concept
Lecture 21 Explore NestJS folder structure
Lecture 22 Controller in NestJS
Lecture 23 Single responsibility principle
Lecture 24 Introduction to Provider
Lecture 25 Inversion of Control principle
Lecture 26 Apply IoC principle in NestJS
Lecture 27 Dependency Injection
Lecture 28 How IoC Container work?
Lecture 29 Look at Module
Lecture 30 Work with Module
Lecture 31 Middleware
Lecture 32 Middleware - part 2
Lecture 33 Exception
Lecture 34 Pipes
Lecture 35 Guard
Lecture 36 Interceptor
Lecture 37 Custom decorators
Lecture 38 Wrap up: Core concept
Section 6: NestJS Fundamental: Data Transfer Object (DTO)
Lecture 39 Section overview
Lecture 40 Nest CLI
Lecture 41 Setup mongodb
Lecture 42 Connect mongodb atlas
Lecture 43 Create post shema
Lecture 44 Inject repository
Lecture 45 Insert document
Lecture 46 What is a DTO?
Lecture 47 More about DTO
Lecture 48 Validation
Lecture 49 Reminder about DTO
Lecture 50 Query data
Lecture 51 Some options to reduce (hide) data
Lecture 52 Use interceptor to response DTO
Lecture 53 Transform DTO
Lecture 54 Query a data
Lecture 55 Update all fields (PUT)
Lecture 56 Update some field (PATCH)
Lecture 57 Delete document
Lecture 58 Inject another module
Lecture 59 Setup swagger UI - part 1
Lecture 60 Swagger UI - part 2
Lecture 61 Health check nestjs app
Lecture 62 Documentation for NestJS Application
Lecture 63 NestJS Lifecycle
Lecture 64 Versioning
Lecture 65 Circular dependency
Lecture 66 Wrap up
Section 7: Setup Project
Lecture 67 Setup NestJS Project
Lecture 68 Fix eslint issue
Lecture 69 Setup mongodb database
Lecture 70 Create a schema
Lecture 71 Environment variables
Lecture 72 Versionning
Section 8: Module: Authentication & Authorization
Lecture 73 Sign Up
Lecture 74 Hash password
Lecture 75 Transform DTO
Lecture 76 Generate JWT
Lecture 77 Sign In
Lecture 78 Authentication Guard
Lecture 79 Get current user
Lecture 80 Validation
Lecture 81 Authorization: role
Lecture 82 Reflector - assign value to method
Lecture 83 Role Guard
Lecture 84 The problem with role guard
Lecture 85 Resource Module
Section 9: Module: Post & Upload Media File
Lecture 86 Post schema
Lecture 87 Create a post
Lecture 88 Response post dto
Lecture 89 Get all posts & custom response dto
Lecture 90 Fix _id change after refresh
Lecture 91 Get a post
Lecture 92 Update post
Lecture 93 Remove post & custom validate mongodb _id
Lecture 94 Setup cloudinary to upload file
Lecture 95 Upload multiple files
Lecture 96 Add media file to post
Lecture 97 Delete media file
Lecture 98 Custom DTO to response url
Lecture 99 Cursor pagination
Section 10: Module: Reaction
Lecture 100 Think about reaction
Lecture 101 Reaction schema
Lecture 102 Add reaction to post
Lecture 103 Update reaction count
Lecture 104 Response reaction count dto
Lecture 105 Remove reaction
Lecture 106 Attach my reaction to post
Lecture 107 What's next?
Section 11: Module: Comment
Lecture 108 Comment schema
Lecture 109 Create comment
Lecture 110 User comment property
Lecture 111 Get comments
Lecture 112 Update comment
Lecture 113 Delete comment
Lecture 114 Delete child comment
Lecture 115 Custom response DTO
Lecture 116 Summarize
Lecture 117 Authorization
Lecture 118 Fix comment response DTO
Section 12: Module: User
Lecture 119 User schema property
Lecture 120 Get current user profile
Lecture 121 Get all users
Lecture 122 Upload avatar
Lecture 123 Upload cover photo
Section 13: Module: Friends
Lecture 124 Friend schema
Lecture 125 Send friend request
Lecture 126 Cancel friend request
Lecture 127 Accept friend request
Lecture 128 Reject friend request
Lecture 129 Get my request pending
Lecture 130 Get my friends
Lecture 131 Custom response DTO
Lecture 132 Search users
Lecture 133 Pagination users
Section 14: Module: Conversation
Lecture 134 Understand conversation & message
Lecture 135 Conversation & Message schema
Lecture 136 Create private conversation
Lecture 137 Create group conversation
Lecture 138 Get all conversations
Lecture 139 Pagination - part 1
Lecture 140 Pagination - part 2
Lecture 141 Get conversation
Lecture 142 Update conversation
Lecture 143 Add participant to group chat
Lecture 144 Remove participant from group chat
Lecture 145 Remove conversation
Section 15: Module: Message
Lecture 146 Send message
Lecture 147 Get all messages in conversation
Lecture 148 Pagination
Lecture 149 Update message
Lecture 150 Delete message
Lecture 151 Mark as seen message
Section 16: Module: WebSocket Gateway - Handle Real-Time
Lecture 152 Understand websocket gateway
Lecture 153 Think how to send socket data for message
Lecture 154 Handle update message
Lecture 155 Handle delete message
Lecture 156 Mark as seen message
Lecture 157 Post Gateway
Lecture 158 Handle post created
Lecture 159 Handle upload post media
Lecture 160 Handle post update
Lecture 161 Handle post delete
Lecture 162 Handle add reaction
Lecture 163 Handle remove reaction
Lecture 164 What's next?
Lecture 165 Comment Gateway - create
Lecture 166 Handle update comment
Lecture 167 Handle delete comment
Lecture 168 Friend Gateway
Lecture 169 Handle send friend request
Lecture 170 Handle accept friend request
Lecture 171 Handle reject friend request
Lecture 172 Handle cancel friend request
Section 17: Module: Notification
Lecture 173 Notification schema
Lecture 174 Create notification
Lecture 175 Get all notifications
Lecture 176 Pagination
Lecture 177 Mark as read
Lecture 178 Notification gateway - real time for send notification
Section 18: Post Privacy
Lecture 179 Let's handle privacy
Section 19: What's next
Lecture 180 You have learned a lot
Lecture 181 Keep learning
Intermediate Node.js developers who want to add real-time capabilities to their applications,Backend developers looking to deepen their understanding of WebSockets and NestJS,Frontend developers who are familiar with real-time communication and want to understand how it works on the backend,Full-stack developers looking to expand their skills in building real-time APIs,Developers who are eager to build social apps, chat applications, live notifications.,Anyone interested in learning how to create scalable, interactive, and responsive backend systems using NestJS and WebSockets