tsx

A drop-in replacement for the node CLI that runs TypeScript and ESM files instantly, powered by esbuild.

Tool
npm
v4.23.13
12,135stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
88/100Excellent
Development Activity96
Maintenance100
Community60
Maturity56
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
85/100Excellent
Architecture85
Code Quality88
Innovation78
Learning Curve90

tsx (TypeScript Execute) is a Node.js enhancement that lets you run TypeScript files the same way you’d run a plain JavaScript file with node — no build step, no ts-node configuration, no separate loader setup. Under the hood it swaps in esbuild to transform TypeScript and modern JavaScript syntax on the fly, then re-spawns node with the appropriate CommonJS or ESM hooks wired in via —require/—import.

Beyond straight execution, tsx smooths over the CJS/ESM split that has fragmented the Node.js ecosystem since ES Modules landed: it lets CommonJS code require() ESM dependencies without hitting ERR_REQUIRE_ESM, resolves tsconfig.json path aliases at runtime, and honors Node’s own CLI flags so it behaves exactly like node in every other respect. A built-in watch mode reruns your script on file changes for fast iteration, and a Developer API (tsImport, register hooks, an entry-point import) lets other tools and libraries load TypeScript files programmatically without tsx owning the whole process.

What You Get

  • A tsx CLI that behaves exactly like node — same flags, same argument positioning — but accepts .ts/.tsx/.mts/.cts files directly
  • Automatic CJS/ESM interop so CommonJS code can require() ESM-only packages without ERR_REQUIRE_ESM
  • esbuild-powered on-the-fly transforms with a filesystem cache so repeat runs skip re-compilation
  • tsconfig.json path-alias resolution baked into both the CJS resolver and the ESM loader hook
  • Built-in watch mode (tsx watch) that restarts your script on file changes, with include/exclude globs and screen clearing
  • A TypeScript-aware REPL and a patched Node test runner integration (tsx --test) for .ts test files
  • A Developer API (register, tsImport, entry-point import) for embedding TypeScript loading into other tools without invoking the tsx CLI

Common Use Cases

  • Running one-off TypeScript scripts or CLI tools during local development without a compile step
  • Powering the dev/start script for Node.js backends written in TypeScript, in place of ts-node
  • Loading TypeScript configuration files (e.g. build tool configs) from within another program via the tsImport API
  • Executing TypeScript test files directly with Node’s built-in test runner via tsx --test
  • Iterating on scripts with tsx watch so file saves automatically re-run the process

Under The Hood

Architecture tsx separates a thin CLI entry point (src/cli.ts) from the actual execution mechanism (src/run.ts), which re-spawns a child node process with --require flags for a preflight script and a REPL patch, plus --import/--loader pointing at a loader that wires in the CJS and ESM hooks. Those hooks live in clearly separated src/cjs and src/esm/hook directories that plug into Node’s own module-resolution APIs rather than monkey-patching internals. Watch mode (src/watch) reuses the same spawn-based run() function behind a file watcher, relaying OS signals between parent and child over an IPC socket — so the spawn/hook wiring in run.ts is a shared foundation that watch mode, the REPL, and the Developer API entry points all depend on.

Tech Stack Written in TypeScript targeting es2022 with strict compiler settings, and transformed by esbuild both for its own build (via pkgroll) and as its runtime execution engine. Uses cleye for CLI flag parsing, chokidar for watch-mode file watching, get-tsconfig for tsconfig path-alias resolution, cross-spawn to launch the child node process, and kolorist for terminal output styling. Ships dual CJS/ESM builds through a detailed package.json exports map — there’s no database or web framework involved, since this is a Node.js runtime-augmentation tool distributed purely through npm.

