Magento 2 Experten — Hyvä Theme, Tailwind CSS & SEO aus einer Hand ›

Setting Up the JavaScript Development Environment

Setting Up the Development Environment

~8 Min. Lesezeit Zuletzt aktualisiert am August 8, 2026

Before we start the actual household budget project, let's set up the tools we need: Node.js and a clean project skeleton.

Installing Node.js

Node.js is the JavaScript runtime our project is built on – download the current LTS version from nodejs.org, or use a version manager like nvm. Check the installation:

node --version
npm --version

Editor recommendation

A code editor with JavaScript support is all you need – Visual Studio Code (free) offers syntax highlighting, autocompletion, and even built-in checking for simple typos out of the box, with no extra configuration.

Creating the household budget project

mkdir haushaltsbuch-app
cd haushaltsbuch-app
npm init -y

npm init -y creates a package.json with sensible defaults – the central configuration file of every Node.js project: name, version, entry point, and, as we'll see next, the module type too.

package.json
{
  "name": "haushaltsbuch-app",
  "version": "1.0.0",
  "private": true,
  "type": "module",
  "scripts": {
    "start": "node src/index.js"
  }
}

Two manual additions over the npm init default: "private": true prevents accidentally publishing to npm, and "type": "module" is the most important line in this file – more on that next.

CommonJS vs. ES Modules: a fork in the road at the start of the project

Node.js supports two module systems side by side TODAY. Historically grown CommonJS (require()/module.exports) is the standard from Node.js' early days. The modern standard, also native in browsers, is ES Modules (import/export). With "type": "module" in package.json, we declare that ALL .js files in this project use ES module syntax – the syntax we'll use throughout this tutorial, since it's more modern, usable identically in browsers, and therefore the better foundation for learning.

SystemSyntax
CommonJS (old)const fs = require('fs');
module.exports = myFunction;
ES Modules (modern, used here)import fs from 'fs';
export default myFunction;

Tipp: More on import/export in detail follows in chapter 21 (Modules) – for now, it's enough to know THAT we use this system and WHY the "type": "module" line is in package.json.