NestJS Zero to Hero - Modern TypeScript Back-end Development
4.7 (3,049 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
59,137 students enrolled

NestJS Zero to Hero - Modern TypeScript Back-end Development

Develop and deploy enterprise back-end applications following best practices using Node.js and TypeScript
4.7 (3,049 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
59,137 students enrolled
Created by Ariel Weinberger
Last updated 5/2020
English [Auto], French [Auto], 5 more
  • German [Auto]
  • Indonesian [Auto]
  • Italian [Auto]
  • Portuguese [Auto]
  • Spanish [Auto]
Current price: $20.99 Original price: $29.99 Discount: 30% off
5 hours left at this price!
30-Day Money-Back Guarantee
This course includes
  • 8.5 hours on-demand video
  • 26 articles
  • 4 downloadable resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Training 5 or more people?

Get your team access to 4,000+ top Udemy courses anytime, anywhere.

Try Udemy for Business
What you'll learn
  • Becoming familiar with the NestJS framework and its components
  • Designing and developing REST APIs performing CRUD operations
  • Authentication and Authorization for back-end applications
  • Using TypeORM for database interaction
  • Security best practices, password hashing and storing sensitive information
  • Persisting data using a database
  • Deploying back-end applications at a production-ready state to Amazon Web Services
  • Writing clean, maintainable code in-line with industry standards
  • Utilising the NestJS Command Line Interface (CLI)
  • Using Postman for testing back-end services
  • Using pgAdmin as an interface tool to manage PostgreSQL databases
  • Implement efficient logging in a back-end application
  • Environment-based configuration management and environment variables
  • Implementing data validation and using Pipes
  • Guarding endpoints for authorized users using Guards
  • Modelling entities for the persistence layer
  • TypeScript best practices
  • Handling asynchronous operations using async-await
  • Using Data Transfer Objects (DTO)
  • Hands-on experience with JSON Web Tokens (JWT)
  • Unit testing NestJS applications
  • Using GraphQL with NestJS
  • Database persistence with MongoDB
Course content
Expand all 132 lectures 08:27:32
+ Introduction to NestJS & Pre-requisites
7 lectures 07:09

Welcome to the NestJS Zero to Hero course!

Preview 00:54
Thank you + Future Content

Introduction to the NestJS Framework.

What is NestJS?

Node.js and NPM are required to install NestJS and the NestJS CLI.

Installing Node.js and NPM

I'll guide you on how to install the NestJS CLI globally on your machine.

Preview 02:04
Installing Postman
(Optional) Installing Visual Studio Code
+ REST API - Task Management Application (CRUD)
21 lectures 01:25:44

An overview of the project for this course - the Task Management application.

Preview 05:34

Creating the Task Management NestJS project using the NestJS CLI.

Preview 06:22

Introduction to NestJS Modules.

Preview 02:24

Creating a TasksModule that will encapsulate any components and files related to tasks.

Creating a Tasks Module

Introduction to NestJS Controllers.

Preview 03:29

Creating a TasksController that handles incoming HTTP requests for the tasks resource.

Creating a Tasks Controller

Introduction to NestJS Providers and Services.

Preview 02:55

Creating the TaskService and injecting it into the controller.

I also explain some design decisions, such as defining the tasks array as private and naming of methods.

Creating a Tasks Service

Adding the functionality of retrieving all tasks.

Feature: Getting all Tasks

Defining a model for our Task objects to be based on.

Preview 04:13

The first part is about creating the service method to create a new task.

Preview 05:04

The second part is about handling a POST request in the TasksController, extracting the body parameters and calling the service method to create a new task.

Preview 05:14

Introduction to the concept of Data Transfer Objects, or DTOs.

Preview 06:37

Applying what we learned about Data Transfer Objects and creating a DTO for when creating a new task.

Creating a CreateTaskDto

Adding support for getting a single task by ID.

Feature: Getting a Task by ID

In this challenge you'll have to combine all you've learned so far and add the functionality of deleting a task by ID.

Preview 00:44

This is my solution to deleting a task.

Solution: Deleting a Task

Use the knowledge gained so far to add support for updating a task's status.

Preview 01:14

Here's my solution to the challenge of updating an existing task's status.

Solution: Updating a Task's Status

Implementing the feature of searching and filtering tasks.

Feature: Searching and Filtering Tasks
Summary Quiz
6 questions
+ Validation and Error Handling
7 lectures 23:48

Introduction to NestJS Pipes.

Introduction to NestJS Pipes

Using the NestJS built-in ValidationPipe and the class-validator NPM package, we will validate the "title" and "description" parameters when creating a task.

ValidationPipe: Creating a Task

Handling a case where a task with a given ID does not exist.

Error Handling: Getting a non-existing Task

Handling a case where attempting to delete a task that does not exist.

Error Handling: Deleting a non-existing Task

Creating a custom pipe to validate that the provided status is valid when updating the status.

Custom Pipe: Validating the Task Status

Using the NestJS built-in ValidationPipe and the class-validator NPM package, we will add validation when applying filters to tasks or searching for tasks by term.

ValidationPipe: Task Filtering and Search
Summary Quiz
5 questions
Source Code - Validation and Error Handling
+ Data Persistence - PostgreSQL & TypeORM
16 lectures 56:18
Installing PostgreSQL and pgAdmin

Using pgAdmin as an interface to create a new database.

Using pgAdmin to create a Database

Introduction to the TypeORM object-relational-mapping library.

Introduction to Object Relational Mapping and TypeORM
IMPORTANT: TypeORM Entities Configuration

Connecting the NestJS application to our database, using TyepOrmModule.

Connecting NestJS to a database using TypeORM

Creating a TypeORM Entity for tasks.

Creating a Task Entity

Creating a custom repository for handling task-related database operations.

Creating a Task Repository

Small changes to our application that will make our persistence refactoring easier.

Preparation for Task Service Refactoring

Refactoring the "get task by ID" feature, retrieving the tasks from the database.

Persistence: Getting a Task by ID

Refactoring the "create task by ID" feature, saving the new task in the database.

Persistence: Creating a Task

Challenge: Refactoring the "delete task by ID" feature, deleting the task from the database table.

Challenge: Delete Task Persistence

Solution to the challenge fo refactoring the task deletion logic to introduce data persistence.

Solution: Delete Task Persistence

Persistence support for the operation of updating a task's status.

Persistence: Updating Task Status
IMPORTANT: Before Persistence of Getting Tasks

Persistence support for getting tasks (with or without filters).

Persistence: Getting Tasks (with or without filters)
Summary Quiz
5 questions
Source Code - Data Persistence
+ (Part 1) Authentication - Setting up JWT/Passport.js
13 lectures 01:08:51
Setting up AuthModule, User Entity and UserRepository
Feature: Sign Up
Validation: AuthCredentialsDto, password strength
Error Handling: Duplicate Usernames
Security: Hashing Passwords & Using Salts
Feature: Validating Password - Sign In

Introduction to JSON Web Tokens (JWT)

Preview 05:01

Setting up NestJS' JwtModule and PassportModule to help us with authentication and authorization.

Setting up the JWT Module and Passport.js

Signing a JWT token with the relevant payload upon successful authentication.

Signing a JWT Token Upon Authentication

Setting up the JWT-based strategy to be used by Passport.js for authorizing users.

Setting up the JWT Strategy for Authorization
IMPORTANT: GetUser Decorator

Creating a custom @GetUser() decorator to retrieve the user from the request object.

Custom @GetUser() Decorator

Applying an authorization guard on the Tasks routes.

Guarding the Tasks Routes (TasksController)
Summary Quiz
6 questions
+ (Part 2) Authorization - Task Ownership
7 lectures 20:12
Tasks and Users - Database Relation
Authorization: Creating a Task For User
Authorization: Getting Tasks For User
Authorization: Getting a User's Task
Authorization: Updating a User's Task Status
Authorization: Deleting a User's Task
Source Code - Authentication & Authorization
+ (Bonus) Logging
2 lectures 15:15
Introduction to Logging
Applying logging in our application
+ (Bonus) Pro-Production: Configuration
5 lectures 16:31
Windows: Environment Variables
Introduction to Configuration
Configuration Management Set-up
Applying Configuration - Codebase (Part 1)
Source Code - Configuration
+ (Bonus) Front-end Application
1 lecture 06:37
Front-end Application Set-up (Development Mode)
+ (Bonus) Deployment - Amazon Web Services (AWS)
10 lectures 22:48
Signing up to Amazon Web Services and signing up
Amazon S3: Setting up a Bucket (Front-end Hosting)
Enabling CORS from the S3 Front-end Application
IMPORTANT: bcryptjs NPM package
TIP: Before Deploying to Production
Pre-production package.json Adjustments
IMPORTANT: Change in TypeORM Configuration
Deploying NestJS to Elastic Beanstalk
Uploading the Front-end App to S3
Source Code - Deployment
  • Having a basic understanding of JavaScript and/or NodeJS
  • Having basic knowledge of TypeScript is recommended, but not required

NestJS is a Node.js back-end development framework built upon Express, leveraging the power of TypeScript.

NestJS leverages the incredible popularity and robustness of JavaScript as a language and Node.js as a technology. It is inspired by common libraries and frameworks such as Angular, React and Vue which improve developer productivity and experience.

Even considering the amount of superb libraries, helpers and tools that exist for server-side Node.js, none of them effectively solve the main problem - the architecture of an application.

NestJS provides an out-of-the-box application architecture which allows developers and teams to create highly testable, scalable, loosely coupled and easily maintainable applications.

Recently, the NestJS framework is gaining extreme popularity due to its incredible features;

  • Leverages TypeScript - strongly typed language which is a super-set of JavaScript

  • Simple to use, easy to learn and easy to master

  • Powerful Command Line Interface (CLI) tool that boosts productivity and ease of development

  • Detailed, well-maintained documentation

  • Active codebase development and maintenance

  • Open-source (MIT license)

  • Supports dozens nest-specific modules that help you easily integrate with common technologies and concepts such as TypeORM, Mongoose, GraphQL, Logging, Validation, Caching, Websockets and much more

  • Easy of unit-testing applications

  • Made for Monoliths and Micro-services (entire section in the documentation regarding the Microservice type of a NestJS application, as well as techniques and recipes).

In this course I am going to guide you through the process of planning, developing and deploying a fully-featured back-end application, based on my experience developing and maintaining systems that support dozens of millions of concurrent users at scale.

Who this course is for:
  • Intermediate JavaScript developers who want to dive into back-end development
  • Any developers willing to apply TypeScript on the back-end
  • Developers eager to learn how to develop performant, secure and production-ready REST APIs following best practices
  • Developers who want to learn how to deploy their application to the cloud (Amazon Web Services)
  • Developers who want to follow building a practical, real-world application from zero to production