NestJS: The Complete Developer’s Guide

NestJS: The Complete Developer’s Guide

English | MP4 | AVC 1280×720 | AAC 44KHz 2ch | 233 lectures (19h 43m) | 7.82 GB

Build full featured backend APIs incredibly quickly with Nest, TypeORM, and Typescript. Includes testing and deployment!

Authentication/Authorization? Covered. Automated Testing? Yep, it’s here! Production Deployment? Of course!

Congratulations! You’ve found the complete guide on how to build enterprise-ready apps with NestJS.

NestJS is a backend framework used to create scalable and reliable APIs. It is a “battery-included” framework; it includes tools to handle just about every possible use case, from data persistence, to validation, to config management, to testing, and much, much more. This course will help you master Nest. By the time you complete this course, you will have the confidence to build any app you can imagine.

Throughout this course you will build a series of apps with growing complexity. We use as few libraries and tools as possible. Instead, you will write many custom systems to better understand how every piece of Nest works together. Each application you build includes discussion on data modeling and persistence. We will first save records in a simple file-based data store (built from scratch) and eventually work our way up to saving data in a production-grade Postgres instance.

Testing is a fundamental topic in Nest. A tremendous amount of functionality in Nest is dedicated to making sure your project is easy to test. This course follows Nest’s testing recommendations, and you will write both integration and unit tests to ensure your project is working as expected. Although testing can sometimes be confusing and boring, I have put special care into making sure the tests we write are expressive, fast, and effective. You will be able to use this knowledge on your own projects, even those that don’t use Nest!

Typescript is used throughout this course to make sure we are writing clean and correct code. Don’t know Typescript? Not a problem! A free appendix is included at the end of the course to get you up to speed on Typescript. Once you’re familiar with it, Typescript will help you catch errors and bugs in your code before you even run it. If you’ve never used Typescript before you are in for a treat 🙂

Here’s a partial list of the topics included in this course:

  • Securely deploy your app to production
  • Write automated integration and unit tests to make sure your code is working
  • Build an authentication system from scratch to log users in
  • Allow users to perform certain actions with a permissions system
  • Store and retrieve data with complex queries using TypeORM
  • Understand how TypeORM handles data relationships
  • Write declarative code using property, method, and parameter decorators
  • Master the concept of dependency injection to write reusable code
  • Implement automatic validation of incoming requests
  • Format outgoing response data with a custom DTO system
  • Handle incoming requests and outgoing responses using Guards and Interceptors
  • Segment your code into reusable Nest Modules
  • Add structure to your database using migrations

I had a tough time learning NestJS. There are a tremendous number of outdated tutorials around it, the documentation is sometimes unclear, and Nest itself is just plain hard to understand. I made this course to save you time and money – a course to show you exactly what you need to know about every topic in Nest. You will find learning Nest to be a delightful experience and pick up a tremendous amount of knowledge along the way.

What you’ll learn

  • Deploy a feature-complete app to production
  • Build authentication and permissions systems from scratch
  • Write integration and unit tests to ensure your code is working
  • Automatically validate data included with incoming requests
  • Use an API client to manually test your app
  • Apply structure to your code with Typescript
  • Make your code more reusable and testable with dependency injection
  • Tie different types of data together with TypeORM relationships
  • Get a behind-the-scenes understanding of NestJS
  • Use Guards to prevent unauthorized users from gaining access to sensitive data
  • Understand Nest’s special request-response cycle
  • Model your app’s data using TypeORM entities
  • Use decorators to dramatically simplify your code
Table of Contents

Get Started Here!
1 How to Get Help
2 Join Our Community!

The Basics of Nest
3 Project Setup
4 TypeScript Configuration
5 Creating a Controller
6 Starting Up a Nest App
7 File Naming Conventions
8 Routing Decorators

Generating Projects with the Nest CLI
9 App Setup
10 Using the Nest CLI to Generate Files
11 More on Generating Files
12 Adding Routing Logic
13 [Optional] Postman Setup
14 [Optional] VSCode REST Client Extension

Validating Request Data with Pipes
15 Accessing Request Data with Decorators
16 Using Pipes for Validation
17 Adding Validation Rules
18 Behind the Scenes of Validation
19 How Type Info is Preserved

Nest Architecture Services and Repositories
20 Services and Repositories
21 Implementing a Repository
22 Reading and Writing to a Storage File
23 Implementing a Service
24 Manual Testing of the Controller
25 Reporting Errors with Exceptions
26 Understanding Inversion of Control
27 Introduction to Dependency Injection
28 Refactoring to Use Dependency Injection
29 Few More Notes on DI

Nest Architecture Organizing Code with Modules
30 Project Overview
31 Generating a Few Files
32 Setting Up DI Between Modules
33 More on DI Between Modules
34 Consuming Multiple Modules
35 Modules Wrapup

Big Project Time!
36 App Overview
37 API Design
38 Module Design!
39 Generating Modules, Controllers, and Services

Persisting Data with TypeORM
40 Persistent Data with Nest
41 Setting Up a Database Connection
42 Creating an Entity and Repository
43 Viewing a DB’s Contents
44 Understanding TypeORM Decorators
45 One Quick Note on Repositories
46 A Few Extra Routes
47 Setting Up Body Validation
48 Manual Route Testing

Creating and Saving User Data
49 Creating and Saving a User
50 Quick Breather and Review
51 More on Create vs Save
52 Querying for Data
53 Updating Data
54 Removing Records
55 Finding and Filtering Records
56 Removing Records
57 Updating Records
58 A Few Notes on Exceptions

