Backend development

Stage 1 · Lesson 4 of 10

Modules and npm packages

Your language and how HTTP works

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

  • CoursePaid
    Grokking JavaScript Fundamentals

    Design Gurus · Beginner · $50

    JavaScript itself in a sensible order: scope, closures, promises and async code

  • GuideFree
    Node.js Learn

    OpenJS Foundation · Beginner

    Official guides on the event loop, async work, the http module and environment variables

Practise

  • Your language track: small exercises with free mentor feedback on idiomatic code

Keep handy

  • Read Everyday Types and Narrowing first, then keep it open while you write TypeScript

  • Read the HTTP overview, methods, headers and status code pages until they feel obvious

Also worth your time

Mark this stage as not done?