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
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.
Introduction to NestJS & Pre-requisites
Welcome to the course!
What is NestJS?
Installing Node.js and NPM
Installing the NestJS CLI
Installing Postman
(Optional) Installing Visual Studio Code
REST API – Task Management Application (CRUD)
Project Overview: Task Management Application
Creating a project via the CLI and an introduction to a NestJS project structure
Introduction to NestJS Modules
Creating a Tasks Module
Introduction to NestJS Controllers
Creating a Tasks Controller
Introduction to NestJS Providers and Services
Creating a Tasks Service
Feature: Getting all Tasks
Defining a Task Model
Feature: Creating a Task (Part 1: Service)
Feature: Creating a Task (Part 2: Controller)
Introduction to Data Transfer Objects (DTOs)
Creating a CreateTaskDto
Feature: Getting a Task by ID
Challenge: Deleting a Task
Solution: Deleting a Task
Challenge: Updating a Task’s Status
Solution: Updating a Task’s Status
Feature: Searching and Filtering Tasks
Summary Quiz
Validation and Error Handling
Introduction to NestJS Pipes
ValidationPipe: Creating a Task
Error Handling: Getting a non-existing Task
Error Handling: Deleting a non-existing Task
Custom Pipe: Validating the Task Status
ValidationPipe: Task Filtering and Search
Summary Quiz
Source Code – Validation and Error Handling
Data Persistence – PostgreSQL & TypeORM
Installing PostgreSQL and pgAdmin
Using pgAdmin to create a Database
Introduction to Object Relational Mapping and TypeORM
IMPORTANT: TypeORM Entities Configuration
Connecting NestJS to a database using TypeORM
Creating a Task Entity
Creating a Task Repository
Preparation for Task Service Refactoring
Persistence: Getting a Task by ID
Persistence: Creating a Task
Challenge: Delete Task Persistence
Solution: Delete Task Persistence
Persistence: Updating Task Status
IMPORTANT: Before Persistence of Getting Tasks
Persistence: Getting Tasks (with or without filters)
Summary Quiz
Source Code – Data Persistence
(Part 1) Authentication – Setting up JWT/Passport.js
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)
Setting up the JWT Module and Passport.js
Signing a JWT Token Upon Authentication
Setting up the JWT Strategy for Authorization
Custom @GetUser() Decorator
Guarding the Tasks Routes (TasksController)
Summary Quiz
(Part 2) Authorization – Task Ownership
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
Introduction to Logging
Applying logging in our application
(Bonus) Pro-Production: Configuration
Windows: Environment Variables
Introduction to Configuration
Configuration Management Set-up
Applying Configuration – Codebase (Part 1)
Source Code – Configuration
(Bonus) Front-end Application
Front-end Application Set-up (Development Mode)
(Bonus) Deployment – Amazon Web Services (AWS)
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
(Bonus) Testing a NestJS Application
Unit Testing Crash Course – Basics
Unit Testing Crash Course – First Tests
Testing TasksService – Part 1 – getTasks
Testing TasksService – Part 2 – getTaskById
(Challenge) Testing TasksService – Part 3 – createTask
Testing TasksService – Part 4 – deleteTask
(Challenge) Testing TasksService – Part 5 – updateTaskStatus
Testing UserRepository
Testing User Entity
Testing JwtStrategy
Testing Final Words
Source Code – Testing
Bonus Material
HTTPS – Secure Communication
Proceeding with NestJS & Back-end Development
Domain Names for AWS Applications
Elastic Beanstalk CLI