Skip to content

Setup ​

Node LTS, a package.json, TypeScript via tsx - that's the whole runway for this tutorial.

What you need ​

  • Node.js 20+ LTS (22 is fine too)
  • npm (comes with Node) - yarn/pnpm work, examples use npm
  • A terminal and an editor

Check versions:

bash
node -v
npm -v

If node is missing, grab LTS from nodejs.org or your package manager (nvm, fnm, etc.).

Fresh Express + TypeScript (minimal) ​

You don't need a generator. From an empty folder:

bash
npm init -y
npm install express
npm install -D typescript tsx @types/express @types/node
npx tsc --init

Comments for the code above:

  • express - the framework
  • tsx - run TypeScript without a build step while learning (like vite for a script)
  • @types/* - so the editor stops guessing

A tiny package.json scripts block:

json
{
  "type": "module",
  "scripts": {
    "dev": "tsx watch src/index.ts",
    "start": "tsx src/index.ts"
  }
}

"type": "module" means you get import / export like in Vite - not require().

For this repo ​

Docs:

bash
# from the tutorial root
npm install
npm run docs:dev

Companion API (later chapters):

bash
cd examples/notes-api
npm install
cp .env.example .env
npm run dev

The API listens on http://localhost:3000 by default.

Editor tips ​

  • Enable the TypeScript language service (VS Code / Cursor already do)
  • Treat any as a smell - Express types are a bit dated in places, but Request / Response still help

Optional: curl / httpie / REST client ​

You'll hit endpoints a lot. Browser DevTools Network tab works; for POST bodies I usually use:

bash
curl -s http://localhost:3000/health
curl -s -X POST http://localhost:3000/api/auth/login \
  -H 'Content-Type: application/json' \
  -d '{"email":"a@b.com","password":"secret"}'

Or the Thunder Client / REST Client extension - whatever you already use for FE API poking.

That's it for tooling. Next up: how Node thinks about requests vs how a SPA thinks about clicks.

Best,

-- ł.

Notes-style Express tutorial for front-end folks