{
 "kind": "tool",
 "slug": "tsx",
 "path": "tools/tsx/",
 "name": "tsx",
 "maker": null,
 "density": "full",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "Languages, types and runtimes",
   "tools/languages-types/"
  ]
 ],
 "lead": "Run TypeScript files without a build step.",
 "chips": [
  {
   "label": "Languages, types and runtimes",
   "path": "tools/languages-types/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install tsx"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/privatenumber/tsx"
  },
  {
   "label": "Website",
   "href": "https://tsx.hirok.io"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "MIT",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": "Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction",
   "note": "Any use is allowed; keep the MIT notice with tsx's files.",
   "src": "https://github.com/privatenumber/tsx/blob/master/LICENSE"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Sep 25, 2026",
   "note": "Latest GitHub release Sep 20, 2026. ",
   "src": "https://github.com/privatenumber/tsx"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "953 projects",
   "status": "info",
   "sub": "#2 of 70 in its category",
   "note": "Dependency in 953 public GitHub projects set up for AI coding agents that we scanned (15.2%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Install only",
   "status": "info",
   "sub": null,
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": null
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily; card checked Nov 11, 2026.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What tsx does",
   "parts": [
    {
     "t": "prose",
     "text": "tsx is a free command that runs TypeScript files directly with Node.js, the same way node runs JavaScript. Your assistant can write a script, a small server or a test in TypeScript and run it at once, with no separate build step. It does not check types; that stays a separate step."
    },
    {
     "t": "h3",
     "text": "What people build with it"
    },
    {
     "t": "uses",
     "items": [
      {
       "title": "Run a one-off TypeScript script",
       "text": "Your assistant writes a script that fills a test database or exports orders to a spreadsheet, and runs it at once with one command.",
       "idea": false
      },
      {
       "title": "Restart the app on every save",
       "text": "While you work on a small server or bot, it reruns by itself each time a file changes.",
       "idea": false
      },
      {
       "title": "Test TypeScript with Node's runner",
       "text": "Tests written in TypeScript run with Node.js's own test runner, with no extra test framework.",
       "idea": false
      },
      {
       "title": "TypeScript config files in your tool",
       "text": "People who use your tool or plugin system write its settings file in TypeScript, and your tool loads it.",
       "idea": false
      },
      {
       "title": "A small backend without a build",
       "text": "A small internal app runs from its TypeScript files on the server, if tsx is installed there as a normal package.",
       "idea": false
      },
      {
       "title": "Run a local helper for your AI assistant",
       "text": "A small TypeScript helper, such as a local tool server your assistant connects to, starts with one tsx command.",
       "idea": true
      }
     ]
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "tsx popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "84",
       "of": "/ 100",
       "l": "Gid Score, #45 overall"
      },
      {
       "n": "146M",
       "l": "downloads a week, npm"
      },
      {
       "n": "12.2K",
       "l": "GitHub stars"
      },
      {
       "n": "953",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How tsx is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "tsx is a dependency in 953 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (19.6% of the 4,867 JavaScript/TypeScript ones), #2 of 70 in languages, types and runtimes.",
      "Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 3,231; those are left out of every share on this page.",
      "The most used alternative in our scan is ts-node (295 projects).",
      "Projects that use it most often also use TypeScript (95.3%), Zod (58.2%), dotenv (44.8%).",
      "It is more common in projects set up for OpenClaw (23.4%) than for OpenCode (13.1%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "562 projects, 17.1%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "413 projects, 13.6%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "388 projects, 15.9%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "100 projects, 21.1%",
       "v": "Gemini CLI",
       "path": "agents/gemini-cli/"
      },
      {
       "l": "81 projects, 17.3%",
       "v": "OpenAI Codex",
       "path": "agents/openai-codex/"
      },
      {
       "l": "78 projects, 23.4%",
       "v": "OpenClaw",
       "path": "agents/openclaw/"
      },
      {
       "l": "51 projects, 18.3%",
       "v": "Devin Desktop",
       "path": "agents/devin-desktop/"
      },
      {
       "l": "45 projects, 13.1%",
       "v": "OpenCode",
       "path": "agents/opencode/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 95.3% of its projects",
       "v": "TypeScript",
       "path": "tools/typescript/"
      },
      {
       "l": "In 58.2% of its projects",
       "v": "Zod",
       "path": "tools/zod/"
      },
      {
       "l": "In 44.8% of its projects",
       "v": "dotenv",
       "path": "tools/dotenv/"
      },
      {
       "l": "In 51.5% of its projects",
       "v": "Vitest",
       "path": "tools/vitest/"
      },
      {
       "l": "In 50.8% of its projects",
       "v": "React",
       "path": "tools/react/"
      },
      {
       "l": "In 53.4% of its projects",
       "v": "ESLint",
       "path": "tools/eslint/"
      },
      {
       "l": "In 25.4% of its projects",
       "v": "Model Context Protocol SDK (JavaScript)",
       "path": "tools/modelcontextprotocol/"
      },
      {
       "l": "In 45.9% of its projects",
       "v": "Tailwind CSS",
       "path": "tools/tailwindcss/"
      }
     ]
    }
   ]
  },
  {
   "id": "profile",
   "nav": "Profile",
   "h2": "tsx in practice",
   "parts": [
    {
     "t": "h3",
     "text": "Strengths"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Same command line as node",
       "v": "You call tsx the way you call <code>node</code>, and Node CLI flags pass through. The site's example is <code>tsx --env-file=.env ./file.js</code>, which also shows that plain JS files run."
      },
      {
       "l": "No config file to start",
       "v": "The site says you can run TypeScript \"without worrying about configuration\" because tsx ships with \"modern and sensible defaults\"."
      },
      {
       "l": "Load ESM dependencies from CommonJS",
       "v": "The site says CommonJS code can load ESM dependencies without <code>ERR_REQUIRE_ESM</code> \"on supported Node.js versions\"."
      },
      {
       "l": "tsconfig paths and Watch mode built in",
       "v": "tsx reads <code>tsconfig.json</code> paths. Its Watch mode re-runs your files each time you save them."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Watch out for"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "ESM importing CommonJS is not smoothed over",
       "v": "The ESM help covers CommonJS loading ESM. The site says Node.js module semantics still apply when an ES module imports CommonJS. For legacy packages with incompatible default exports, it points to the FAQ."
      },
      {
       "l": "Loader flag depends on Node version",
       "v": "Mehul Kar's post is inconsistent about Node 18. One passage says <code>--loader</code> does not work there but <code>--import</code> does. Another says <code>--import tsx</code> doesn't work in Node 18 and that he just bumped to Node 20. His working setup is pinned to Node v20.11.1 and tsx@4.7.2, and he notes that versions matter more in nascent technology."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Install as a dev dependency and run a file"
    },
    {
     "t": "tabs",
     "label": "Example",
     "items": [
      {
       "tab": "Sh",
       "code": "$ npm install -D tsx\n$ npx tsx ./file.ts"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "profile",
   "h2": "More about tsx",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Funding",
       "path": "tools/funding/",
       "items": [
        "GitHub Sponsors: https://github.com/privatenumber",
        "34 GitHub sponsors"
       ]
      },
      {
       "title": "Head to head",
       "items": [
        {
         "text": "tsx vs ts-node",
         "note": "used together in 89 projects",
         "path": "tools/compare/tsx-vs-ts-node/"
        },
        {
         "text": "tsx vs jiti",
         "note": "used together in 64 projects",
         "path": "tools/compare/tsx-vs-jiti/"
        }
       ]
      },
      {
       "title": "Packages around it",
       "items": [
        "typescript: The language tsx runs",
        "zod: Schema validation",
        "vitest: Test runner",
        "dotenv: Env file loading",
        "@modelcontextprotocol: MCP SDK",
        "express: Web server framework"
       ]
      },
      {
       "title": "More in Languages, types and runtimes",
       "path": "tools/languages-types/",
       "items": [
        {
         "text": "TypeScript",
         "path": "tools/typescript/"
        },
        {
         "text": "vue-tsc",
         "path": "tools/vue-tsc/"
        },
        {
         "text": "Cloudflare Workers Types",
         "path": "tools/cloudflare-workers-types/"
        },
        {
         "text": "mypy",
         "path": "tools/mypy/"
        },
        {
         "text": "tsconfig-paths",
         "path": "tools/tsconfig-paths/"
        },
        {
         "text": "CFFI",
         "path": "tools/cffi/"
        },
        {
         "text": "pycparser",
         "path": "tools/pycparser/"
        },
        {
         "text": "type-fest",
         "path": "tools/type-fest/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "tsx",
       "me": true,
       "facts": [
        "MIT",
        "Gid 84",
        "146M/wk"
       ]
      },
      {
       "name": "ts-node",
       "why": "Pick ts-node when you want types checked while the code runs, using the TypeScript compiler itself.",
       "path": "tools/ts-node/",
       "facts": [
        "MIT",
        "Gid 81",
        "62.2M/wk"
       ]
      },
      {
       "name": "jiti",
       "why": "Pick jiti when a tool only needs to load TypeScript config files at runtime with no command of its own.",
       "path": "tools/jiti/",
       "facts": [
        "MIT",
        "Gid 67",
        "269M/wk"
       ]
      },
      {
       "name": "Bun",
       "why": "Pick Bun when you are ready to switch the whole runtime; it runs TypeScript itself and also installs packages.",
       "path": "tools/bun/",
       "facts": []
      }
     ],
     "more": "Compare tsx with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "prompt",
     "text": "Add tsx as a dev dependency (pin tsx@4.23.15, Node.js 20.6+), run TypeScript scripts with npx tsx ./file.ts (tsx flags before the file, script arguments after), use tsx watch during development, and add a separate \"type-check\" script with tsc --noEmit."
    },
    {
     "t": "steps",
     "items": [
      {
       "text": "Install tsx in your project as a development package.",
       "code": "npm install -D tsx",
       "src": "https://tsx.hirok.io/installation"
      },
      {
       "text": "Run a TypeScript file where you would run node.",
       "code": "npx tsx ./script.ts",
       "src": "https://tsx.hirok.io/"
      },
      {
       "text": "Check types separately with the TypeScript compiler.",
       "code": "npx tsc --noEmit",
       "src": "https://tsx.hirok.io/faq"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Rules for your agent"
    },
    {
     "t": "rules",
     "label": "Paste into AGENTS.md or CLAUDE.md",
     "text": "## tsx\n- Run TypeScript files with `tsx file.ts` wherever you would use `node file.js`. Node CLI flags such as `--env-file=.env` pass through.\n- Install it as a project dev dependency (`npm install -D tsx`, `pnpm add -D tsx` or `yarn add -D tsx`).\n- Inside `package.json#scripts`, call `tsx` directly without `npx`, for example `\"start\": \"tsx ./file.ts\"`.\n- For a one-off run without installing, use `npx tsx ./script.ts`.\n- Use a maintained Node.js version. The docs say tsx targets all maintained versions, and loading ESM from CommonJS works only \"on supported Node.js versions\".\n- When an ES module imports a CommonJS package, Node.js module semantics still apply. Check the tsx FAQ before working around legacy packages with incompatible default exports.\n- Don't run `yarn global add` with Yarn 2. The docs note that Yarn 2 doesn't support global installation.\n"
    },
    {
     "t": "h3",
     "text": "Mistakes to avoid"
    },
    {
     "t": "mistakes",
     "items": [
      {
       "dont": "Treating \"it ran with tsx\" as \"the types are correct\"",
       "fix": "Add \"type-check\" with tsc (noEmit) to package.json scripts and run it in CI or before commits",
       "why": "tsx strips types without checking them; in our run const seats: number = 'three' ran and printed three."
      },
      {
       "dont": "Replacing tsx with plain node file.ts on Node.js 22.18+ or 24 for code with enums or tsconfig paths",
       "fix": "Keep tsx for such code, or rewrite it to erasable syntax only (no enums, no namespaces with code, no paths)",
       "why": "Node's built-in type stripping errors on enums; in our run Node.js 24.22.2 failed with ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX: TypeScript enum is not supported in strip-only mode."
      },
      {
       "dont": "npx tsx ./file.ts --tsconfig ./tsconfig.custom.json (tsx flags after the file)",
       "fix": "npx tsx --tsconfig ./tsconfig.custom.json ./file.ts --name Ada",
       "why": "Everything after the file path goes to your script, not to tsx or Node.js."
      },
      {
       "dont": "Top-level await in a .ts file of a package without \"type\" \"module\"",
       "fix": "Rename the file to .mts or set \"type\" \"module\" in package.json; or wrap the code in an async function",
       "why": "Top-level await needs ES module mode, and the import syntax alone does not choose it."
      },
      {
       "dont": "Installing tsx with -D and starting the production server with tsx after npm ci --omit=dev",
       "fix": "Install tsx as a normal dependency for that server, or build to JavaScript and run node on the output",
       "why": "Production installs that skip development packages will not have tsx."
      }
     ]
    }
   ]
  },
  {
   "id": "faq",
   "nav": "Questions",
   "h2": "Questions",
   "parts": [
    {
     "t": "faq",
     "items": [
      {
       "q": "Does it check my types?",
       "a": "No. Run tsc --noEmit separately; in our run a file assigning a word to a number still ran.",
       "evidence": {
        "url": "https://tsx.hirok.io/faq",
        "quote": "tsx transforms TypeScript without checking types, so a type error alone does not stop execution."
       }
      },
      {
       "q": "Node.js can run .ts files now. Do I still need tsx?",
       "a": "Node.js only strips types; enums, namespaces with code and tsconfig paths fail there. In our run Node.js 24 stopped at an enum that tsx ran.",
       "evidence": {
        "url": "https://nodejs.org/api/typescript.html",
        "quote": "Node.js ignores tsconfig.json files and therefore features that depend on settings within tsconfig.json , such as paths or converting newer JavaScript syntax to older standards, are intentionally unsupported."
       }
      },
      {
       "q": "Can I use it in production?",
       "a": "Yes, if tsx is installed as a normal package there; the other option is to build JavaScript first and run that.",
       "evidence": {
        "url": "https://tsx.hirok.io/faq",
        "quote": "If your deployment omits development dependencies, a development-only installation will not be available."
       }
      },
      {
       "q": "How is it different from ts-node?",
       "a": "tsx uses esbuild and needs no TypeScript compiler to run code; ts-node uses the compiler and can check types while it runs.",
       "evidence": {
        "url": "https://tsx.hirok.io/faq",
        "quote": "ts-node integrates with the TypeScript compiler and can type-check during execution."
       }
      },
      {
       "q": "Can I use it in a paid product?",
       "a": "Yes. tsx is under the MIT license.",
       "evidence": {
        "url": "https://github.com/privatenumber/tsx/blob/master/LICENSE",
        "quote": "Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction"
       }
      }
     ]
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm tsx"
  ],
  [
   "Category",
   "Languages, types and runtimes"
  ],
  [
   "License",
   "MIT"
  ],
  [
   "Latest version",
   "v4.23.15, September 20, 2026"
  ],
  [
   "On GitHub since",
   "March 2022"
  ],
  [
   "Gid Score",
   "84.2"
  ],
  [
   "Rank in category",
   "#2 of 70"
  ],
  [
   "GitHub",
   "privatenumber/tsx"
  ],
  [
   "Last change",
   "Sep 25, 2026"
  ]
 ],
 "good": [
  "It does not check types. Code with type errors still runs, so add a separate check before you ship.",
  "The package installs on Node.js 18 and newer, but some features need Node.js 20.6 or newer.",
  "Watch mode ignores hidden files such as .env and anything in node_modules unless you include them."
 ],
 "checked_line": "Read by AgentGid from 17 official pages, card checked Nov 11, 2026; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/privatenumber.png"
}