U

Ultimate Bun Development

Powerful skill for modern, javascript, typescript, development. Includes structured workflows, validation checks, and reusable patterns for development.

SkillClipticsdevelopmentv1.0.0MIT
0 views0 copies

Ultimate Bun Development

A Claude Code skill for building fast, modern JavaScript/TypeScript applications with the Bun runtime. Covers Bun's built-in features — bundler, test runner, package manager, HTTP server — and migration patterns from Node.js, with a focus on performance and developer experience.

When to Use This Skill

Choose Ultimate Bun Development when:

  • You're starting a new JavaScript/TypeScript project and want maximum performance
  • You want to use Bun's built-in tools instead of separate packages (bundler, test runner, etc.)
  • You're migrating a Node.js project to Bun for performance improvements
  • You need a fast HTTP server with minimal boilerplate
  • You want to take advantage of Bun's native SQLite, FFI, or file I/O

Consider alternatives when:

  • You need maximum Node.js ecosystem compatibility (use Node.js)
  • You want serverless deployment (check Bun support for your provider)
  • You need Windows support (Bun's Windows support is still maturing)

Quick Start

# Install Bun curl -fsSL https://bun.sh/install | bash # Install the skill claude install ultimate-bun-development # Create a new project bun init my-app # Create an HTTP server claude "Create a Bun HTTP server with routing, middleware, and JSON responses" # Run tests claude "Set up Bun's built-in test runner with mocking, snapshots, and coverage"

Core Concepts

Bun Built-In Features

FeatureBunNode.js Equivalent
Package Managerbun installnpm, yarn, pnpm
Bundlerbun buildwebpack, esbuild, Vite
Test Runnerbun testJest, Vitest
TypeScriptNative, zero-configts-node, tsx
HTTP ServerBun.serve()Express, Fastify
File I/OBun.file(), Bun.write()fs module
SQLitebun:sqlitebetter-sqlite3
.envBuilt-in loadingdotenv
Watch Modebun --watchnodemon

HTTP Server Pattern

Bun.serve({ port: 3000, fetch(req) { const url = new URL(req.url); if (url.pathname === '/api/users' && req.method === 'GET') { return Response.json({ users: [] }); } if (url.pathname === '/api/users' && req.method === 'POST') { const body = await req.json(); return Response.json({ created: body }, { status: 201 }); } return new Response('Not Found', { status: 404 }); }, });

Performance Comparison

BenchmarkBunNode.jsImprovement
Package Install~1s~8s8x faster
TypeScript Startup~10ms~500ms50x faster
HTTP Requests/sec~100K~30K3x faster
File Read~3x fasterbaseline3x faster
Test Suite~2x fasterbaseline2x faster

Configuration

ParameterTypeDefaultDescription
project_typestring"server"Type: server, cli, library, fullstack
frameworkstring"none"Framework: none, hono, elysia, express
databasestring"sqlite"Database: sqlite (built-in), postgres, mysql
testingstring"bun"Testing: bun (built-in), vitest
deploy_targetstring"docker"Deploy: docker, fly.io, railway, vercel

Best Practices

  1. Use Bun's built-in features first — Before installing a package, check if Bun has a built-in equivalent. Built-in file I/O, SQLite, HTTP server, and test runner are faster and require zero dependencies.

  2. Use Hono or Elysia for routing — Bun's built-in fetch handler is low-level. For applications with many routes, use Hono (universal, works anywhere) or Elysia (Bun-optimized, fastest) as your routing framework.

  3. Take advantage of native TypeScript — Bun runs TypeScript directly without compilation. Don't add ts-node or tsx — just bun run file.ts. This eliminates build steps during development and speeds up startup dramatically.

  4. Use bun:sqlite for local data — Bun's built-in SQLite is faster than external packages and requires no native compilation. It's perfect for local databases, caching, and development without running a database server.

  5. Check Node.js compatibility before migrating — Most npm packages work with Bun, but some Node.js APIs have partial support. Check Bun's compatibility page for your critical dependencies before committing to a migration.

Common Issues

npm package doesn't work with Bun — Some packages that use Node.js-specific APIs (like child_process edge cases or native addons) may not work. Check the Bun GitHub issues for known incompatibilities and use the --bun flag to force Bun's runtime.

Bun process uses too much memory — Bun's garbage collector behaves differently from Node's V8 GC. For memory-intensive applications, monitor usage with process.memoryUsage() and consider manual garbage collection hints.

Tests pass in Bun but fail in CI — If your CI uses Node.js, tests may behave differently. Either run CI with Bun installed, or ensure your tests don't rely on Bun-specific APIs. Use the bun test command in CI with the Bun setup action.

Community

Reviews

Write a review

No reviews yet. Be the first to review this template!

Similar Templates