bun init - BunDocumentation Index Search...⌘KInstall Bun Search...Navigation Get Started bun initRuntimePackage ManagerBundlerTest RunnerGuidesReferenceBlogFeedback:first-child]:!hidden peer-[.is-custom]:[&>:first-child]:sm:!hidden peer-[.is-custom]:[&>:first-child]:md:!hidden peer-[.is-custom]:[&>:first-child]:lg:!hidden peer-[.is-custom]:[&>:first-child]:xl:!hidden">Get StartedWelcome to BunInstallationQuickstartTypeScriptTypeScript 6 and 7bun initbun createCore RuntimeBun RuntimeWatch ModeDebuggingREPLbunfig.tomlFile & Module SystemFile TypesModule ResolutionJSXAuto-installPluginsFile System RouterHTTP serverServerRoutingCookiesTLSError HandlingMetricsNetworkingFetchWebSocketsTCPUDPDNSData & StorageCookiesFile I/OStreamsBinary DataArchiveSQLSQLiteS3RedisConcurrencyWorkersProcess & SystemEnvironment VariablesShellSpawnWebViewCronInterop & ToolingNode-APIFFIC CompilerTranspilerUtilitiesCSRF ProtectionSecretsConsoleTOMLYAMLMarkdownJSON5JSONLHTMLRewriterImageHashingGlobSemverColorUtilsStandards & CompatibilityGlobalsBun APIsWeb APIsNode.js CompatibilityContributingRoadmapBenchmarkingContributingBuilding WindowsBindgenLicense On this pageCLI UsageInitialization OptionsProject TemplatesOutput & FilesGlobal Configuration & ContextHelpExamplesGet Startedbun init Copy pagespan]:line-clamp-1 overflow-hidden group flex items-center py-0.5 gap-1 text-sm text-gray-950/50 dark:text-white/50 group-hover:text-gray-950/70 dark:group-hover:text-white/70 rounded-none rounded-r-xl border px-3 border-gray-200 aspect-square dark:border-white/[0.07] bg-background-light dark:bg-background-dark hover:bg-gray-600/5 dark:hover:bg-gray-200/5" aria-label="More actions" type="button" id="radix-_R_n4ctdbsnlht5lebsnpfdb_" aria-haspopup="menu" aria-expanded="false" data-state="closed"> *]:[overflow-wrap:anywhere]"> Copy pagespan]:line-clamp-1 overflow-hidden group flex items-center py-0.5 gap-1 text-sm text-gray-950/50 dark:text-white/50 group-hover:text-gray-950/70 dark:group-hover:text-white/70 rounded-none rounded-r-xl border px-3 border-gray-200 aspect-square dark:border-white/[0.07] bg-background-light dark:bg-background-dark hover:bg-gray-600/5 dark:hover:bg-gray-200/5" aria-label="More actions" type="button" id="radix-_R_1cctdbsnlht5lebsnpfdb_" aria-haspopup="menu" aria-expanded="false" data-state="closed"> Get started with Bun by scaffolding a new project with bun init.
terminal
Accepts values for presets:tailwind – React app preconfigured with Tailwind CSSshadcn – React app with @shadcn/ui and Tailwind CSSExamples: Yes NoSuggest editsRaise issueTypeScript 6 and 7Previousbun createNext⌘I xgithubdiscordyoutubePowered byThis documentation is built and hosted on Mintlify, a developer documentation platform
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
Skip to main contentBun home pageScaffold an empty Bun project with the interactive bun init command
bun init my-app
? Select a project template - Press return to submit. ❯ Blank React Library ✓ Select a project template: Blank + .gitignore + CLAUDE.md + .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc -> CLAUDE.md + index.ts + tsconfig.json (for editor autocomplete) + README.mdPress enter to accept the default answer for each prompt, or pass the -y flag to auto-accept the defaults. bun init scaffolds a new project with Bun. It infers settings with sane defaults and is non-destructive when run multiple times. It creates: a package.json file with a name that defaults to the current directory name a tsconfig.json file or a jsconfig.json file, depending if the entry point is a TypeScript file or not an entry point which defaults to index.ts unless any of index.{tsx, jsx, js, mts, mjs} exist or the package.json specifies a module or main field a README.md file AI Agent rules (disable with $BUN_AGENT_RULE_DISABLED=1): a CLAUDE.md file when Claude CLI is detected (disable with CLAUDE_CODE_AGENT_RULE_DISABLED env var) a .cursor/rules/*.mdc file to guide Cursor AI to use Bun instead of Node.js and npm when Cursor is detected If you pass -y or --yes, it will assume you want to continue without asking questions. At the end, it runs bun install to install @types/bun. CLI Usage terminal
bun init folder?>Initialization Options --yesbooleanp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Accept all default prompts without asking questions. Alias: -y --minimalbooleanp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Only initialize type definitions (skip app scaffolding). Alias: -m Project Templates --reactstring|booleanp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Scaffold a React project. When used without a value, creates a baseline React app.
Accepts values for presets:tailwind – React app preconfigured with Tailwind CSSshadcn – React app with @shadcn/ui and Tailwind CSSExamples:
bun init —react bun init —react=tailwind bun init —react=shadcnOutput & Files (result)infop:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Initializes project files and configuration for the chosen options (e.g., creating essential config files and a starter directory structure). Exact files vary by template. Global Configuration & Context --cwdstringp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Run bun init as if started in a different working directory (useful in scripts). Help --helpbooleanp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Print this help menu. Alias: -h Examples Accept all defaults terminal
bun init -yReact terminal
bun init --reactReact + Tailwind CSS terminal
bun init --react=tailwindReact + @shadcn/ui terminal
bun init --react=shadcn
Was this page helpful?
bun init - Bun,AI智能索引,全网链接索引,智能导航,网页索引
- Scaffold an empty Bun project with the interactive bun init command