TSDX

Quick Start

With TSDX, you can quickly bootstrap a new TypeScript project in seconds, instead of hours.

Create a New Project

Open your terminal and run:

bunx tsdx create mylib

You'll be prompted to choose from one of the available templates:

TemplateDescription
basicA basic TypeScript library with vitest
reactA React component library with Testing Library

After you select one, TSDX will create a folder with the project template and install all dependencies.

Specifying a Template

You can skip the prompt by specifying the template directly:

bunx tsdx create mylib --template basic
# or
bunx tsdx create mylib --template react

Start Developing

Once your project is created, navigate to the project folder:

cd mylib

Start the development server:

bun run dev

Now edit src/index.ts (or src/index.tsx for React) and see your changes rebuild automatically!

Available Commands

Inside your new project, you can run:

bun run dev       # Start development mode with watch
bun run build     # Build for production
bun run test      # Run tests with vitest
bun run lint      # Lint with oxlint
bun run format    # Format with oxfmt
bun run typecheck # Type check with TypeScript

Building for Production

When you're ready to publish your package:

bun run build

This outputs:

  • dist/index.js - ESM bundle
  • dist/index.cjs - CommonJS bundle
  • dist/index.d.ts - TypeScript declarations

Publishing

# Build the package
bun run build

# Publish to npm
npm publish

We recommend using np or changesets for a better publishing workflow.

Next Steps

On this page