Stage 1 · Lesson 4 of 10
Modules and npm packages
A module is simply one file of code that others can import. has two module systems. use import and export, and new code should use them.
The older uses require. Set "type": "module" in package.json, or use .mjs files, to get ES modules. is the tool that installs other people's packages. package.json lists your dependencies and scripts.
package-lock.json, the , pins the exact version of everything installed. npm ci installs exactly what the lockfile says, which is what CI (your automatic build server) should run. Learn npm run for scripts, the difference between dependencies and devDependencies, and npx for one-off tools.
Common trapinstalling a package for every tiny job. npm makes it easy to pull in hundreds of indirect dependencies, and every one is code with access to your server.
A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- CoursePaidGrokking JavaScript Fundamentals
Design Gurus · Beginner · $50
JavaScript itself in a sensible order: scope, closures, promises and async code
- GuideFreeNode.js Learn
OpenJS Foundation · Beginner
Official guides on the event loop, async work, the http module and environment variables
Practise
Keep handy
Also worth your time
The DNS, TCP, TLS and HTTP steps behind every request your backend will handle