tsx
TypeScript execute — run TypeScript files directly in Node.js without a compilation step, with ESM support and watch mode.
tsx
Node.jsTypeScript execute — run TypeScript files directly in Node.js without a compilation step, with ESM support and watch mode.
Fit
Install size includes transitive dependencies. Bundle size is gzipped browser payload.
Freshness
The Problem
Running TypeScript Node.js scripts requires either a build step (tsc) or a heavy runtime like ts-node that has slow startup times, ESM compatibility issues, and complex configuration.
What It Does
tsx uses esbuild to transform TypeScript on-the-fly with near-instant startup. It supports both CommonJS and ESM, handles tsconfig.json paths, and provides a --watch flag for development. Drop-in replacement for node — just prefix your command with tsx.
Installation
npm install -D tsxUsage Example
// package.json
{
"scripts": {
"dev": "tsx watch src/server.ts",
"start": "tsx src/server.ts",
"seed": "tsx scripts/seed-database.ts"
}
}// src/server.ts — runs directly with `tsx src/server.ts`
import { createServer } from 'http';
const server = createServer((req, res) => {
res.end('Hello from TypeScript!');
});
server.listen(3000, () => console.log('Server running on :3000'));Related packages
Role and attribute based access control (RBAC + ABAC) for Node.js with a fluent, readable API.
bcryptjsNode.jsPure JavaScript bcrypt password hashing — no native dependencies, same API as bcrypt, works anywhere Node.js runs.
bullmqNode.jsPremium message queue and job scheduler for Node.js backed by Redis — reliable background job processing with retries, priorities, and rate limiting.
casbinNode.jsA powerful authorization library that supports RBAC, ABAC, ACL and more via configurable policy models.
dotenvNode.jsLoad environment variables from a `.env` file into `process.env` — the standard way to manage configuration in Node.js apps.