<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: FLUX</title>
    <description>The latest articles on DEV Community by FLUX (@r8hitpatil).</description>
    <link>https://dev.to/r8hitpatil</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3483322%2F6f704292-1834-4571-96be-d431fb8983fd.jpg</url>
      <title>DEV Community: FLUX</title>
      <link>https://dev.to/r8hitpatil</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/r8hitpatil"/>
    <language>en</language>
    <item>
      <title>NestJS for beginners</title>
      <dc:creator>FLUX</dc:creator>
      <pubDate>Wed, 13 May 2026 12:14:11 +0000</pubDate>
      <link>https://dev.to/r8hitpatil/nestjs-for-beginners-4593</link>
      <guid>https://dev.to/r8hitpatil/nestjs-for-beginners-4593</guid>
      <description>&lt;h2&gt;
  
  
  What is NestJS ?
&lt;/h2&gt;

&lt;p&gt;Nest is framework to build efficient, scalable Node.js server side applications. We can simply use Typescript and concepts like OOPS, Functional Programming are very basic things you should know.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why to use Nestjs ?
&lt;/h2&gt;

&lt;p&gt;NestJS is built around modularity thus it can organize the code into separate modules, making it easier to understand, maintain and scale.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connect
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Repository
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Understanding basic setup&lt;br&gt;&lt;br&gt;
1.1 Setting up project&lt;br&gt;&lt;br&gt;
1.2 Module creation&lt;br&gt;&lt;br&gt;
1.3 Module&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Controller and services 2.1 [Controller] 2.2 [Services]&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  1. Basics
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Setting up project
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ npm i -g @nestjs/cli
$ nest new project-name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is sufficient to setup our NestJS project which would give us few node modules along with some boilerplate files, an 'src' directory with core files.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;src
 |_app.controller.spec.ts
 |_app.controller.ts
 |_app.module.ts
 |_app.service.ts
 |_main.ts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;app.controller.ts : Basic controller with single route app.controller.spec.ts : Unit tests for controller app.module.ts : Root module of the application app.service.ts : Basic service with single method main.ts : Entry file of application using '&lt;strong&gt;NestFactory&lt;/strong&gt;' to create Nest application instance&lt;/p&gt;

&lt;p&gt;NOTE : We won't be going deep dive into the controllers , services , modules , just gain hands-on asap along with few insights like how under the hood things NestJS help us make our application scalable.&lt;/p&gt;

&lt;h3&gt;
  
  
  Module creation
&lt;/h3&gt;

