Skip to main content

Bun Workspace Generator

Generate a complete Bun monorepo setup. Choose packages (frontend, backend, shared, types, CLI), configure TypeScript, test runner, and build tool — get root package.json, bunfig.toml, and per-package configs.

✓ Root package.json + workspaces ✓ bunfig.toml config ✓ TypeScript project refs ✓ Per-package stubs

Frequently Asked Questions

What is a Bun workspace (monorepo)?▼

A Bun workspace is a monorepo where multiple packages share a single root node_modules and package.json. Define it with the 'workspaces' field in root package.json: { "workspaces": ["packages/*"] }. Bun automatically links local packages — if packages/web depends on @myorg/shared, Bun symlinks it from the workspace without publishing to npm. Run scripts across all packages: 'bun run --filter "*" build'. This is faster than npm/yarn workspaces due to Bun's native package manager.

What is bunfig.toml?▼

bunfig.toml is Bun's configuration file for install behavior, test runner settings, and runtime options. The [install] section configures registry, scoped registries, and install flags. The [test] section sets test timeout, preload files, and coverage settings. The [run] section controls script execution. Unlike package.json engines or .npmrc, bunfig.toml is Bun-specific and lives at the root of your project or in ~/.bunfig.toml for global config.

What is the difference between bun.lock and package-lock.json?▼

bun.lock is Bun's binary lockfile format — significantly smaller and faster to read/write than JSON-based lockfiles. It records exact resolved package versions and integrity hashes. Use 'bun install --frozen-lockfile' in CI to fail if the lockfile would change. If you need npm/yarn compatibility (e.g., for Vercel or other platforms that call npm install), set 'bun install --save-text-lockfile' to generate a text-format lockfile, or commit package-lock.json alongside bun.lock.

How does 'bun run --filter' work?▼

The --filter flag selects which workspace packages to run a script in. 'bun run --filter "*" build' runs the 'build' script in all packages that have it. 'bun run --filter "frontend" dev' runs only in the 'frontend' package (matched by name field). You can also use glob patterns: 'bun run --filter "@myorg/*" test'. Bun runs these in parallel by default and respects workspace dependency order for build scripts.

Should I use bun build, vite, or tsup for bundling?▼

bun build is the fastest option and works well for server-side bundles (Bun runtime target) and simple browser bundles. vite is the best choice for frontend apps with hot module replacement, CSS handling, and the rich plugin ecosystem. tsup (powered by esbuild) is ideal for library packages that need dual CJS+ESM output, TypeScript declarations, and tree-shakeable builds. For a monorepo: use bun build or tsup for shared/library packages and vite for frontend apps.

Share this tool: X / Twitter LinkedIn
✓ 60,000+ developers use DevPlaybook ★★★★★ 4.8 / 5 on Gumroad ✓ MIT licensed · Instant download ✓ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • ⚡ AI Code Review, Doc Generator & SQL Builder
  • ⚡ All premium templates & early access
  • ⚡ Member discounts on Gumroad products
Start Free Trial →

$9/mo after trial · Cancel anytime

Want the full toolkit?

Get DevPlaybook Pro

Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro — $79 →

MIT licensed · Instant download · No subscription

See what's included → Browse all deals →