Setting Up a Modern TypeScript Node.js Project in 2026

Type safety without the old setup pain

TypeScript is now the default for serious Node.js projects. The setup is much simpler than it used to be — modern Node can even run TypeScript files directly by stripping types.

Initialise

mkdir orders-api && cd orders-api
npm init -y
npm install -D typescript @types/node
npx tsc --init

In package.json, use ESM:

{ "type": "module" }

A Sensible tsconfig

{
  "compilerOptions": {
    "target": "ES2023",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "strict": true,
    "outDir": "dist",
    "rootDir": "src",
    "skipLibCheck": true,
    "verbatimModuleSyntax": true
  },
  "include": ["src"]
}

Running TypeScript

Options for development:

  • Node.js type stripping — recent Node versions run .ts files directly (node src/server.ts) when you use erasable TypeScript syntax
  • tsx — npx tsx watch src/server.ts for fast reloads
  • Type-check separately with tsc --noEmit

Scripts

{
  "scripts": {
    "dev": "tsx watch src/server.ts",
    "typecheck": "tsc --noEmit",
    "build": "tsc",
    "start": "node dist/server.js",
    "test": "node --test"
  }
}

Linting and Formatting

ESLint with typescript-eslint, plus Prettier (or Biome as an all-in-one alternative).

Production

Compile to JavaScript for production (tsc or a bundler like esbuild), and run the compiled output.

Strict TypeScript from day one saves you from an entire category of production bugs.

Arivanandhan Chitheshwaran