&lt;p&gt;You can create a module by just using you CLI&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nest g module auth #auth module
nest g module user #user module
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This would create a 'auth' folder along with auth.module.ts ( controller, services you have to create manually otherwise you can simply create it with nest g resource auth' to get all the files and folders structured with basic CRUD ) same goes with 'user'&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;auth
 |_auth.module.ts
 |_auth.controller.ts
 |_auth.service.ts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remember every module can be shared with other modules. Imagine sharing a service from 'user' module to auth service to create a user, to do that we need to export UserService provider by adding it in module's export array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Module } from '@nestjs/common';
import { UserService } from './user.service';

@Module({
    providers:[UserService],
    exports:[UserService]
})
export class UserModule {}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Why are we doing this ? We can simply import the service right ?
&lt;/h4&gt;

&lt;p&gt;No. Because it may lead to increased memory usage and if we import it from the modules then we can simply use the same instance of the UserModule to import the UserService, also it makes the shared resources consistent all across the application.&lt;/p&gt;

&lt;p&gt;Note : We can import and export modules as well! Go try , think of a problem where you need a 'common' module and use it in other modules.&lt;/p&gt;

&lt;h3&gt;
  
  
  Understanding Dependency injection !!
&lt;/h3&gt;

&lt;p&gt;Remember we had a 'user' service import in 'auth'&lt;br&gt;&lt;br&gt;
Yes we studied about 'shared instance' but dependency injection means calling the 'service' ( injecting ) when we need it.&lt;br&gt;&lt;br&gt;
Inside our 'auth.module.ts' we would subscribe the service&lt;br&gt;&lt;br&gt;
Inside our 'auth.service.ts' we would inject the dependency&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;providers: [UserService]: You tell Nest to create the instance.
exports: [UserService]: You share that instance with other modules.
imports: [UserModule] (in Auth): You "subscribe" to those shared services.
constructor(private user: UserService): You finally inject it into the specific file where you want to write logic.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Controller and Service
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Controller
&lt;/h3&gt;

&lt;p&gt;We use controllers to handle the incoming request and send the desired response to the end user&lt;/p&gt;

&lt;p&gt;To create a controller let us use&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nest g controller user
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;this would generate us user.controller.ts and user.controller.spec.ts and update the user.module.ts with &lt;em&gt;controllers:[UserController];&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Service
&lt;/h3&gt;

&lt;p&gt;We use service to write the the business logic&lt;/p&gt;

&lt;h3&gt;
  
  
  Are you curious like why is there a decorator @Injectable ?
&lt;/h3&gt;

&lt;p&gt;Because it serves the sole purpose of injecting the dependency.&lt;br&gt;&lt;br&gt;
Suppose to perform db operations which you want to implement in your 'user' service just to perform Basic CRUD&lt;/p&gt;

&lt;p&gt;Our Decorator during runtime serves the db service to ensure we can easily inject it and perform the business logic.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Injectable()
export class UserService {
  constructor(private dbService: DbService) {}
  // Nest sees the metadata: "Ah, this needs a DbService. I'll go grab the one from the database module."
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  What would happen without the @Injectable decorator ?
&lt;/h3&gt;

&lt;p&gt;Nest has no idea what 'DbService' is at runtime. It cannot "inject" it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// NO DECORATOR
export class UserService {
  constructor(private dbService: DbService) {} 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let us create a Dummy service and import it in Controller&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Injectable } from '@nestjs/common';

@Injectable()
export class UserService{
    sign(){
        return(`Hi, I'm signup`)
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now importing the business logic 'sign()' from service into controller at route '/signup-msg'&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Controller, Post } from '@nestjs/common';
import { UserService } from './user.service';

@Controller('user')
export class userController {
    constructor(private readonly userService: UserService){}

    @Post('signup-msg')
        getSignupmsg(){
            return this.userService.sign();
        }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open your postman try it on the endpoint&lt;br&gt;&lt;br&gt;
'localhost:3000/usersignup-msg'&lt;/p&gt;

&lt;p&gt;So, now let us go do some CRUD operations inside our application.&lt;/p&gt;

&lt;p&gt;NOTE : I'm not writing down the code for connecting your database with Prisma because there are high chances of version mismatch just make sure you have a prismaService that would help us perform db operations in other modules.&lt;/p&gt;
&lt;h3&gt;
  
  
  Understanding DTOs and Class validator in NestJS
&lt;/h3&gt;

&lt;p&gt;DTOs ( Data transfer Objects ) are used to structure the data and validate when we sent across the network. We have 'class-validator' package to perform heavy-lifting for us.&lt;/p&gt;
&lt;h4&gt;
  
  
  Installing class-validator
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i class-validator class-transformer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  Creating and validating DTOs
&lt;/h4&gt;

&lt;p&gt;Inside our 'auth' folder create a DTO folder, create files named loginUser.dto.ts, registerUser.dto.ts which would have all the validation rules we need for authentication.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { IsEmail, IsString } from "class-validator";

export class LoginDto {
    @IsEmail()
    email! : string;

    @IsString()
    password! : string;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Role } from "@prisma/client";
import { IsEmail, IsEnum, IsOptional, IsString} from "class-validator";

export class RegisterDto {
    @IsString()
    fname! : string;

    @IsString()
    lname! : string;

    @IsEmail()
    email! : string;

    @IsString()
    password! : string;

    @IsEnum(Role)
    @IsOptional()
    role?: Role;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Above, @IsEmail(),@IsString(),@IsEnum() are decorators provided by 'class-validator'.This tells us that we should have valid email id and valid password in form of string also you can add your own regex pattern for password. Note : We've enum roles in our prisma schema below is our schema&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "postgresql"
}

model User {
  id            String         @id @default(uuid())
  fname         String
  lname         String
  email         String         @unique
  password      String
  createdAt     DateTime       @default(now())
  role          Role           @default(USER)
  course        Course[]
  refreshTokens RefreshToken[]
}

model RefreshToken {
  id        String  @id @default(uuid())
  userId    String
  tokenHash String
  isRevoked Boolean @default(false)
  user      User    @relation(fields: [userId], references: [id])
}

model Course {
  id          String @id @default(uuid())
  name        String
  description String
  userId      String
  price       Int
  user        User   @relation(fields: [userId], references: [id])
}

enum Role {
  ADMIN
  USER
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Using DTOs in controllers
&lt;/h4&gt;

&lt;p&gt;Now let us use the DTOs in controller to validate our request we are sending, &lt;a class="mentioned-user" href="https://dev.to/body"&gt;@body&lt;/a&gt; decorator will help us use the DTO more efficiently.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Body, Controller, Post } from '@nestjs/common';
import { AuthService } from './auth.service';
import { RegisterDto } from './dto';

@Controller('auth')
export class AuthController {
  constructor(private authService: AuthService) {}

  @Post('signup')
  signup(@Body() dto: RegisterDto ) {
    return this.authService.signup(dto);
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Global validation pipe
&lt;/h4&gt;

&lt;p&gt;The whitelist: true option will trim the properties that don't have any decorators in the DTO.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;In DTO we have only this mentioned,
{
"email",
"password",
"role"
}
so if we try to send extra info it would trim it and send the essentials
{
"email",
"password",
"role",
"salary" // this won't be sent if we have 'whitelist:true'
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Things to be updated and will continue soon..
&lt;/h4&gt;

&lt;h4&gt;
  
  
  1. Basic Hashing
&lt;/h4&gt;

&lt;h4&gt;
  
  
  2. Config Setup
&lt;/h4&gt;

&lt;h4&gt;
  
  
  3. Passport &amp;amp; Jwt
&lt;/h4&gt;

&lt;h4&gt;
  
  
  4. Guards
&lt;/h4&gt;

&lt;h4&gt;
  
  
  5. Testing
&lt;/h4&gt;

</description>
      <category>nestjs</category>
      <category>backend</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Angular for beginners</title>
      <dc:creator>FLUX</dc:creator>
      <pubDate>Wed, 13 May 2026 12:12:53 +0000</pubDate>
      <link>https://dev.to/r8hitpatil/angular-for-beginners-12hf</link>
      <guid>https://dev.to/r8hitpatil/angular-for-beginners-12hf</guid>
      <description>&lt;h2&gt;
  
  
  Setup
&lt;/h2&gt;

&lt;p&gt;The command below will install Angular with global access.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;g&lt;/span&gt; &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;angular&lt;/span&gt;&lt;span class="sr"&gt;/cl&lt;/span&gt;&lt;span class="err"&gt;i
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why ?
&lt;/h3&gt;

&lt;p&gt;Helps us scaffold the angular like creating new project, component, serving the application, building, etc.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;
&lt;span class="err"&gt;#&lt;/span&gt; &lt;span class="nx"&gt;creating&lt;/span&gt; &lt;span class="nx"&gt;angular&lt;/span&gt; &lt;span class="nx"&gt;project&lt;/span&gt; &lt;span class="nx"&gt;named&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;angular101&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="nx"&gt;ng&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;angular101&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;According to your preferences select the options and you should get the project folder ready with name you had in your cli.&lt;/p&gt;

&lt;h3&gt;
  
  
  Running the project locally
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;
&lt;span class="err"&gt;#&lt;/span&gt; &lt;span class="nx"&gt;go&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;directory&lt;/span&gt;
&lt;span class="nx"&gt;cd&lt;/span&gt; &lt;span class="nx"&gt;angular101&lt;/span&gt;

&lt;span class="err"&gt;#&lt;/span&gt; &lt;span class="nx"&gt;start&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;run&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;angular&lt;/span&gt; &lt;span class="nx"&gt;project&lt;/span&gt;
&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;start&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We have our application running on '&lt;a href="http://localhost:4200" rel="noopener noreferrer"&gt;http://localhost:4200&lt;/a&gt;' Under the hood we have 'ng serve' that runs the application ( to be angular specific )&lt;/p&gt;

&lt;h2&gt;
  
  
  Component
&lt;/h2&gt;

&lt;p&gt;Angular follows component based architecture and these components are re-usable components with class based programming.&lt;/p&gt;

&lt;p&gt;We use decorator '@Component' that turns a simple class into a component. The '@Component' decorator is called component's metadata. Which includes few properties like selector,imports...&lt;/p&gt;

&lt;p&gt;We defined '@Component' BEFORE the class.&lt;/p&gt;

&lt;p&gt;Properties we have in our '@Component' :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;selector: Every component has CSS selector that determines how component is used. &lt;a href="https://angular.dev/guide/components/selectors" rel="noopener noreferrer"&gt;For more about selectors&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;imports: To use any other component,pipe or directive you must add it here in the imports array.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;templateUrl &amp;amp; styleUrl: Both component resides in relative directory where 'templateUrl' is to connect html file and styleUrl is to connect CSS file.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;
&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Component&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
&lt;span class="na"&gt;standalone&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// by default true ( no need to even write )&lt;/span&gt;
&lt;span class="na"&gt;selector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;app-root&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="na"&gt;imports&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;RouterOutlet&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="na"&gt;templateUrl&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./app.html&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="na"&gt;styleUrl&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./app.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;App&lt;/span&gt;&lt;span class="p"&gt;{}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Another thing to mention is 'standalone : true' is by default present from Angular 19 onwards and to reduce boilerplate we don't have it inside the component decorator.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is standalone ?
&lt;/h3&gt;

&lt;p&gt;Angular is components are standalone (not dependent on each other until and unless we explicitly dervice them in imports), meaning that you can directly add components to imports manually if we need. Before in angular we had app.module.ts which used to manage all the components at single place, manage all the modules, etc at single place but the standalone feature has provided each component to be independent and imports can be done inside each component.&lt;/p&gt;

&lt;h3&gt;
  
  
  Variable declaration in Angular ?
&lt;/h3&gt;

&lt;p&gt;We cannot just simply use let or const inside the class because those are temporary variables which are meant to live and die inside method. Thus if you are pretty clear with temporal dead zones in Javascript then you must've understood the concept how const and let can contradict the OOP concept.&lt;/p&gt;

&lt;h3&gt;
  
  
  Curious deprecation of app.module.ts
&lt;/h3&gt;

&lt;p&gt;Angular uses standalone components since v17 and the NgModules are deprecated.&lt;/p&gt;

&lt;h4&gt;
  
  
  What was NgModule used for ?
&lt;/h4&gt;

&lt;p&gt;Before we used to import and declare all the imports in one place of all the components at same place which used to cause unnecessary bloating thus standalone introduced managing the components dependency inside its own component deprecating the central registry.&lt;/p&gt;

&lt;p&gt;TLDR : A component imports what it uses&lt;/p&gt;

&lt;h2&gt;
  
  
  Input and Output
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Input
&lt;/h3&gt;

&lt;p&gt;The input function allows us to use Angular input in components. The input function would either have a optional input with inital value or have a required value instead.&lt;/p&gt;

&lt;p&gt;Inputs are signals that hold the latest value of input bound from the parent.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;course&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;card&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ts&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CourseCard&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;course&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;required&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Course&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;course-card.html

&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"course-card"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"course-desc"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        {{ course().description }}
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"image"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;[src]=&lt;/span&gt;&lt;span class="s"&gt;"course().iconUrl"&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"logo"&lt;/span&gt; &lt;span class="na"&gt;width=&lt;/span&gt;&lt;span class="s"&gt;"300"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Let us fix something with keyword called '@let'
&lt;/h4&gt;

&lt;p&gt;Sometimes we need to simplify the stuff ( more readable code ) then we can use the '@let' keyword to take the control over the code and instead of repeating stuff ex:&lt;/p&gt;

&lt;p&gt;We can see above code where we are repeating the 'course()' so let us simply make it something more simple by declaring the 'course()' once and then using it something like this below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;course-card.html

@let c = course();// defining once reusing it later

&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"course-card"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"course-desc"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        {{ c.description }}
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"image"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;[src]=&lt;/span&gt;&lt;span class="s"&gt;"c.iconUrl"&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"logo"&lt;/span&gt; &lt;span class="na"&gt;width=&lt;/span&gt;&lt;span class="s"&gt;"300"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Output
&lt;/h3&gt;

&lt;p&gt;The output function allows us to use the Angular output in components. You can use outputs to emit values to parent component.&lt;/p&gt;

&lt;p&gt;How do we manage the output ? Template event binding :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;courseSelected&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;showSelectedCourse($event)&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;example for setting up output :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;course&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;card&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ts &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;setting&lt;/span&gt; &lt;span class="nx"&gt;up&lt;/span&gt; &lt;span class="nx"&gt;output&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CourseCard&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;course&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;required&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Course&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="nx"&gt;courseSelected&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;output&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Course&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="nf"&gt;onCourseViewed&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;courseSelected&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;emit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;course&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;course-card.html

@let c = course();

&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"course-card"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"course-desc"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        {{ c.description }}
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"image"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;[src]=&lt;/span&gt;&lt;span class="s"&gt;"c.iconUrl"&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"logo"&lt;/span&gt; &lt;span class="na"&gt;width=&lt;/span&gt;&lt;span class="s"&gt;"300"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;(click)=&lt;/span&gt;&lt;span class="s"&gt;"onCourseViewed()"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;View course&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ts&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;App&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Angular project lol&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;coreCourse&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;COURSES&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
  &lt;span class="nx"&gt;rxJsCourse&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;COURSES&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

  &lt;span class="nf"&gt;onCourseSelected&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;course&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;Course&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Seleted course :`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;course&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The child component emits a custom event via 'courseSelected' output, the parent binds to that event in its template with '(courseSelected=onCourseSelected($event)'&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;app.html

&lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt; {{ title() }} &lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
  &lt;span class="c"&gt;&amp;lt;!-- &amp;lt;h2&amp;gt; {{ subtitle }}&amp;lt;/h2&amp;gt; --&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"courses"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;course-card&lt;/span&gt; &lt;span class="na"&gt;(courseSelected)=&lt;/span&gt;&lt;span class="s"&gt;"onCourseSelected($event)"&lt;/span&gt; &lt;span class="na"&gt;[course]=&lt;/span&gt;&lt;span class="s"&gt;"coreCourse"&lt;/span&gt; &lt;span class="nt"&gt;&amp;gt;&amp;lt;/course-card&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;course-card&lt;/span&gt; &lt;span class="na"&gt;(courseSelected)=&lt;/span&gt;&lt;span class="s"&gt;"onCourseSelected($event)"&lt;/span&gt; &lt;span class="na"&gt;[course]=&lt;/span&gt;&lt;span class="s"&gt;"rxJsCourse"&lt;/span&gt; &lt;span class="nt"&gt;&amp;gt;&amp;lt;/course-card&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Below is table for better understanding
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Direction&lt;/th&gt;
&lt;th&gt;TS Declaration&lt;/th&gt;
&lt;th&gt;Template Binding&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Parent → Child&lt;/strong&gt; (Data)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;x = input&amp;lt;T&amp;gt;()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;[x]="..."&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Child → Parent&lt;/strong&gt; (Event)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;y = output&amp;lt;T&amp;gt;()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;(y)="handler($event)"&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Two-way Binding&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;z = model&amp;lt;T&amp;gt;()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;[(z)]="..."&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  &lt;a class="mentioned-user" href="https://dev.to/for"&gt;@for&lt;/a&gt;,&lt;a class="mentioned-user" href="https://dev.to/if"&gt;@if&lt;/a&gt;,&lt;a class="mentioned-user" href="https://dev.to/switch"&gt;@switch&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;The different ways of using $index , $count inside for parent level, let, alias, let+alias&lt;/p&gt;

&lt;p&gt;Few more jargons like $even,$odd,$first,$last&lt;/p&gt;

</description>
      <category>angular</category>
      <category>frontend</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
