> ## Documentation Index
> Fetch the complete documentation index at: https://bun.zhcndoc.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 使用 Qwik 和 Bun 构建应用

使用 `bunx create-qwik` 初始化一个新的 Qwik 应用。

`create-qwik` 包会检测你是否使用了 `bunx`，并且会自动使用 bun 安装依赖。

```sh terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
bun create qwik
```

```txts theme={"theme":{"light":"github-light","dark":"dracula"}}
      ............
    .::: :--------:.
   .::::  .:-------:.
  .:::::.   .:-------.
  ::::::.     .:------.
 ::::::.        :-----:
 ::::::.       .:-----.
  :::::::.     .-----.
   ::::::::..   ---:.
    .:::::::::. :-:.
     ..::::::::::::
             ...::::


┌  让我们创建一个  Qwik 应用  ✨ (v1.2.10)
│
◇  你想在哪里创建新项目？(使用 '.' 或 './' 表示当前目录)
│  ./my-app
│
●  正在 /path/to/my-app 创建新项目 ... 🐇
│
◇  选择一个起始模板
│  Basic App
│
◇  你想安装 bun 依赖吗？
│  是
│
◇  初始化一个新的 git 仓库？
│  否
│
◇  完成安装。要听个笑话吗？
│  是
│
○  ────────────────────────────────────────────────────────╮
│                                                          │
│  你怎么知道床下有大象？                                 │
│  你的头顶到天花板了！                                    │
│                                                          │
├──────────────────────────────────────────────────────────╯
│
◇  应用已创建 🐰
│
◇  已安装 bun 依赖 📋
│
○  结果 ─────────────────────────────────────────────╮
│                                                      │
│  成功！项目已创建于 my-app 目录                       │
│                                                      │
│  集成？添加 Netlify、Cloudflare、Tailwind...          │
│  bun qwik add                                        │
│                                                      │
│  相关文档：                                           │
│  https://qwik.dev/docs/getting-started/              │
│                                                      │
│  有问题？开始聊天：                                   │
│  https://qwik.dev/chat                               │
│  https://twitter.com/QwikDev                         │
│                                                      │
│  演讲、播客和视频：                                  │
│  https://qwik.dev/media/                             │
│                                                      │
│  下一步：                                            │
│  cd my-app                                           │
│  bun start                                           │
│                                                      │
│                                                      │
├──────────────────────────────────────────────────────╯
│
└  编码愉快！🎉

```

***

运行 `bun run dev` 启动开发服务器。

```sh terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
bun run dev
```

```txt theme={"theme":{"light":"github-light","dark":"dracula"}}
$ vite--mode ssr

VITE v4.4.7  ready in 1190 ms

➜  本地访问:   http://localhost:5173/
➜  网络访问: 使用 --host 以暴露
➜  按 h 显示帮助
```

***

使用浏览器打开 [http://localhost:5173](http://localhost:5173) 查看效果。Qwik 会在你编辑源文件时热重载你的应用。

<Frame>![Qwik 截图](https://github.com/oven-sh/bun/assets/3084745/ec35f2f7-03dd-4c90-851e-fb4ad150bb28)</Frame>

***

完整文档请参考 [Qwik 文档](https://qwik.dev/docs/getting-started/)。
