DEV Community

Cover image for NestJS - overview
Ilya R
Ilya R

Posted on

2 1

NestJS - overview

NestJS is a backend framework on NodeJS. it developed by Kamil Mysliwiec.
NestJS defines the architecture of application and has many useful feature. It helps us in developing. We can write our code directly on TypeScript.

Structure of framework: modules, which contain controllers and services.

Modules.
Modules are individual parts of an application. They are like application entities. it is convenient to isolate the logic of individual pieces in a Module. This helps to easily add new features and functionality to the application. They are like a Namespaces.

Controllers.
Controllers are needed to create endpoints. They are like callback functions that are called on a specific URL. Methods of controllers called Actions. Well, in fact controllers dont contain a lot of logic. They usually call methods of models and services. Controllers help to separate application logic by URL.

Services.
Services contain all the main business logic of the application. Also, work with the database and third-party APIs. Services should include data processing an response formation. In other frameworks, they may be called Models.

Middleware.
Also, NestJS allows you to work with middleware. This is a special layer through which the request passes before being processed by the controller. Also, there is a middleware that is called after the controller returns a response to the user.

CLI.
NestJS has a handy CLI. It speeds up the development of the application and helps to create different files. For example, using the CLI, you can create models, controllers, and services.

Postgres on Neon - Get the Free Plan

No credit card required. The database you love, on a serverless platform designed to help you build faster.

Get Postgres on Neon

Top comments (2)

Collapse
 
andrewbaisden profile image
Andrew Baisden β€’

I have to say that I really enjoy using NestJS and I thought that I would just stick with Express.js forever. But NestJS has great documentation and it uses TypeScript first.

Collapse
 
thanhchuongdev profile image
thanhchuongbmd β€’

TS.ED is easier

Sentry image

See why 4M developers consider Sentry, β€œnot bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

πŸ‘‹ Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay