• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
  • Home
  • AI
  • Javascript
  • TypeScript
  • Development
  • Frameworks
    • Angular
    • Git
    • NestJs

The code Mood

Ignite Passion, Master Code

You are here: Home / NestJs / How to Setup a NestJS Project

How to Setup a NestJS Project

by Ahmed Fakhar Abbas

Nowadays, NestJS is a popular backend framework, and today The Code Mood will guide you on how to set up a basic project on your system with easy and simple steps. I’ve also made a YouTube tutorial, so if you feel more comfortable with visual content, you can get help from there as well

Let’s start without wasting any time. In the first step, we will check the Node.js version on our system using this command. If Node.js is not installed, you can watch my video on how to install NVM (which helps us install multiple Node.js versions and choose one based on the project requirements).

In this video, I will use NVM because, in professional software development, it’s common practice to manage multiple Node.js versions using NVM.

How to Setup a NestJS Project: A Complete YouTube Tutorial

Table of Contents

Toggle
  • Command to Check Node Version
  • Install NestJS CLI
  • Create a New NestJS Project
  • People also love to read about
  • Navigate to the Project Directory
    • Explore the Project Structure
  • Conclusion

Command to Check Node Version

Open the terminal in VS Code or on your system and paste this command:

node -v

If Node.js is already installed, the command will display the Node.js version number. Otherwise, it will give an error. If you encounter any error, please install the latest Node.js version using my video, and then proceed to the next step

Install NestJS CLI

Since Node.js is already installed on our system, we will move on to the next step: installing the NestJS CLI. We can do this with the following simple command:

install -g @nestjs/cli

This command will take some time depending on your internet speed and system performance. Once it is executed, NestJS will be successfully installed on your system and ready to use.

Create a New NestJS Project

Now, our next step is to create our first NestJS project on the system. With NestJS already installed, we can create a new project using the following command. Make sure to choose a name for your project; I’m going with push_notifications.

nest new project-name

When you execute this command, it will ask which package manager you want to choose. You can select one of the following options: npm, yarn, or pnpm. Use the arrow keys to navigate between options and press the Enter/return(in MacBook) button to make your selection.
It will take some time to create the new project for us.

People also love to read about

  • Promise.allSettled() in TypeScript
  • Firebase Cloud Messaging in NestJS or push notifications
  • Kubernetes vs. OpenShift

Navigate to the Project Directory

Now we can move to the project directory with the help of the cd command.

cd project-name

Explore the Project Structure

Let’s explore the project. It’s a simple and basic project created by the CLI and includes these important files:

  • app.controller.ts – Handles routing and HTTP requests. Our endpoints are defined in this file.
  • app.service.ts – Contains the business logic, such as fetching data from the database and manipulating it further.
  • app.module.ts – The root module of our application, where all files are integrated and dependencies are defined.
  • main.ts – The entry point of the project, where the execution starts.

These files form the foundation of any NestJS application. We can create additional modules for specific purposes, such as a user module, which would include a controller, service, and module file for user-related endpoints and business logic.

Conclusion

That’s it! We’ve successfully set up a new NestJS project. Now you can start building your application by adding new controllers, services, and modules. If you need more tips and tricks, check out my YouTube channel for additional tutorials.

Filed Under: NestJs

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Recent Posts

  • React Native vs Flutter: How to Pick the Best Framework for Your App in 2025
  • PostgreSQL JSON: 7 Must-Know Techniques for Effortless JSON Queries
  • React 18: 10 Powerful Features You Absolutely Must Know (2024 Guide)
  • Long Hair and Beard: 9 Fascinating Secrets Behind Programmers’ Iconic Look
  • Web App vs Website: 7 Powerful Differences You Must Know for Your Digital Success

Categories

  • AI
  • Angular
  • Development
  • Git
  • Javascript
  • NestJs
  • TypeScript

Footer

  • About Us
  • Privacy Policy
  • Contact Us

Copyright © 2025 · The code Mood