<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ashutosh Mishra on Medium]]></title>
        <description><![CDATA[Stories by Ashutosh Mishra on Medium]]></description>
        <link>https://medium.com/@ashutoshmishra1615?source=rss-df5fb10cd2ca------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*o28ejBKUn06FooVGU7YomQ.jpeg</url>
            <title>Stories by Ashutosh Mishra on Medium</title>
            <link>https://medium.com/@ashutoshmishra1615?source=rss-df5fb10cd2ca------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 12:42:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ashutoshmishra1615/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Getting Started with NestJS: Why I Fell in Love with This Scalable Node.js Framework]]></title>
            <link>https://medium.com/dsc-nit-rourkela/getting-started-with-nestjs-why-i-fell-in-love-with-this-scalable-node-js-framework-5921b75a2162?source=rss-df5fb10cd2ca------2</link>
            <guid isPermaLink="false">https://medium.com/p/5921b75a2162</guid>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[nestjs]]></category>
            <category><![CDATA[nextjs]]></category>
            <dc:creator><![CDATA[Ashutosh Mishra]]></dc:creator>
            <pubDate>Wed, 25 Jun 2025 16:08:43 GMT</pubDate>
            <atom:updated>2025-07-08T08:52:35.604Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CrfwmAZqXPZWBOzdta059A.png" /></figure><p>Let’s be honest: backend development in Node.js can get messy — fast. I still remember my first “serious” Node.js project. It started simple enough. Routes in one file, controllers in another, a little business logic sprinkled here and there. But as the project grew, so did my headaches. Suddenly, I was drowning in callback hell, mysterious bugs, and folders that looked like they’d been hit by a tornado.</p><p>That’s when I stumbled upon NestJS. And, wow — what a game-changer.</p><h3>What is NestJS? (And Why Did It Feel Like Coming Home?)</h3><p>If you’ve ever used Angular on the frontend, NestJS will feel oddly familiar. But even if you haven’t, imagine a framework that brings order, clarity, and a little bit of magic to your Node.js codebase.</p><p>NestJS is a backend framework for Node.js, built with TypeScript (but you can use JavaScript too). It takes the best ideas from Angular — like decorators, modules, and dependency injection — and applies them to the backend. Underneath, it still uses Express (or Fastify, if you want), so you get the speed and reliability you’re used to, but with a structure that actually makes sense as your app grows.</p><p>When I first opened a NestJS project, it felt like someone had finally organized the kitchen. Everything had its place. No more hunting for lost utensils (or rogue middleware).</p><h3>Why Did I Switch to NestJS? (And Why Should You?)</h3><p>Let me break it down with a few real-life perks I noticed right away:</p><h3>1. TypeScript Out of the Box</h3><p>I’ll admit, I was a TypeScript skeptic at first. But after my third “undefined is not a function” bug, I was ready for something better. NestJS is built in TypeScript, and it guides you toward a safer, more predictable codebase. It’s like having a helpful friend who catches your mistakes before you hit run.</p><h3>2. Modular by Nature</h3><p>In my old projects, everything felt tangled. With NestJS, everything is a module. User management? Module. Authentication? Module. Payment processing? You guessed it — module. It’s so much easier to keep things organized, and you can even reuse modules across projects.</p><h3>3. Dependency Injection (DI) That Just Works</h3><p>I used to roll my own dependency management. It was… not fun. NestJS’s DI system is powerful, but it doesn’t get in your way. You can easily swap out services for testing or upgrades, and your code stays clean and testable.</p><h3>4. Adapters for Everything</h3><p>REST APIs, GraphQL, WebSockets, microservices, authentication — NestJS has a plug-and-play solution for almost everything. I was shocked at how quickly I could spin up a GraphQL endpoint or add real-time features.</p><h3>5. CLI That Actually Saves Time</h3><p>Some CLIs are more trouble than they’re worth. Not NestJS. It scaffolds projects, generates modules, controllers, and services, and wires everything up. I spend less time on boilerplate and more time on features.</p><h3>NestJS Terms Explained: Your Essential Glossary</h3><p>Here’s a friendly, easy-to-understand glossary of the most important NestJS concepts and terms. Use this as a sidebar, appendix, or quick-reference section in your blog to help readers (especially those new to NestJS) get comfortable with the framework’s vocabulary.</p><h3>Module</h3><ul><li>What it is: The basic building block of a NestJS app. Modules organize related features (controllers, services, providers) into cohesive units.</li><li>Why it matters: Keeps your codebase organized and maintainable. Every app has at least one root module (AppModule), but you’ll usually have many feature modules (like UsersModule, AuthModule, etc.).</li><li>How to use:</li></ul><pre>nest generate module users</pre><pre>@Module({   imports: [],   controllers: [UsersController],   providers: [UsersService], }) export class UsersModule {}</pre><h3>Controller</h3><ul><li>What it is: Handles incoming HTTP requests and returns responses to the client.</li><li>Why it matters: Defines your app’s API endpoints and the logic for routing requests to the right service.</li><li>How to use:</li></ul><pre>@Controller(&#39;users&#39;) export class UsersController {   @Get()   findAll() { /* ... */ } }</pre><ul><li>Analogy: Like a receptionist who receives requests and directs them to the right department<a href="https://codesignal.com/learn/courses/nestjs-basics-1/lessons/controllers-in-nestjs">3</a><a href="https://dev.to/shameel/nestjs-controller-in-easier-terms-37og">7</a><a href="https://www.turing.com/blog/what-is-nest-js-why-use-it">8</a>.</li></ul><h3>Service (Provider)</h3><ul><li>What it is: Contains business logic, data access, and reusable operations. In NestJS, most providers are services.</li><li>Why it matters: Keeps controllers simple and focused on routing, while services handle the “work.”</li><li>How to use:</li></ul><pre>@Injectable() export class UsersService {   findAll() { /* ... */ } }</pre><ul><li>Analogy: Like the staff in the back office who handle the actual work behind the scenes<a href="https://dev.to/nadim_ch0wdhury/what-is-module-services-pipe-in-nest-js-325d">2</a><a href="https://docs.nestjs.com/fundamentals/custom-providers">4</a><a href="https://www.turing.com/blog/what-is-nest-js-why-use-it">8</a>.</li></ul><h3>Provider</h3><ul><li>What it is: Any class that can be injected as a dependency (services, repositories, factories, etc.).</li><li>Why it matters: Enables dependency injection, making code modular, testable, and flexible.</li><li>How to use:<br>Mark your class with @Injectable() and add it to the providers array in your module<a href="https://docs.nestjs.com/fundamentals/custom-providers">4</a><a href="https://www.turing.com/blog/what-is-nest-js-why-use-it">8</a>.</li></ul><h3>Dependency Injection (DI)</h3><ul><li>What it is: A design pattern where dependencies are provided to a class, rather than the class creating them itself.</li><li>Why it matters: Promotes loose coupling, easier testing, and better code organization.</li><li>How to use:<br>Just add dependencies to your constructor — NestJS injects them automatically.</li></ul><pre>constructor(private readonly usersService: UsersService) {}</pre><ul><li>Analogy: Like having an assistant hand you the tools you need, instead of finding them yourself<a href="https://www.digitalocean.com/community/tutorials/a-guide-on-dependency-injection-in-nestjs">5</a><a href="https://www.turing.com/blog/what-is-nest-js-why-use-it">8</a>.</li></ul><h3>Middleware</h3><ul><li>What it is: Functions that run before route handlers. Used for tasks like logging, authentication, or modifying requests.</li><li>Why it matters: Lets you add cross-cutting features without cluttering your controllers.</li><li>How to use:<br>Implement the NestMiddleware interface and apply it in your module.</li><li>Analogy: Like a security checkpoint before entering a building<a href="https://blog.nevertoolate.studio/nestjs-essentials-understanding-the-5-core-concepts-897276211f76">1</a><a href="https://www.turing.com/blog/what-is-nest-js-why-use-it">8</a>.</li></ul><h3>Pipe</h3><ul><li>What it is: Used to transform or validate data before it reaches your route handler.</li><li>Why it matters: Ensures incoming data is correct and safe, and can also transform data as needed.</li><li>How to use:<br>Use built-in pipes like ValidationPipe, or create your own.</li></ul><pre>@UsePipes(new ValidationPipe())</pre><ul><li>Analogy: Like a filter that cleans or shapes data before it enters your system<a href="https://dev.to/nadim_ch0wdhury/what-is-module-services-pipe-in-nest-js-325d">2</a><a href="https://www.turing.com/blog/what-is-nest-js-why-use-it">8</a>.</li></ul><h3>Guard</h3><ul><li>What it is: Determines whether a request can proceed to a route handler (used for auth, permissions, etc.).</li><li>Why it matters: Protects routes based on custom logic (roles, permissions, tokens).</li><li>How to use:<br>Implement the CanActivate interface and use @UseGuards().</li><li>Analogy: Like a bouncer at a club, letting in only those who meet the criteria<a href="https://www.turing.com/blog/what-is-nest-js-why-use-it">8</a>.</li></ul><h3>Interceptor</h3><ul><li>What it is: Intercepts and modifies requests/responses before they reach the route handler or before the response is sent.</li><li>Why it matters: Useful for logging, transforming responses, caching, etc.</li><li>How to use:<br>Implement the NestInterceptor interface and use @UseInterceptors().</li><li>Analogy: Like a translator or editor who reviews and tweaks messages before delivery<a href="https://www.turing.com/blog/what-is-nest-js-why-use-it">8</a>.</li></ul><h3>Exception Filter</h3><ul><li>What it is: Handles errors and exceptions thrown during request processing.</li><li>Why it matters: Lets you customize error responses and centralize error handling.</li><li>How to use:<br>Implement the ExceptionFilter interface and use @UseFilters().</li><li>Analogy: Like customer support that gracefully handles complaints and issues<a href="https://blog.nevertoolate.studio/nestjs-essentials-understanding-the-5-core-concepts-897276211f76">1</a><a href="https://www.turing.com/blog/what-is-nest-js-why-use-it">8</a>.</li></ul><h3>Decorator</h3><ul><li>What it is: A special function (starting with @) that adds metadata or behavior to classes, methods, or properties.</li><li>Why it matters: Makes code more declarative and readable. Used everywhere in NestJS (e.g., @Controller, @Injectable, @Get).</li><li>How to use:<br>Just add @DecoratorName above your class or method.</li><li>Analogy: Like putting labels on things so NestJS knows how to handle them<a href="https://dev.to/tkssharma/discover-the-magic-of-custom-decorators-in-nestjs-nestjs-1ic9">6</a><a href="https://dev.to/shameel/nestjs-controller-in-easier-terms-37og">7</a><a href="https://www.turing.com/blog/what-is-nest-js-why-use-it">8</a></li></ul><p><strong>here everything is summarised in this image</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2HFZuA0AXgg9VTqzlxlxPA.png" /></figure><h3>Your First NestJS App: A Quick Walkthrough</h3><p>Let’s build a simple REST API together, just like I did on my first day with NestJS.</p><h3>Step 1: Install NestJS</h3><p>Open your terminal and run:</p><pre>npm i -g @nestjs/cli<br>nest new my-nest-app</pre><p>Boom — your project is scaffolded, TypeScript is set up, and you’re ready to go.</p><h3>Step 2: Explore the Structure</h3><p>Here’s what you’ll see:</p><ul><li>main.ts: Where your app starts</li><li>app.module.ts: The root module</li><li>app.controller.ts: Handles routes</li><li>app.service.ts: Business logic</li></ul><p>Everything is right where you’d expect.</p><h3>Step 3: Add a Users Module</h3><p>Let’s say you want to manage users (who doesn’t, right?). Run:</p><pre>nest generate module users<br>nest generate controller users<br>nest generate service users</pre><p>NestJS creates all the files you need and connects them. No more manual wiring.</p><h3>Step 4: Write a Simple Controller and Service</h3><p>Your users.controller.ts might look like this:</p><pre>import { Controller, Get } from &#39;@nestjs/common&#39;;<br>import { UsersService } from &#39;./users.service&#39;;</pre><pre>@Controller(&#39;users&#39;)<br>export class UsersController {<br>  constructor(private readonly usersService: UsersService) {}<br>@Get()<br>  findAll() {<br>    return this.usersService.findAll();<br>  }<br>}</pre><p>And your users.service.ts:</p><pre>import { Injectable } from &#39;@nestjs/common&#39;;</pre><pre>@Injectable()<br>export class UsersService {<br>  findAll() {<br>    return [{ id: 1, name: &#39;Ashutosh&#39; }, { id: 2, name: &#39;Tamanna&#39; }];<br>  }<br>}</pre><p>Start your server with npm run start, and hit http://localhost:3000/users. You’ll see your mock users. Simple, clean, and ready to scale.</p><h3>Beyond REST: The Real Power of NestJS</h3><p>The first time I needed to add real-time notifications to my app, I braced myself for pain. But with NestJS, WebSockets were almost… fun? Same goes for GraphQL and microservices.</p><ul><li>Microservices: Built-in support for Redis, MQTT, Kafka, and more.</li><li>GraphQL: Schema-first or code-first, your choice.</li><li>WebSockets: Real-time features without the headaches.</li><li>Authentication: Integrate Passport.js in minutes.</li><li>ORMs: TypeORM, Prisma, Sequelize — take your pick.</li></ul><p>NestJS feels like a Swiss Army knife for backend developers.</p><h3>When Should You Use NestJS? (And When Not To)</h3><p>Here’s my honest take:</p><p>Use NestJS if you:</p><ul><li>Are building something that will grow (think startups, SaaS, enterprise apps)</li><li>Want a codebase that’s easy to test, maintain, and scale</li><li>Like TypeScript and modern OOP patterns</li><li>Want clear separation of concerns</li></ul><p>Maybe skip it if:</p><ul><li>You’re building a tiny prototype or script</li><li>You hate structure and love chaos (hey, no judgment!)</li></ul><h3>Testing: No More Excuses</h3><p>I used to dread testing. But with NestJS, it’s built in from day one. The dependency injection system makes mocking services a breeze, and Jest is set up out of the box.</p><p>Here’s a quick test for our UsersService:</p><pre>import { Test, TestingModule } from &#39;@nestjs/testing&#39;;<br>import { UsersService } from &#39;./users.service&#39;;</pre><pre>describe(&#39;UsersService&#39;, () =&gt; {<br>  let service: UsersService;<br>beforeEach(async () =&gt; {<br>    const module: TestingModule = await Test.createTestingModule({<br>      providers: [UsersService],<br>    }).compile();<br>service = module.get&lt;UsersService&gt;(UsersService);<br>  });<br>it(&#39;should return all users&#39;, () =&gt; {<br>    expect(service.findAll()).toEqual([{ id: 1, name: &#39;Ashutosh&#39; }, { id: 2, name: &#39;Tamanna&#39; }]);<br>  });<br>});</pre><p>Testing is no longer a chore — it’s just part of the workflow.</p><h3>Is NestJS Perfect? (Let’s Be Real)</h3><p>Every tool has trade-offs. NestJS can feel heavy for small projects, and if you’re allergic to TypeScript or OOP, it might not be your cup of tea. But for anything that’s meant to grow, the structure and features are worth it.</p><h3>Final Thoughts</h3><p>NestJS brought order to my Node.js chaos. It’s helped me build apps that are easier to scale, test, and maintain. Whether you’re building a side project or the next big thing, NestJS gives you the foundation you need.</p><p>If you’re tired of backend messiness, give NestJS a try. You might just fall in love, like I did.</p><h3>Want to Learn More?</h3><ul><li><a href="https://docs.nestjs.com/">Official NestJS Docs</a></li><li><a href="https://github.com/nestjs/nest">NestJS GitHub</a></li><li><a href="https://github.com/juliandavidmr/awesome-nestjs">Awesome NestJS Projects</a></li><li>Tons of great YouTube tutorials — just search “NestJS beginner”!</li></ul><p><em>Building great apps is hard enough. Your framework shouldn’t make it harder. Here’s to cleaner code, happier teams, and a backend you can be proud of!</em></p><p>If you have questions or want to share your own NestJS story, drop a comment below. I’d love to hear how you’re using it!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5921b75a2162" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dsc-nit-rourkela/getting-started-with-nestjs-why-i-fell-in-love-with-this-scalable-node-js-framework-5921b75a2162">Getting Started with NestJS: Why I Fell in Love with This Scalable Node.js Framework</a> was originally published in <a href="https://medium.com/dsc-nit-rourkela">GDSC NIT Rourkela</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>