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 mylibYou'll be prompted to choose from one of the available templates:
| Template | Description |
|---|---|
basic | A basic TypeScript library with vitest |
react | A 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 reactStart Developing
Once your project is created, navigate to the project folder:
cd mylibStart the development server:
bun run devNow 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 TypeScriptBuilding for Production
When you're ready to publish your package:
bun run buildThis outputs:
dist/index.js- ESM bundledist/index.cjs- CommonJS bundledist/index.d.ts- TypeScript declarations
Publishing
# Build the package
bun run build
# Publish to npm
npm publishWe recommend using np or changesets for a better publishing workflow.
Next Steps
- Learn about all available Commands
- Explore Project Templates
- Understand the Project Structure
- Configure your project in Configuration