温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/docs/runtime/templating/init
点击访问原文链接

bun init - Bun

bun init - BunDocumentation Index

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 pageSearch...⌘KInstall BunSearch...NavigationGet Startedbun 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 WindowsBindgenLicenseOn this pageCLI UsageInitialization OptionsProject TemplatesOutput & FilesGlobal Configuration & ContextHelpExamplesGet Startedbun initCopy 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]">

Scaffold an empty Bun project with the interactive bun init command

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
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.md
Press 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=shadcn
​Output & 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 -y
React terminal
bun init --react
React + Tailwind CSS terminal
bun init --react=tailwind
React + @shadcn/ui terminal
bun init --react=shadcn

Was this page helpful?

YesNoSuggest editsRaise issueTypeScript 6 and 7Previousbun createNext⌘IxgithubdiscordyoutubePowered byThis documentation is built and hosted on Mintlify, a developer documentation platform

bun init - Bun,AI智能索引,全网链接索引,智能导航,网页索引

    Scaffold an empty Bun project with the interactive bun init command