If you searched for init typescript project, fastest way to start typescript, or typescript project setup, you probably want a clean starter that does not break when you move from local to CI.

This guide gives a modern baseline using current Node conventions.

Quick answer

Use this sequence:

  1. initialize package metadata
  2. install TypeScript + Node types
  3. create a strict tsconfig.json
  4. add dev, build, and start scripts
  5. run the same scripts locally and in CI

1) Create a project

mkdir ts-starter && cd ts-starter
npm init -y

2) Install dependencies

npm install -D typescript @types/node tsx

Why tsx? It is usually the easiest way to run .ts entrypoints in development without fighting loader flags.

3) Generate and tune tsconfig.json

npx tsc --init

Then use a pragmatic baseline:

{
  "compilerOptions": {
    "target": "ES2022",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "strict": true,
    "noUncheckedIndexedAccess": true,
    "exactOptionalPropertyTypes": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "outDir": "dist",
    "rootDir": "src"
  },
  "include": ["src"]
}

4) Add source and scripts

Create src/index.ts:

console.log("TypeScript starter ready");

Add scripts to package.json:

{
  "scripts": {
    "dev": "tsx src/index.ts",
    "build": "tsc -p tsconfig.json",
    "start": "node dist/index.js",
    "typecheck": "tsc --noEmit"
  }
}

5) Run it

npm run dev
npm run typecheck
npm run build
npm run start

If all four pass, you have a stable local+CI baseline.

Tool choice: tsx vs ts-node vs bundlers

ToolBest forCaution
tsxquick dev executionstill run tsc --noEmit in CI
ts-nodelegacy workflowsESM/CJS loader complexity
esbuild/swcfast compile pipelinestypechecking handled separately

Common setup mistakes

1. Running without strict mode

You move faster early, then pay for it with runtime bugs later.

2. Mixing ESM and CJS without intent

Pick one module model for the project and enforce it.

3. Skipping typecheck in CI

Fast local execution is fine, but CI should still run tsc --noEmit.

4. Letting path assumptions drift

Use runtime-consistent path handling. See relative path resolution guide.

Production handoff pattern

When your TypeScript service sends or validates email flows, combine code baseline + messaging verification:

That gives you fewer "works locally" failures when shipping notification and auth journeys.

Final take

The fastest TypeScript setup is not the one with the fewest commands. It is the one that stays predictable in local dev, CI, and production. A strict config, clear scripts, and explicit runtime choices are the fastest path over time.