bun-init
Initialize a new Bun project
TLDR
Initialize a Bun project in the current directory
Initialize in a specific directory
Initialize with a specific project name
Initialize a project with default prompts
Initialize a minimal project
Initialize a React project
Initialize a React project with Tailwind CSS
SYNOPSIS
bun init [path] [-y|--yes] [-f|--force] [-t|--template template]
PARAMETERS
path
Optional directory to create/initialize project in. Defaults to current directory.
-y, --yes
Skip all interactive prompts and use defaults.
-f, --force
Overwrite existing files without confirmation.
-t, --template template
Use preset template (e.g. react, vue, preact, svelte, lit, hono).
DESCRIPTION
The bun init command scaffolds a new project using Bun, an ultra-fast JavaScript/TypeScript runtime, bundler, package manager, and more. It creates essential files like package.json, index.ts (or index.js), tsconfig.json, bun.lockb, and README.md.
Run interactively by default, it prompts for project details: name, version, description, entry point, module type (ESM/CJS), and package manager. Specify a path to create a subdirectory, or use templates for frameworks like React or Vue.
bun init is faster than npm init or yarn init, leveraging Bun's speed for dependency installation. Ideal for modern web apps, APIs, or scripts, it supports TypeScript out-of-the-box and auto-generates lockfiles.
CAVEATS
Requires Bun installed (≥1.0). Interactive mode needs terminal; templates may require internet. Does not auto-install deps unless prompted.
AVAILABLE TEMPLATES
react, vue, preact, svelte, lit, hono, nextjs. Run bun init --help for latest.
EXAMPLE USAGE
bun init myapp (interactive in myapp/)
bun init --template react --yes (React app, no prompts).
HISTORY
Introduced in Bun 0.1.0 (2022). Developed by Jarred Sumner at Oven; evolved with Bun's stable 1.0 release (2023), adding more templates and TypeScript support.


