This article is for enthusiasts who strive to write clean, scalable, and more importantly refactorable code. It will give an idea about how Nest.JS can help us write clean code and what underlying architecture it uses.
Implementing a clean architecture with Nest.JS will require us to first comprehend what this framework is and how it works.
What is Nest.JS?
Nest or Nest.JS is a framework for building efficient, scalable Node.js applications (server-side) built with TypeScript. It uses Express or Fastify and allows a level of abstraction to enable developers to use an ample amount of modules (third-party) within their code.
Let’s dig deeper into what is this clean architecture all about.
Well, you all might have used or at least heard of MVC architecture. MVC stands for Model, View, Controller. The idea behind this is to separate our project structure into 3 different sections.
1. Model: It will contain the Object file which maps with Relation/Documents in the DB.
2. Controller: It is the request handler and is responsible for the business logic implementation and all the data manipulation.
3. View: This part will contain files that are concerned with the displaying of the data, either HTML files or some templa