Code Quality An extensive test suite under tests/specs covers CLI behavior, watch mode, the REPL, module loaders, tsconfig resolution, CJS/ESM interop contracts, and even PTY-based shell interaction, run through the manten test runner across multiple Node.js versions with a CI timeout guard to catch stuck runs. Strict TypeScript settings (strict mode, noImplicitOverride) are paired with lintroll for linting, and the codebase consistently separates CJS and ESM concerns into distinct source directories rather than mixing them.

What Makes It Unique tsx treats CommonJS/ESM interop as a first-class problem rather than an afterthought — resolving package.json exports subpaths, letting require() tolerate ESM-only dependencies, and doing so through Node’s official loader hook APIs instead of patching internals directly. That’s a meaningful point of differentiation from older TypeScript-execution tools that predate stable loader hooks, though the core idea of transforming TypeScript through esbuild at require/import time is a pattern this project shares with several comparable tools.

Used by 165 apps in this directory

TypeScript
99%
Other

Activepieces

Automation · AI Assistants

24,298

Open-source AI automation platform that converts 280+ workflow integrations into MCP servers for LLMs, with no-code builders and TypeScript extensibility.

View details
92
Repo Health
85
Technical
64
Dependency
Built with
TypeScript99%
Updated today
TypeScript
87%
Other

AFFiNE

Productivity · Project Management · Note Taking

72,238

Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.

View details
91
Repo Health
87
Technical
67
Dependency
Built with
TypeScript87%
Updated yesterday
Python
66%
Apache 2.0

Agent Control

AI Agents

304

An open-source runtime control plane for AI agents — define safety guardrails once, apply them across agents built on LangChain, CrewAI, Google ADK, or AWS Strands, and update controls without redeploying code.

View details
75
Repo Health
71
Technical
70
Dependency
Built with
Python66%
TypeScript33%
Updated 6 days ago
Python
98%
MIT

Agent Lightning

AI Development

18,000

A Microsoft-built training framework that optimizes AI agents with reinforcement learning, automatic prompt optimization, or supervised fine-tuning — with near-zero code changes to your existing agent, in any framework.

View details
83
Repo Health
68
Technical
70
Dependency
Built with
Python98%
Updated 5 days ago
TypeScript
60%
Other

agenta

Developer Tools · Devops · AI Development

4,706

The open-source LLMOps platform unifying prompt engineering, evaluation, and observability for teams building reliable LLM applications.

View details
91
Repo Health
77
Technical
67
Dependency
Built with
TypeScript60%
Python38%
Updated yesterday
TypeScript
82%
Apache 2.0

agentmemory

AI Agents

28,097

Persistent memory for AI coding agents — built on the iii engine, it works across Claude Code, GitHub Copilot CLI, Cursor, Gemini CLI, Codex CLI, and any MCP client, so agents stop needing everything re-explained every session.

View details
78
Repo Health
69
Technical
81
Dependency
Built with
TypeScript82%
Updated 1 weeks ago
TypeScript
86%
MIT

Agents Observe

Developer Tools

667

A real-time, fully local observability dashboard for Claude Code and Codex agent sessions — filtering, search, session replay, and token/cost breakdowns via an auto-starting MCP server.

View details
65
Repo Health
67
Technical
77
Dependency
Built with
TypeScript86%
JavaScript10%
Updated 3 days ago
TypeScript
95%
Apache 2.0

AionUi

AI Agents · Productivity

32,622

Free, open-source Cowork desktop app that unifies Claude Code, Codex, Gemini CLI, and 20+ AI agents into a single platform with multi-agent teams, 24/7 cron automation, and zero-config built-in agent.

View details
87
Repo Health
76
Technical
66
Dependency
Built with
TypeScript95%
Updated 5 days ago
Python
90%
Apache 2.0

Apache Airflow

Data Engineering

46,755

Define, schedule, and monitor complex data workflows as Python code — with a powerful UI, 80+ provider integrations, and battle-tested scalability across thousands of production deployments.

View details
96
Repo Health
89
Technical
64
Dependency
Built with
Python90%
Updated yesterday

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search