June 21, 2026 · by Meegrow Labs

npm init: How to Start a Real Node.js Project

You finally have an idea you want to build. You open your folder, ready to type your first line of code… and then you stop. Where do you even begin? Here’s the thing the pros know: they don’t just start typing. First, they set up the project — and it takes exactly one command.

To start a real Node.js project, run npm init -y in your project folder. This creates a package.json file — the official record that tells your tools what your project is, what it needs, and how to run it.

That one file turns a random folder full of code into a proper project. Let’s see why this matters and how to do it yourself in under a minute.

What does npm init actually do?

Think about building a house. You don’t start laying bricks at random. First you mark out the plot, then you note down the plan, and only then do you build. A software project needs that same base.

When you run npm init, you’re marking the plot and writing the plan in one go. It creates a single file called package.json — your project’s record. This file holds your project’s name, version, and the list of outside packages it depends on. Your tools read it to understand your project.

Without it, you just have loose files. With it, you have a real project that any tool — and any teammate — can pick up and understand.

How do I use npm init -y?

The full command asks you a series of questions (project name, version, description, and so on). When you’re starting out, you usually don’t need to answer all of them by hand. That’s what the -y flag is for.

Open your project folder in the terminal and type:

npm init -y

Let’s break that down:

  • npm init starts a new project.
  • -y means “yes” — it accepts all the default answers so you don’t have to type them one by one.

Press Enter, and watch a new file appear in your folder. That file is package.json.

What is package.json?

package.json is your project’s ID card. It’s a small text file that records what your project is and what it needs to run. Every real Node.js project has one, and your tools rely on it to do their job.

Open it up and you’ll see something simple, like this:

{
  "name": "my-project",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  }
}

Right now it’s nearly empty, and that’s fine. As your project grows, this file grows with it — especially once you start adding packages, which is the very next step.

Why should I do this for every project?

Because every real project starts here. Running npm init first might feel like extra work for two seconds, but it saves you hours later.

Here’s what it gives you:

  • Organisation — your work has a clear home and a clear record from line one.
  • A standard — this is how teams in India and around the world ship code, so your projects look professional from the start.
  • Readiness — the moment you want to add an outside package, your project is already set up to track it.

It’s a small habit that separates messy folders from clean, shippable projects. This is also exactly the foundation you’ll build on when you start building real apps in the free Zero to AI Hero course.

Try it right now

Don’t just read — do it. Here’s your 30-second exercise:

  • Open your project folder in the terminal.
  • Type npm init -y and press Enter.
  • Look inside the folder and find your new package.json file.

That’s it. You’ve just done what every professional developer does at the very start of a real project. If you haven’t met npm yet, it helps to first understand what npm is and why it matters before you run this.

Key takeaways

  • npm init starts a real project. Run npm init -y in your folder to set one up in one command.
  • The -y flag accepts the defaults so you don’t have to answer questions one by one.
  • package.json is your project’s record — its ID card — holding its name, version, and the packages it depends on.
  • Your tools read this file to understand your project, which keeps everything organised and standard.
  • Do it for every project. Clean from the very first step beats fixing a mess later.

Next up: now that your project has a record, you’re ready to add other people’s packages and put npm to real work.


🚀 Take the full free course: Zero to AI Hero — learn to build with AI from scratch. New lessons daily, in Hindi & English.

Meegrow Labs

We help India go from zero to AI hero — learn to use & build with AI from scratch, in Hindi & English. Start the free course →

Want to actually learn this?

151 free 2-minute lessons — from "what's a file?" to building with AI.

▶ Start the free course