Warming up the neural circuits...
By the end of this chapter you will:
"It works on my machine" has ended more careers than any single bug. Set up your environment once, correctly, and skip months of weird tooling pain.
A carpenter doesn't reorganize their workshop every Monday. Tools have homes. The plane lives on the left. The chisels on the right. The lumber out back.
Same with backend dev. Node, your editor, your terminal, your local DB — pick once, learn cold, never re-decide. Your time goes into building, not configuring.
| Tool | Why | What we'll install |
|---|---|---|
| Node.js | Run JS on the server | LTS via nvm |
| A package manager | Install libs | npm (built-in), or pnpm |
| VS Code | Editor | Free, dominant |
| A real terminal | Run things | Windows Terminal / iTerm2 / WezTerm |
| Git | Version control | The official installer |
| Desktop | Local Postgres, Redis | Container runtime |
| Postman / Insomnia / Client | Test APIs | One of the three |
| A DB client | Inspect data | TablePlus, DBeaver, pgAdmin |
Total install time: an hour. We'll do it once.
Don't use the .pkg / .msi installer from nodejs.org. It's fine until you need a different Node version for one project. Use nvm (Node Version Manager) — switch versions per project.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
# restart your shell, then:
nvm install --lts
nvm use --lts
node --version # → v20.x.x or v22.x.xUse nvm-windows (different project, same idea):
nvm-setup.exe).nvm install ltsnvm use 20.18.0 (or whatever it printed)node --versionLTS (Long-Term Support) is the version teams run in production. Latest is for early adopters. You want LTS.
Install VS Code (code.visualstudio.com). Then add these extensions — they save real time:
| Extension | What it does |
|---|---|
| ESLint | Lints your JS/TS on the fly |
| Prettier | Auto-formats on save |
| REST Client | Send HTTP requests from .http files |
| Error Lens | Shows errors inline |
| GitLens | git blame inline |
| DotENV | Highlights .env files |
| Docker | Manage containers from the sidebar |
| PostgreSQL (Chris Kolkman) | highlighting + run queries |
| Thunder Client | Postman alternative inside VS Code |
Open settings.json (Ctrl/Cmd + Shift + P → "Preferences: Open User Settings (JSON)") and add:
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"files.eol": "\n",
"files.insertFinalNewline": true
These four lines will save you 100s of small annoyances.
The default Windows cmd and macOS Terminal both work, but they're ugly. Pick one:
iterm2.com) or Warp.Optional but worth it: install Oh My Zsh (macOS/Linux) or PowerShell modules (Windows) for a prettier prompt with git status.
If you've never used Git, install it (git-scm.com) and configure once:
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --global init.defaultBranch main
git config --global pull.rebase falseWe assume basic Git fluency throughout. If you don't have it, do the Git & DevOps module first.
Docker lets you run Postgres, Redis, etc. without "installing" them. Get Docker Desktop from docker.com. Start it. Verify:
docker run hello-worldIf that prints a welcome message, you're set.
Don't install Postgres natively. Run it in a container.
docker run -d \
--name local-postgres \
-e POSTGRES_PASSWORD=secret \
-p 5432:5432 \
-v pgdata:/var/lib/postgresql/data \
postgres:16This:
Verify:
docker exec -it local-postgres psql -U postgres
# At the psql prompt:
SELECT version();
\qYou now have a local Postgres. To stop it: docker stop local-postgres. To start it again: docker start local-postgres.
Inspecting data via psql is slow. Get a real client:
Connect with: host localhost, port 5432, user postgres, password secret.
Three good choices:
.http files. Version-controllable.We'll use REST Client throughout the course because requests live next to code.
@base = http://localhost:3000
### Create a user
POST {{base}}/users
Content-Type: application/json
{ "name": "Aditi", "email": "aditi@x.com" }
### List users
GET {{base}}/usersClick "Send Request" above each ### block.
Create a folder. Initialize:
mkdir hello-backend
cd hello-backend
npm init -y
npm install express
node -e "require('http').createServer((_,res)=>res.end('hi')).listen(3000,()=>console.log('hi on 3000'))"Open another terminal:
curl http://localhost:3000
# → hiCongratulations, you have a working Node + HTTP . Stop the server with Ctrl+C.
| Mistake | Why it's wrong | What to do |
|---|---|---|
| Installing Node from the website | Can't switch versions per project | Use nvm |
| Postgres installed natively | Hard to remove, takes over port | Run in Docker |
| Editing in nano/vim before knowing them | Slow, frustrating | Use VS Code until you know better |
No .gitignore from day one | Commit node_modules to GitHub | Generate one (npx gitignore node) |
| Sharing global npm installs across projects | Version mismatch chaos | Use per-project dependencies + nvm |
Production. Pin your Node version. Commit a .nvmrc (echo "20" > .nvmrc) so anyone (and CI) runs the same version.
Performance. Don't run Postgres on your laptop and a heavy IDE and Slack and Chrome with 50 tabs. RAM is the bottleneck.
Security. Don't reuse production secrets locally. A local-postgres with password secret is fine. Production passwords stay in production.
process.versions.node.psql and create a database..nvmrc to a project. Switch versions with nvm use.docker compose.yml that runs Postgres + Redis with one command.You don't need to like configuring tools — you need to do it once. nvm for Node, VS Code with linting/formatting, a real terminal, Postgres in Docker, a DB client, a REST client. After this chapter you should never spend another 20 minutes installing a JS runtime.
.nvmrc in every project.-v pgdata:/var/lib/postgresql/data do in the Docker command?