Custom Data Serialization
59 Excluding Response Properties
60 Solution to Serialization
61 How to Build Interceptors
62 Serialization in the Interceptor
63 Customizing the Interceptor’s DTO
64 Wrapping the Interceptor in a Decorator
65 Controller-Wide Serialization
66 A Bit of Type Safety Around Serialize

Authentication From Scratch
67 Authentication Overview
68 Reminder on Service Setup
69 Implementing Signup Functionality
70 [Optional] Understanding Password Hashing
71 Salting and Hashing the Password
72 Creating a User
73 Handling User Sign In
74 Setting up Sessions
75 Changing and Fetching Session Data
76 Signing in a User
77 Getting the Current User
78 Signing Out a User
79 Two Automation Tools
80 Custom Param Decorators
81 Why a Decorator and Interceptor
82 Communicating from Interceptor to Decorator
83 Small Fix for CurrentUserInterceptor
84 Connecting an Interceptor to Dependency Injection
85 Globally Scoped Interceptors
86 Preventing Access with Authentication Guards

Getting Started with Unit Testing
87 Testing Overview
88 Testing Setup
89 Yes, Testing is Confusing
90 Getting TypeScript to Help With Mocks
91 Quick Note to Help Speed Up Your Tests
92 Improving File Layout
93 Ensuring Password Gets Hashed
94 Changing Mock Implementations
95 Testing the Signin Flow
96 Checking Password Comparison
97 More Intelligent Mocks
98 Refactoring to Use Intelligent Mocks
99 Unit Testing a Controller
100 More Mock Implementations
101 Not Super Effective Tests
102 Testing the Signin Method

Integration Testing
103 Getting Started with End to End Testing
104 Creating an End to End Test
105 App Setup Issues in Spec Files
106 Applying a Globally Scoped Pipe
107 Applying a Globally Scoped Middleware
108 Solving Failures Around Repeat Test Runs
109 Creating Separate Test and Dev Databases

Managing App Configuration
110 Understanding Dotenv
111 Applying Dotenv for Config
112 Specifying the Runtime Environment
113 Solving a SQLite Error
114 It Works!
115 A Followup Test

Relations with TypeORM
116 Back to Reports
117 Adding Properties to Reports
118 A DTO for Report Creation
119 Receiving Report Creation Requests
120 Saving a Report with the Reports Service
121 Testing Report Creation
122 Building Associations
123 Types of Associations
124 The ManyToOne and OneToMany Decorators
125 Important Note About Deleting Database – Do Not Skip
126 More on Decorators
127 Setting up the Association
128 Formatting the Report Response
129 Transforming Properties with a DTO

A Basic Permissions System
130 Adding in Report Approval
131 Testing Report Approval
132 Authorization vs Authentication
133 Adding an Authorization Guard
134 The Guard Doesn’t Work !
135 Middlewares, Guards, and Interceptors
136 Assigning CurrentUser with a Middleware
137 Fixing a Type Definition Error
138 Validating Query String Values
139 Transforming Query String Data
140 How Will We Generate an Estimate

Query Builders with TypeORM
141 Creating a Query Builder
142 Writing a Query to Produce the Estimate
143 Testing the Estimate Logic

Production Deployment
144 The Path to Production
145 Providing the Cookie Key
146 Understanding the Synchronize Flag
147 The Dangers of Synchronize
148 The Theory Behind Migrations
149 Headaches with Config Management
150 TypeORM and Nest Config is Great
151 Env-Specific Database Config
152 Installing the TypeORM CLI
153 Generating and Running Migrations
154 Required Migration Update for Production
155 Running Migrations During E2E Tests
156 Production DB Config
157 Heroku CLI Setup Instructions
158 Heroku Specific Project Config
159 Deploying the App

[Bonus] Appendix TypeScript
160 How to Get Help
161 TypeScript Overview
162 Environment Setup
163 A First App
164 Executing TypeScript Code
165 One Quick Change
166 Catching Errors with TypeScript
167 Catching More Errors!
168 Course Overview
169 Types
170 More on Types
171 Examples of Types
172 Where Do We Use Types
173 Type Annotations and Inference
174 Annotations with Variables
175 Object Literal Annotations
176 Annotations Around Functions
177 Understanding Inference
178 The Any Type
179 Fixing the Any Type
180 Delayed Initialization
181 When Inference Doesn’t Work
182 Annotations Around Functions
183 Inference Around Functions
184 Annotations for Anonymous Functions
185 Void and Never
186 Destructuring with Annotations
187 Annotations Around Objects
188 Arrays in TypeScript
189 Why Typed Arrays
190 Multiple Types in Arrays
191 When to Use Typed Arrays
192 Tuples in TypeScript
193 Tuples in Action
194 Why Tuples
195 Interfaces
196 Long Type Annotations
197 Fixing Annotations with Interfaces
198 Syntax Around Interfaces
199 Functions In Interfaces
200 Code Reuse with Interfaces
201 General Plan with Interfaces
202 Classes
203 Basic Inheritance
204 Class Method Modifiers
205 Fields in Classes
206 Fields with Inheritance
207 Where to Use Classes
208 App Overview
209 Parcel in Action
210 Project Structure
212 Generating Random Data
213 Type Definition Files
214 Using Type Definition Files
215 Export Statements in TypeScript
216 Defining a Company
217 Important Note About Google Maps Key
218 Adding Google Maps Support
219 Required Update for New @types Library
220 Google Maps Integration with TypeScript
221 Exploring Type Definition Files
222 Hiding Functionality
223 Why Use Private Modifiers Here’s Why
224 Adding Markers
225 Duplicate Code
226 One Possible Solution
227 Restricting Access with Interfaces
228 Implicit Type Checks
229 Showing Popup Windows
230 Updating Interface Definitions
231 Optional Implements Clauses
232 App Wrapup

Bonus!
233 Bonus!

Homepage