
Introduce a nest js back end and client app, covering signup and login with ethereal email verification, article creation with editor and image handling, and user updates.
Create a nest project with the nest CLI, install dependencies via npm, open in VS Code, configure extensions, and simplify the base app by removing defaults for the next lecture.
Begin building user feature in a NestJS blogging app by initializing database, defining user entity, and creating an endpoint that uses DTOs, services, and repositories to save to database.
Create a Nest JS user controller with the Nest CLI, register it in the app module, and implement a post create user endpoint under a global API prefix.
Define a user entity with id, name, handle, and email using TypeORM decorators, configure SQLite with the TypeORM module, and save a user from the request body via injected repository.
Refactor a nest app to use a dedicated user service for business logic, moving user creation and database saving from the controller to the service, with a create-user dto.
Create a user module, move the user controller and user service into it, and import the typeorm repository within the module, with the app module importing the user module.
Learn to enable email functionality after user sign-up, modify the user entity with a new field, and migrate the database safely using migrations and the config service for multi-environment deployments.
Implement an email module and service in NestJS to send signup emails with a token, using nodemailer and ethereal for testing, and integrate with the user service to activate accounts.
Generate a crypto random uuid registration token for user signup, attach it to the user object, store it in a new nullable column, and test sign-up emails.
Learn how to implement database migrations in a nest js blogging app using typeorm, configure a migrations folder and data source, and run and revert migrations with sqlite.
Externalize config by moving sensitive data to an env file and accessing it through a global config module and config service, enabling secure production and local development.
Extract database configuration to the env file and use a config service with a factory to supply ORM module async options, pulling the db host for sqlite from env.
Configure and test env files for development and production using cross-env and the config module, load the dev or prod .env, and run migrations to initialize the database.
Validate signup input with built-in and custom validators, map errors via a custom exception filter, and rollback on email service failures to prevent failed signups.
Ensure user handles stay unique by checking for existing handles before saving and appending a short random value to the username, using a shared utils function for handles and tokens.
Implement robust user input validation in a Nest JS blog app by validating email with class-validator, enforcing a global validation pipe, and standardizing error responses with a custom exception filter.
Explore mapping database constraint errors to validation responses by wrapping calls in try-catch, detecting unique constraint messages, and returning a consistent bad request with email is in use.
Learn to implement a custom unique email validator in NestJS using class-validator, inject the user repository, perform async database checks, and ensure reliable validation with the NestJS container integration.
Implement a rollback strategy with TypeORM using a query runner to start a transaction, commit on email delivery success, or roll back to avoid saving the user and stale data.
Create an authentication controller with login and logout endpoints and implement an opaque token stored in the database, linked to users to authenticate sessions.
Add a NestJS auth endpoint by creating a dedicated auth controller with dtos and a token-based validation flow using the user service, returning a user payload and setting cookie.
Perform validation on authentication requests by ensuring tokens are not empty and can be used only once. Enforce allowed operations using an enum validator with meaningful error messages.
Implement a token entity and tokens table, establish a many-to-one relation to users, generate and persist tokens via a repository, and return the token with user data.
Implement a post logout endpoint that clears the app token cookie and deletes the token from the database using a cookie parser and a token service.
Implement a login endpoint for the blogging app using Nest JS that verifies existing users, generates a login token, and sends a login email to complete authentication.
Implement a combined login and signup auth endpoint that validates tokens by operation, queries by the appropriate token, and clears the login or registration token in the database upon success.
Introduce article creation by securing requests with cookie-based tokens, middleware, and guards, and use a custom decorator to access the current user in article controller for create, update, and publish.
design and implement a new article resource in a NestJS project, including article entity with id, title, content, slug, image, and timestamps, plus migration and post handling for articles.
Implement the article post handler in a Nest JS blogging app, validating title, content, and image, and save articles with a slug from the title.
Implement a NestJS middleware to detect a logged-in user from request cookies, then use a guard to restrict endpoints to authenticated users.
Establish a one-to-many relationship between users and articles in the blogging app with nest js by adding a user_id foreign key, implementing cascade delete, and a current user decorator.
Implement a put endpoint to update an article by id, verify authentication and ownership by loading relation id, update title content and image, and return not found or forbidden errors.
Develop and expose a publish article endpoint by adding published and published at fields, implementing a patch method to toggle publish status, with owner checks and migrations.
Implement get endpoints to list all articles, fetch a specific article, and list articles by user, with pagination, sorting, and nested article-author dtos, plus seed data for testing.
Seed a fresh database for the blogging app by creating a seed script using TypeORM entities (user, token, article), generating users, tokens, and articles with lorem ipsum content and slugs.
Add a get articles endpoint in the article controller to list articles using skip and take, with page and size, returning content and total count.
Explore implementing sorting and filtering for the blogging app's endpoint: add sort and direction query parameters, validate them, apply dynamic order by id or published at, and exclude unpublished posts.
Implement article dtos for a NestJS blog: create a short article dto with id, title, slug, image, published; include author and map from user relation; extend to content dto.
Create a get article by id or slug endpoint implemented in the article service and controller, using find one options and including relations to return the article content.
Learn how to handle unpublished articles in a blogging app by validating the current user, checking publish state, and returning not found when access is unauthorized.
Add a user-specific articles endpoint in nest js by updating routes to use a users/{id|handle}/articles path, supporting current user access to unpublished articles and pagination.
introduce the file upload functionality using nest's built-in features and multer, configure environment-specific folders, serve static files, and apply file type and size validation.
Create a NestJS file resource with a post api/file/upload endpoint using the built-in file interceptor and multer to handle a form-data field named file and return the file name.
Configure a nest application to serve uploaded images by wiring the serve static module, setting a root upload path and an api assets route for browser access.
Configure upload folders in NestJS via a config service on module init to create dev or prod directories, then use multer disk storage to set the destination.
Enforce file upload validation by restricting types to jpeg and png and limiting size to one megabyte using a file type validator, regex, and a custom bad request error.
Implement two new user endpoints for update and get, using middleware to verify the current logged-in user and authorize requests, addressing the dependency between auth and user modules.
Create a secure put endpoint to update a user by id, using an update user DTO with name and image validation, enforcing current user ownership via an auth guard.
Add a get user endpoint that queries by handle, returning a user DTO. Map the user entity to a user DTO and handle not found exceptions.
Add reaction functionality for articles, including bookmarks and likes, and explore complex queries with the query builder to handle advanced scenarios. Boost user engagement with content.
add a generic reaction resource with a plural endpoint and a reaction entity using categories like hot and reading list that link users to articles.
Implement a toggle reaction endpoint in the blogging app, enabling authenticated users to like or unlike an article by category using a reaction dto and returning a boolean result.
Seed the Nest JS blog app by populating reactions across published articles using a reaction repository, random users, and string categories for easy manual testing.
Implement article reactions by adding a reaction service and integrating it with the article service to return per-type counts and the current user's reaction for article lists and details.
Filter articles by user reactions using a reaction parameter to surface hot, reading list, or like articles for the current user, via the get articles endpoint.
Are you ready to take your NestJS skills to the next level by building a complete, real-world application from scratch? Welcome to "Portfolio Project: Blogging Application with NestJS"! This hands-on course is designed to provide you with practical experience in using NestJS to develop a fully functional blogging platform.
In this course, we focus on the practical implementation of NestJS, bypassing lengthy theoretical explanations. You'll dive straight into coding, using TypeORM for robust database interactions, including both simple and complex queries. We'll also cover essential migration functionalities to help you manage database schema changes efficiently.
Our application will be configured to run in multiple environments, ensuring that it is versatile and ready for production. You'll implement key features such as user authentication with sign-up and login functionalities, complete with email verification. All user requests will be rigorously validated to ensure security and reliability.
Centralized error handling will be another focus, helping you manage and debug errors effectively. The course will guide you through creating and managing articles, allowing authorized users to submit, update, or modify their published state. Additionally, you'll implement file upload functionality to handle static files seamlessly.
To enhance user engagement, we’ll include a reactions resource, enabling users to like or bookmark articles. Plus, you’ll get a client application to test and see your backend in action, ensuring a comprehensive learning experience.
This course aims to provide a complete understanding of building a robust application from start to finish. Whether you're a beginner or an experienced developer looking to refine your skills, this course has something for you. Join us now and start building something amazing with NestJS!