Mastering Nest.js: Build Scalable Applications with Mastery in Nest.js Framework
8h 51mIntermediate2026-02-23
Authors

Packt Publishing
Course details
What is this course about?
Nest.js is a powerful framework for building scalable, efficient back-end applications. This course begins by introducing the framework's setup, project structure, and foundational concepts like controllers and pipes. Explore advanced features, including middleware, guards, and interceptors, gaining the skills you need to manage application functionality and security effectively. Learn how to integrate database management with MySQL and MongoDB using TypeORM and Mongoose, seamlessly connecting and managing data. Along the way, practice your new skills on a MyStore application to implement CRUD operations, authentication, and session management. By the end of this course, you'll be prepared to design and deploy high-performance, maintainable applications. This course is an ideal fit for software developers, back-end engineers, and technical enthusiasts looking to master Nest.js.
Objectives
What will I be able to do by the end of this course?
Configure and manage scalable Nest.js applications effectively.
Construct and implement controllers, middleware, and interceptors.
Seamlessly integrate and manage databases using MySQL and MongoDB.
Develop comprehensive CRUD operations in a practical project.
Implement robust authentication and session management solutions.
Audience
Who is this course for?
Software developers
Back-end engineers
Technical enthusiasts
Prerequisites
What do I need to know before taking this course?
Foundational understanding of JavaScript or TypeScript
Basic familiarity with Node.js
Nest.js is a powerful framework for building scalable, efficient back-end applications. This course begins by introducing the framework's setup, project structure, and foundational concepts like controllers and pipes. Explore advanced features, including middleware, guards, and interceptors, gaining the skills you need to manage application functionality and security effectively. Learn how to integrate database management with MySQL and MongoDB using TypeORM and Mongoose, seamlessly connecting and managing data. Along the way, practice your new skills on a MyStore application to implement CRUD operations, authentication, and session management. By the end of this course, you'll be prepared to design and deploy high-performance, maintainable applications. This course is an ideal fit for software developers, back-end engineers, and technical enthusiasts looking to master Nest.js.
Objectives
What will I be able to do by the end of this course?
Configure and manage scalable Nest.js applications effectively.
Construct and implement controllers, middleware, and interceptors.
Seamlessly integrate and manage databases using MySQL and MongoDB.
Develop comprehensive CRUD operations in a practical project.
Implement robust authentication and session management solutions.
Audience
Who is this course for?
Software developers
Back-end engineers
Technical enthusiasts
Prerequisites
What do I need to know before taking this course?
Foundational understanding of JavaScript or TypeScript
Basic familiarity with Node.js
Concepts
Introduction
- Introduction to Nest.js
- Setting up the project
- Understanding project structure
Nest.js Fundamentals
- Understanding controllers
- Controller fundamentals (@Get handler)
- Controller fundamentals (Headers)
- Controller fundamentals (@Post handler)
- Controller fundamentals (@Post handler), part 2 with modules
- Controller fundamentals (fetching params)
- Controller fundamentals (@Put handler)
- Controller fundamentals (@Patch handler)
- Controller fundamentals (@Delete handler)
- Request object
- Response object
- Fetching queries
- @HttpCode vs. @Res decorator
- HTTP response status
Working with Pipes
- Introduction to pipes
- Built-in pipes (ParseIntPipe)
- Built-in pipes (ParseFloatPipe)
- Built-in pipes (ParseBooleanPipe)
- Built-in pipes (ParseArrayPipe)
- Built-in pipes (ParseUUIDPipe)
- Built-in pipes (ValidationPipe)
- Validating empty fields
- Validating field length
- Custom validation messages
- Validating field using @IsEnum() validator
- Validating dates in Nest.js
- Validating optional fields
- Validating regex pattern
- Creating a custom pipe
- Understanding ArgumentMetadata (metadata.type)
- Assignment - Custom pipe (handling different type arguments)
- Understanding ArgumentMetadata (metadata.metatype)
- Understanding ArgumentMetadata (metadata.data)
- Implementing global pipes
Nest.js Middleware
- Introduction to Nest middlewares
- Implementing middleware
- Registering a middleware
- Route-specific middleware
- Assignment - Checking Content-Type with middleware
- Handling route wildcards
- Middleware for specific route handlers
- Excluding routes
- Controller-driven route middleware
- Understanding functional middleware
- Applying multiple middlewares
- Applying global middlewares
- Assignment - Password encryption middleware
Nest.js Guards
- Introduction to guards
- Understanding guard
- Understanding ExecutionContext
- Accessing arguments with getArgs()
- Limiting controller access with guard
- Understanding switchToHttp() method
- Assignment - API key authorization
- Applying multiple guards
- Defining custom metadata
- Setting custom metadata - A better way
- Applying role for specific handlers
- Applying multiple roles
- Applying global guards
Nest.js Interceptors
- Introduction to interceptors
- Understanding interceptor
- Assignment - Transforming response data
- Assignment - Modifying request headers
- Assignment - Hiding sensitive information
- Exception mapping
- Data validation with interceptor
- Authentication and authorization
- Applying global interceptors
Nest.js with MySQL
- Connecting to MySQL database using TypeORM
- Creating entity with TypeORM
- Inserting product data (CRUD)
- Fetching the product data (CRUD)
- Updating product record (CRUD)
- Deleting product record (CRUD)
Practical Application - Creating a MyStore App
- Introduction to MyStore application
- Rendering template on server
- Creating navbar with includes
- Creating home interface
- Conditional rendering - No product found
- Configuring add product route
- Creating add product interface
- Configuring edit product route
- Interface & functionality - Edit product
Attaching Templates to MySQL
- Fetching the products
- Adding product to database, part 1
- Adding product to database, part 2
- Updating the product
- Deleting the product
MyStore - Authentication and Session Cookie
- Section introduction
- Setting up the sign-up route
- Designing the sign-up form
- Implementing show hide password functionality
- Validating password
- Registering user to the database
- Configuring login page
- Validating user and sending cookie
- Reading a cookie
- Rendering DOM based on login status
- Implementing logout
- Configuring Express-Session
- Sending and reading session cookie
- Storing sessions in MySQL
- Destroying the session - Logout
- Optimizing session storage
- Implementing JWT token
- Validating request with middleware
- Conditional rendering with token
- Hashing the password on sign-up
- Validating login credentials
- Finalizing MyStore application
Nest.js With MongoDB and Mongoose
- Connecting to MongoDB database
- Creating a schema
- Registering the schema
- Create and save product to MongoDB
- Fetching documents from MongoDB
- Updating a document in MongoDB
- Deleting a document from MongoDB
MyStore With MongoDB and Mongoose
- Connecting MyStore with MongoDB database
- Creating user schema
- Injecting the user schema
- Creating product schema
- Injecting the product schema
- Creating MongoDB session store