prjct-cli 0.35.2 → 0.35.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (367) hide show
  1. package/core/commands/workflow.ts +3 -2
  2. package/dist/bin/prjct.mjs +5 -4
  3. package/package.json +1 -1
  4. package/templates/_bases/tracker-base.md +309 -0
  5. package/templates/agentic/orchestrator.md +211 -269
  6. package/templates/commands/github.md +9 -0
  7. package/templates/commands/history.md +296 -83
  8. package/templates/commands/jira.md +9 -0
  9. package/templates/commands/linear.md +9 -0
  10. package/templates/commands/monday.md +9 -0
  11. package/templates/commands/p.md +198 -63
  12. package/templates/commands/resume.md +68 -4
  13. package/templates/commands/sync.md +103 -0
  14. package/packages/shared/node_modules/@types/bun/LICENSE +0 -21
  15. package/packages/shared/node_modules/@types/bun/README.md +0 -20
  16. package/packages/shared/node_modules/@types/bun/index.d.ts +0 -1
  17. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/CLAUDE.md +0 -105
  18. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/README.md +0 -33
  19. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/bun.d.ts +0 -7032
  20. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/bun.ns.d.ts +0 -5
  21. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/bundle.d.ts +0 -74
  22. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/deprecated.d.ts +0 -184
  23. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/devserver.d.ts +0 -187
  24. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/README.md +0 -28
  25. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/bundler/bytecode.mdx +0 -465
  26. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/bundler/css.mdx +0 -1024
  27. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/bundler/esbuild.mdx +0 -298
  28. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/bundler/executables.mdx +0 -1277
  29. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/bundler/fullstack.mdx +0 -1086
  30. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/bundler/hot-reloading.mdx +0 -229
  31. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/bundler/html-static.mdx +0 -488
  32. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/bundler/index.mdx +0 -1604
  33. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/bundler/loaders.mdx +0 -451
  34. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/bundler/macros.mdx +0 -328
  35. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/bundler/minifier.mdx +0 -1286
  36. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/bundler/plugins.mdx +0 -425
  37. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/feedback.mdx +0 -75
  38. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/binary/arraybuffer-to-array.mdx +0 -29
  39. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/binary/arraybuffer-to-blob.mdx +0 -26
  40. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/binary/arraybuffer-to-buffer.mdx +0 -27
  41. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/binary/arraybuffer-to-string.mdx +0 -17
  42. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/binary/arraybuffer-to-typedarray.mdx +0 -41
  43. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/binary/blob-to-arraybuffer.mdx +0 -16
  44. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/binary/blob-to-dataview.mdx +0 -16
  45. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/binary/blob-to-stream.mdx +0 -16
  46. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/binary/blob-to-string.mdx +0 -17
  47. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/binary/blob-to-typedarray.mdx +0 -16
  48. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/binary/buffer-to-arraybuffer.mdx +0 -16
  49. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/binary/buffer-to-blob.mdx +0 -16
  50. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/binary/buffer-to-readablestream.mdx +0 -43
  51. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/binary/buffer-to-string.mdx +0 -27
  52. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/binary/buffer-to-typedarray.mdx +0 -16
  53. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/binary/dataview-to-string.mdx +0 -17
  54. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/binary/typedarray-to-arraybuffer.mdx +0 -27
  55. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/binary/typedarray-to-blob.mdx +0 -18
  56. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/binary/typedarray-to-buffer.mdx +0 -16
  57. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/binary/typedarray-to-dataview.mdx +0 -16
  58. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/binary/typedarray-to-readablestream.mdx +0 -43
  59. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/binary/typedarray-to-string.mdx +0 -18
  60. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/deployment/aws-lambda.mdx +0 -204
  61. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/deployment/digital-ocean.mdx +0 -161
  62. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/deployment/google-cloud-run.mdx +0 -194
  63. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/deployment/railway.mdx +0 -145
  64. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/deployment/render.mdx +0 -82
  65. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/deployment/vercel.mdx +0 -97
  66. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/astro.mdx +0 -82
  67. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/discordjs.mdx +0 -80
  68. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/docker.mdx +0 -151
  69. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/drizzle.mdx +0 -195
  70. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/elysia.mdx +0 -31
  71. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/express.mdx +0 -43
  72. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/gel.mdx +0 -261
  73. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/hono.mdx +0 -47
  74. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/mongoose.mdx +0 -92
  75. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/neon-drizzle.mdx +0 -234
  76. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/neon-serverless-postgres.mdx +0 -60
  77. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/nextjs.mdx +0 -103
  78. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/nuxt.mdx +0 -96
  79. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/pm2.mdx +0 -55
  80. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/prisma-postgres.mdx +0 -169
  81. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/prisma.mdx +0 -164
  82. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/qwik.mdx +0 -114
  83. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/react.mdx +0 -52
  84. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/remix.mdx +0 -97
  85. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/sentry.mdx +0 -54
  86. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/solidstart.mdx +0 -62
  87. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/ssr-react.mdx +0 -49
  88. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/stric.mdx +0 -54
  89. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/sveltekit.mdx +0 -138
  90. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/systemd.mdx +0 -114
  91. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/tanstack-start.mdx +0 -791
  92. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/upstash.mdx +0 -87
  93. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/ecosystem/vite.mdx +0 -77
  94. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/html-rewriter/extract-links.mdx +0 -71
  95. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/html-rewriter/extract-social-meta.mdx +0 -97
  96. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/http/cluster.mdx +0 -69
  97. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/http/fetch-unix.mdx +0 -35
  98. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/http/fetch.mdx +0 -26
  99. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/http/file-uploads.mdx +0 -97
  100. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/http/hot.mdx +0 -28
  101. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/http/proxy.mdx +0 -50
  102. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/http/server.mdx +0 -48
  103. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/http/simple.mdx +0 -20
  104. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/http/stream-file.mdx +0 -50
  105. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/http/stream-iterator.mdx +0 -49
  106. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/http/stream-node-streams-in-bun.mdx +0 -22
  107. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/http/tls.mdx +0 -32
  108. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/index.mdx +0 -10
  109. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/install/add-dev.mdx +0 -28
  110. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/install/add-git.mdx +0 -40
  111. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/install/add-optional.mdx +0 -27
  112. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/install/add-peer.mdx +0 -45
  113. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/install/add-tarball.mdx +0 -35
  114. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/install/add.mdx +0 -44
  115. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/install/azure-artifacts.mdx +0 -76
  116. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/install/cicd.mdx +0 -43
  117. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/install/custom-registry.mdx +0 -32
  118. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/install/from-npm-install-to-bun-install.mdx +0 -230
  119. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/install/git-diff-bun-lockfile.mdx +0 -48
  120. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/install/jfrog-artifactory.mdx +0 -28
  121. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/install/npm-alias.mdx +0 -25
  122. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/install/registry-scope.mdx +0 -40
  123. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/install/trusted.mdx +0 -52
  124. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/install/workspaces.mdx +0 -70
  125. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/install/yarnlock.mdx +0 -51
  126. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/process/argv.mdx +0 -66
  127. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/process/ctrl-c.mdx +0 -18
  128. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/process/ipc.mdx +0 -69
  129. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/process/nanoseconds.mdx +0 -15
  130. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/process/os-signals.mdx +0 -31
  131. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/process/spawn-stderr.mdx +0 -34
  132. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/process/spawn-stdout.mdx +0 -28
  133. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/process/spawn.mdx +0 -43
  134. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/process/stdin.mdx +0 -62
  135. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/read-file/arraybuffer.mdx +0 -30
  136. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/read-file/buffer.mdx +0 -21
  137. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/read-file/exists.mdx +0 -18
  138. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/read-file/json.mdx +0 -19
  139. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/read-file/mime.mdx +0 -22
  140. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/read-file/stream.mdx +0 -28
  141. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/read-file/string.mdx +0 -24
  142. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/read-file/uint8array.mdx +0 -23
  143. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/read-file/watch.mdx +0 -66
  144. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/runtime/build-time-constants.mdx +0 -295
  145. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/runtime/cicd.mdx +0 -45
  146. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/runtime/codesign-macos-executable.mdx +0 -61
  147. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/runtime/define-constant.mdx +0 -149
  148. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/runtime/delete-directory.mdx +0 -39
  149. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/runtime/delete-file.mdx +0 -21
  150. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/runtime/heap-snapshot.mdx +0 -28
  151. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/runtime/import-html.mdx +0 -15
  152. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/runtime/import-json.mdx +0 -46
  153. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/runtime/import-toml.mdx +0 -32
  154. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/runtime/import-yaml.mdx +0 -104
  155. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/runtime/read-env.mdx +0 -37
  156. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/runtime/set-env.mdx +0 -51
  157. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/runtime/shell.mdx +0 -42
  158. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/runtime/timezone.mdx +0 -38
  159. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/runtime/tsconfig-paths.mdx +0 -31
  160. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/runtime/typescript.mdx +0 -51
  161. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/runtime/vscode-debugger.mdx +0 -47
  162. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/runtime/web-debugger.mdx +0 -103
  163. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/streams/node-readable-to-arraybuffer.mdx +0 -13
  164. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/streams/node-readable-to-blob.mdx +0 -13
  165. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/streams/node-readable-to-json.mdx +0 -14
  166. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/streams/node-readable-to-string.mdx +0 -14
  167. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/streams/node-readable-to-uint8array.mdx +0 -13
  168. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/streams/to-array.mdx +0 -16
  169. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/streams/to-arraybuffer.mdx +0 -16
  170. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/streams/to-blob.mdx +0 -16
  171. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/streams/to-buffer.mdx +0 -17
  172. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/streams/to-json.mdx +0 -16
  173. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/streams/to-string.mdx +0 -16
  174. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/streams/to-typedarray.mdx +0 -24
  175. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/test/bail.mdx +0 -24
  176. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/test/concurrent-test-glob.mdx +0 -146
  177. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/test/coverage-threshold.mdx +0 -67
  178. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/test/coverage.mdx +0 -49
  179. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/test/happy-dom.mdx +0 -73
  180. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/test/migrate-from-jest.mdx +0 -125
  181. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/test/mock-clock.mdx +0 -50
  182. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/test/mock-functions.mdx +0 -70
  183. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/test/rerun-each.mdx +0 -16
  184. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/test/run-tests.mdx +0 -116
  185. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/test/skip-tests.mdx +0 -43
  186. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/test/snapshot.mdx +0 -102
  187. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/test/spy-on.mdx +0 -49
  188. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/test/svelte-test.mdx +0 -113
  189. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/test/testing-library.mdx +0 -93
  190. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/test/timeout.mdx +0 -17
  191. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/test/todo-tests.mdx +0 -74
  192. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/test/update-snapshots.mdx +0 -49
  193. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/test/watch-mode.mdx +0 -24
  194. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/util/base64.mdx +0 -17
  195. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/util/deep-equals.mdx +0 -41
  196. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/util/deflate.mdx +0 -20
  197. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/util/detect-bun.mdx +0 -28
  198. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/util/entrypoint.mdx +0 -19
  199. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/util/escape-html.mdx +0 -24
  200. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/util/file-url-to-path.mdx +0 -16
  201. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/util/gzip.mdx +0 -20
  202. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/util/hash-a-password.mdx +0 -56
  203. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/util/import-meta-dir.mdx +0 -15
  204. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/util/import-meta-file.mdx +0 -15
  205. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/util/import-meta-path.mdx +0 -15
  206. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/util/javascript-uuid.mdx +0 -25
  207. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/util/main.mdx +0 -43
  208. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/util/path-to-file-url.mdx +0 -16
  209. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/util/sleep.mdx +0 -24
  210. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/util/upgrade.mdx +0 -93
  211. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/util/version.mdx +0 -23
  212. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/util/which-path-to-executable-bin.mdx +0 -17
  213. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/websocket/compression.mdx +0 -33
  214. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/websocket/context.mdx +0 -79
  215. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/websocket/pubsub.mdx +0 -43
  216. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/websocket/simple.mdx +0 -38
  217. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/write-file/append.mdx +0 -54
  218. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/write-file/basic.mdx +0 -46
  219. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/write-file/blob.mdx +0 -30
  220. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/write-file/cat.mdx +0 -19
  221. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/write-file/file-cp.mdx +0 -18
  222. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/write-file/filesink.mdx +0 -54
  223. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/write-file/response.mdx +0 -19
  224. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/write-file/stdout.mdx +0 -23
  225. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/write-file/stream.mdx +0 -19
  226. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/guides/write-file/unlink.mdx +0 -18
  227. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/index.mdx +0 -133
  228. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/installation.mdx +0 -365
  229. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/pm/bunx.mdx +0 -91
  230. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/pm/catalogs.mdx +0 -292
  231. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/pm/cli/add.mdx +0 -179
  232. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/pm/cli/audit.mdx +0 -60
  233. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/pm/cli/info.mdx +0 -70
  234. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/pm/cli/install.mdx +0 -606
  235. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/pm/cli/link.mdx +0 -61
  236. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/pm/cli/outdated.mdx +0 -197
  237. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/pm/cli/patch.mdx +0 -69
  238. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/pm/cli/pm.mdx +0 -323
  239. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/pm/cli/publish.mdx +0 -131
  240. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/pm/cli/remove.mdx +0 -16
  241. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/pm/cli/update.mdx +0 -140
  242. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/pm/cli/why.mdx +0 -84
  243. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/pm/filter.mdx +0 -102
  244. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/pm/global-cache.mdx +0 -72
  245. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/pm/isolated-installs.mdx +0 -220
  246. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/pm/lifecycle.mdx +0 -64
  247. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/pm/lockfile.mdx +0 -64
  248. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/pm/npmrc.mdx +0 -111
  249. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/pm/overrides.mdx +0 -83
  250. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/pm/scopes-registries.mdx +0 -35
  251. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/pm/security-scanner-api.mdx +0 -95
  252. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/pm/workspaces.mdx +0 -115
  253. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/project/benchmarking.mdx +0 -241
  254. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/project/bindgen.mdx +0 -223
  255. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/project/building-windows.mdx +0 -133
  256. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/project/contributing.mdx +0 -388
  257. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/project/feedback.mdx +0 -20
  258. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/project/license.mdx +0 -78
  259. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/project/roadmap.mdx +0 -8
  260. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/quickstart.mdx +0 -251
  261. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/auto-install.mdx +0 -97
  262. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/binary-data.mdx +0 -846
  263. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/bun-apis.mdx +0 -59
  264. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/bunfig.mdx +0 -723
  265. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/c-compiler.mdx +0 -204
  266. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/child-process.mdx +0 -659
  267. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/color.mdx +0 -267
  268. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/console.mdx +0 -67
  269. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/cookies.mdx +0 -454
  270. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/debugger.mdx +0 -335
  271. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/environment-variables.mdx +0 -231
  272. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/ffi.mdx +0 -565
  273. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/file-io.mdx +0 -306
  274. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/file-system-router.mdx +0 -118
  275. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/file-types.mdx +0 -435
  276. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/glob.mdx +0 -181
  277. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/globals.mdx +0 -72
  278. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/hashing.mdx +0 -315
  279. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/html-rewriter.mdx +0 -333
  280. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/http/cookies.mdx +0 -79
  281. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/http/error-handling.mdx +0 -40
  282. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/http/metrics.mdx +0 -36
  283. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/http/routing.mdx +0 -289
  284. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/http/server.mdx +0 -645
  285. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/http/tls.mdx +0 -101
  286. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/http/websockets.mdx +0 -414
  287. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/index.mdx +0 -223
  288. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/jsx.mdx +0 -115
  289. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/module-resolution.mdx +0 -374
  290. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/networking/dns.mdx +0 -111
  291. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/networking/fetch.mdx +0 -484
  292. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/networking/tcp.mdx +0 -239
  293. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/networking/udp.mdx +0 -129
  294. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/node-api.mdx +0 -19
  295. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/nodejs-compat.mdx +0 -468
  296. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/plugins.mdx +0 -419
  297. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/redis.mdx +0 -583
  298. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/s3.mdx +0 -863
  299. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/secrets.mdx +0 -340
  300. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/semver.mdx +0 -57
  301. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/shell.mdx +0 -637
  302. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/sql.mdx +0 -1404
  303. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/sqlite.mdx +0 -721
  304. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/streams.mdx +0 -232
  305. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/templating/create.mdx +0 -269
  306. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/templating/init.mdx +0 -58
  307. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/transpiler.mdx +0 -288
  308. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/typescript.mdx +0 -58
  309. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/utils.mdx +0 -922
  310. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/watch-mode.mdx +0 -161
  311. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/web-apis.mdx +0 -29
  312. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/workers.mdx +0 -314
  313. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/runtime/yaml.mdx +0 -469
  314. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/snippets/cli/add.mdx +0 -166
  315. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/snippets/cli/build.mdx +0 -196
  316. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/snippets/cli/bunx.mdx +0 -49
  317. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/snippets/cli/feedback.mdx +0 -17
  318. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/snippets/cli/init.mdx +0 -84
  319. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/snippets/cli/install.mdx +0 -173
  320. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/snippets/cli/link.mdx +0 -163
  321. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/snippets/cli/outdated.mdx +0 -140
  322. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/snippets/cli/patch.mdx +0 -171
  323. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/snippets/cli/publish.mdx +0 -198
  324. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/snippets/cli/remove.mdx +0 -146
  325. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/snippets/cli/run.mdx +0 -293
  326. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/snippets/cli/test.mdx +0 -100
  327. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/snippets/cli/update.mdx +0 -144
  328. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/test/code-coverage.mdx +0 -409
  329. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/test/configuration.mdx +0 -514
  330. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/test/dates-times.mdx +0 -129
  331. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/test/discovery.mdx +0 -90
  332. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/test/dom.mdx +0 -226
  333. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/test/index.mdx +0 -380
  334. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/test/lifecycle.mdx +0 -366
  335. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/test/mocks.mdx +0 -637
  336. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/test/reporters.mdx +0 -126
  337. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/test/runtime-behavior.mdx +0 -342
  338. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/test/snapshots.mdx +0 -434
  339. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/test/writing-tests.mdx +0 -672
  340. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/docs/typescript.mdx +0 -54
  341. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/extensions.d.ts +0 -35
  342. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/fetch.d.ts +0 -79
  343. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/ffi.d.ts +0 -1154
  344. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/globals.d.ts +0 -2067
  345. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/html-rewriter.d.ts +0 -186
  346. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/index.d.ts +0 -32
  347. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/jsc.d.ts +0 -233
  348. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/overrides.d.ts +0 -376
  349. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/package.json +0 -37
  350. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/redis.d.ts +0 -3352
  351. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/s3.d.ts +0 -1299
  352. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/security.d.ts +0 -101
  353. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/serve.d.ts +0 -1296
  354. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/shell.d.ts +0 -380
  355. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/sql.d.ts +0 -887
  356. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/sqlite.d.ts +0 -1321
  357. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/test-globals.d.ts +0 -22
  358. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/test.d.ts +0 -2391
  359. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/vendor/expect-type/branding.d.ts +0 -283
  360. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/vendor/expect-type/index.d.ts +0 -1207
  361. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/vendor/expect-type/messages.d.ts +0 -395
  362. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/vendor/expect-type/overloads.d.ts +0 -669
  363. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/vendor/expect-type/utils.d.ts +0 -431
  364. package/packages/shared/node_modules/@types/bun/node_modules/bun-types/wasm.d.ts +0 -193
  365. package/packages/shared/node_modules/@types/bun/package.json +0 -53
  366. package/templates/commands/redo.md +0 -144
  367. package/templates/commands/undo.md +0 -154
@@ -1,1086 +0,0 @@
1
- ---
2
- title: "Fullstack dev server"
3
- description: "Build fullstack applications with Bun's integrated dev server that bundles frontend assets and handles API routes"
4
- ---
5
-
6
- To get started, import HTML files and pass them to the `routes` option in `Bun.serve()`.
7
-
8
- ```ts title="app.ts" icon="/icons/typescript.svg"
9
- import { serve } from "bun";
10
- import dashboard from "./dashboard.html";
11
- import homepage from "./index.html";
12
-
13
- const server = serve({
14
- routes: {
15
- // ** HTML imports **
16
- // Bundle & route index.html to "/". This uses HTMLRewriter to scan
17
- // the HTML for `<script>` and `<link>` tags, runs Bun's JavaScript
18
- // & CSS bundler on them, transpiles any TypeScript, JSX, and TSX,
19
- // downlevels CSS with Bun's CSS parser and serves the result.
20
- "/": homepage,
21
- // Bundle & route dashboard.html to "/dashboard"
22
- "/dashboard": dashboard,
23
-
24
- // ** API endpoints ** (Bun v1.2.3+ required)
25
- "/api/users": {
26
- async GET(req) {
27
- const users = await sql`SELECT * FROM users`;
28
- return Response.json(users);
29
- },
30
- async POST(req) {
31
- const { name, email } = await req.json();
32
- const [user] = await sql`INSERT INTO users (name, email) VALUES (${name}, ${email})`;
33
- return Response.json(user);
34
- },
35
- },
36
- "/api/users/:id": async req => {
37
- const { id } = req.params;
38
- const [user] = await sql`SELECT * FROM users WHERE id = ${id}`;
39
- return Response.json(user);
40
- },
41
- },
42
-
43
- // Enable development mode for:
44
- // - Detailed error messages
45
- // - Hot reloading (Bun v1.2.3+ required)
46
- development: true,
47
- });
48
-
49
- console.log(`Listening on ${server.url}`);
50
- ```
51
-
52
- ```bash terminal icon="terminal"
53
- bun run app.ts
54
- ```
55
-
56
- ## HTML Routes
57
-
58
- ### HTML Imports as Routes
59
-
60
- The web starts with HTML, and so does Bun's fullstack dev server.
61
-
62
- To specify entrypoints to your frontend, import HTML files into your JavaScript/TypeScript/TSX/JSX files.
63
-
64
- ```ts title="app.ts" icon="/icons/typescript.svg"
65
- import dashboard from "./dashboard.html";
66
- import homepage from "./index.html";
67
- ```
68
-
69
- These HTML files are used as routes in Bun's dev server you can pass to `Bun.serve()`.
70
-
71
- ```ts title="app.ts" icon="/icons/typescript.svg"
72
- Bun.serve({
73
- routes: {
74
- "/": homepage,
75
- "/dashboard": dashboard,
76
- },
77
-
78
- fetch(req) {
79
- // ... api requests
80
- },
81
- });
82
- ```
83
-
84
- When you make a request to `/dashboard` or `/`, Bun automatically bundles the `<script>` and `<link>` tags in the HTML files, exposes them as static routes, and serves the result.
85
-
86
- ### HTML Processing Example
87
-
88
- An `index.html` file like this:
89
-
90
- ```html title="index.html" icon="file-code"
91
- <!DOCTYPE html>
92
- <html>
93
- <head>
94
- <title>Home</title>
95
- <link rel="stylesheet" href="./reset.css" />
96
- <link rel="stylesheet" href="./styles.css" />
97
- </head>
98
- <body>
99
- <div id="root"></div>
100
- <script type="module" src="./sentry-and-preloads.ts"></script>
101
- <script type="module" src="./my-app.tsx"></script>
102
- </body>
103
- </html>
104
- ```
105
-
106
- Becomes something like this:
107
-
108
- ```html title="index.html" icon="file-code"
109
- <!DOCTYPE html>
110
- <html>
111
- <head>
112
- <title>Home</title>
113
- <link rel="stylesheet" href="/index-[hash].css" />
114
- </head>
115
- <body>
116
- <div id="root"></div>
117
- <script type="module" src="/index-[hash].js"></script>
118
- </body>
119
- </html>
120
- ```
121
-
122
- ## React Integration
123
-
124
- To use React in your client-side code, import `react-dom/client` and render your app.
125
-
126
- <CodeGroup>
127
- ```ts title="src/backend.ts" icon="/icons/typescript.svg"
128
- import dashboard from "../public/dashboard.html";
129
- import { serve } from "bun";
130
-
131
- serve({
132
- routes: {
133
- "/": dashboard,
134
- },
135
- async fetch(req) {
136
- // ...api requests
137
- return new Response("hello world");
138
- },
139
- });
140
-
141
- ````
142
-
143
- ```tsx title="src/frontend.tsx" icon="/icons/typescript.svg"
144
- import { createRoot } from 'react-dom/client';
145
- import App from './app';
146
-
147
- const container = document.getElementById('root');
148
- const root = createRoot(container!);
149
- root.render(<App />);
150
- ````
151
-
152
- ```html title="public/dashboard.html" icon="file-code"
153
- <!DOCTYPE html>
154
- <html>
155
- <head>
156
- <title>Dashboard</title>
157
- <link rel="stylesheet" href="../src/styles.css" />
158
- </head>
159
- <body>
160
- <div id="root"></div>
161
- <script type="module" src="../src/frontend.tsx"></script>
162
- </body>
163
- </html>
164
- ```
165
-
166
- ```tsx title="src/app.tsx" icon="/icons/typescript.svg"
167
- import { useState } from "react";
168
-
169
- export default function App() {
170
- const [count, setCount] = useState(0);
171
-
172
- return (
173
- <div>
174
- <h1>Dashboard</h1>
175
- <button onClick={() => setCount(count + 1)}>Count: {count}</button>
176
- </div>
177
- );
178
- }
179
- ```
180
-
181
- </CodeGroup>
182
-
183
- ## Development Mode
184
-
185
- When building locally, enable development mode by setting `development: true` in `Bun.serve()`.
186
-
187
- ```ts title="src/backend.ts" icon="/icons/typescript.svg"
188
- import homepage from "./index.html";
189
- import dashboard from "./dashboard.html";
190
-
191
- Bun.serve({
192
- routes: {
193
- "/": homepage,
194
- "/dashboard": dashboard,
195
- },
196
-
197
- development: true,
198
-
199
- fetch(req) {
200
- // ... api requests
201
- },
202
- });
203
- ```
204
-
205
- ### Development Mode Features
206
-
207
- When `development` is `true`, Bun will:
208
-
209
- - Include the SourceMap header in the response so that devtools can show the original source code
210
- - Disable minification
211
- - Re-bundle assets on each request to a `.html` file
212
- - Enable hot module reloading (unless `hmr: false` is set)
213
- - Echo console logs from browser to terminal
214
-
215
- ### Advanced Development Configuration
216
-
217
- `Bun.serve()` supports echoing console logs from the browser to the terminal.
218
-
219
- To enable this, pass `console: true` in the development object in `Bun.serve()`.
220
-
221
- ```ts title="src/backend.ts" icon="/icons/typescript.svg"
222
- import homepage from "./index.html";
223
-
224
- Bun.serve({
225
- // development can also be an object.
226
- development: {
227
- // Enable Hot Module Reloading
228
- hmr: true,
229
-
230
- // Echo console logs from the browser to the terminal
231
- console: true,
232
- },
233
-
234
- routes: {
235
- "/": homepage,
236
- },
237
- });
238
- ```
239
-
240
- When `console: true` is set, Bun will stream console logs from the browser to the terminal. This reuses the existing WebSocket connection from HMR to send the logs.
241
-
242
- ### Development vs Production
243
-
244
- | Feature | Development | Production |
245
- | ------------------- | --------------------- | ----------- |
246
- | **Source maps** | ✅ Enabled | ❌ Disabled |
247
- | **Minification** | ❌ Disabled | ✅ Enabled |
248
- | **Hot reloading** | ✅ Enabled | ❌ Disabled |
249
- | **Asset bundling** | 🔄 On each request | 💾 Cached |
250
- | **Console logging** | 🖥️ Browser → Terminal | ❌ Disabled |
251
- | **Error details** | 📝 Detailed | 🔒 Minimal |
252
-
253
- ## Production Mode
254
-
255
- Hot reloading and `development: true` helps you iterate quickly, but in production, your server should be as fast as possible and have as few external dependencies as possible.
256
-
257
- ### Ahead of Time Bundling (Recommended)
258
-
259
- As of Bun v1.2.17, you can use `Bun.build` or `bun build` to bundle your full-stack application ahead of time.
260
-
261
- ```bash terminal icon="terminal"
262
- bun build --target=bun --production --outdir=dist ./src/index.ts
263
- ```
264
-
265
- When Bun's bundler sees an HTML import from server-side code, it will bundle the referenced JavaScript/TypeScript/TSX/JSX and CSS files into a manifest object that `Bun.serve()` can use to serve the assets.
266
-
267
- ```ts title="src/backend.ts" icon="/icons/typescript.svg"
268
- import { serve } from "bun";
269
- import index from "./index.html";
270
-
271
- serve({
272
- routes: { "/": index },
273
- });
274
- ```
275
-
276
- ### Runtime Bundling
277
-
278
- When adding a build step is too complicated, you can set `development: false` in `Bun.serve()`.
279
-
280
- This will:
281
-
282
- - Enable in-memory caching of bundled assets. Bun will bundle assets lazily on the first request to an `.html` file, and cache the result in memory until the server restarts.
283
- - Enable `Cache-Control` headers and `ETag` headers
284
- - Minify JavaScript/TypeScript/TSX/JSX files
285
-
286
- ```ts title="src/backend.ts" icon="/icons/typescript.svg"
287
- import { serve } from "bun";
288
- import homepage from "./index.html";
289
-
290
- serve({
291
- routes: {
292
- "/": homepage,
293
- },
294
-
295
- // Production mode
296
- development: false,
297
- });
298
- ```
299
-
300
- ## API Routes
301
-
302
- ### HTTP Method Handlers
303
-
304
- Define API endpoints with HTTP method handlers:
305
-
306
- ```ts title="src/backend.ts" icon="/icons/typescript.svg"
307
- import { serve } from "bun";
308
-
309
- serve({
310
- routes: {
311
- "/api/users": {
312
- async GET(req) {
313
- // Handle GET requests
314
- const users = await getUsers();
315
- return Response.json(users);
316
- },
317
-
318
- async POST(req) {
319
- // Handle POST requests
320
- const userData = await req.json();
321
- const user = await createUser(userData);
322
- return Response.json(user, { status: 201 });
323
- },
324
-
325
- async PUT(req) {
326
- // Handle PUT requests
327
- const userData = await req.json();
328
- const user = await updateUser(userData);
329
- return Response.json(user);
330
- },
331
-
332
- async DELETE(req) {
333
- // Handle DELETE requests
334
- await deleteUser(req.params.id);
335
- return new Response(null, { status: 204 });
336
- },
337
- },
338
- },
339
- });
340
- ```
341
-
342
- ### Dynamic Routes
343
-
344
- Use URL parameters in your routes:
345
-
346
- ```ts title="src/backend.ts" icon="/icons/typescript.svg"
347
- serve({
348
- routes: {
349
- // Single parameter
350
- "/api/users/:id": async req => {
351
- const { id } = req.params;
352
- const user = await getUserById(id);
353
- return Response.json(user);
354
- },
355
-
356
- // Multiple parameters
357
- "/api/users/:userId/posts/:postId": async req => {
358
- const { userId, postId } = req.params;
359
- const post = await getPostByUser(userId, postId);
360
- return Response.json(post);
361
- },
362
-
363
- // Wildcard routes
364
- "/api/files/*": async req => {
365
- const filePath = req.params["*"];
366
- const file = await getFile(filePath);
367
- return new Response(file);
368
- },
369
- },
370
- });
371
- ```
372
-
373
- ### Request Handling
374
-
375
- ```ts title="src/backend.ts" icon="/icons/typescript.svg"
376
- serve({
377
- routes: {
378
- "/api/data": {
379
- async POST(req) {
380
- // Parse JSON body
381
- const body = await req.json();
382
-
383
- // Access headers
384
- const auth = req.headers.get("Authorization");
385
-
386
- // Access URL parameters
387
- const { id } = req.params;
388
-
389
- // Access query parameters
390
- const url = new URL(req.url);
391
- const page = url.searchParams.get("page") || "1";
392
-
393
- // Return response
394
- return Response.json({
395
- message: "Data processed",
396
- page: parseInt(page),
397
- authenticated: !!auth,
398
- });
399
- },
400
- },
401
- },
402
- });
403
- ```
404
-
405
- ## Plugins
406
-
407
- Bun's bundler plugins are also supported when bundling static routes.
408
-
409
- To configure plugins for `Bun.serve`, add a `plugins` array in the `[serve.static]` section of your `bunfig.toml`.
410
-
411
- ### TailwindCSS Plugin
412
-
413
- You can use TailwindCSS by installing and adding the `tailwindcss` package and `bun-plugin-tailwind` plugin.
414
-
415
- ```bash terminal icon="terminal"
416
- bun add tailwindcss bun-plugin-tailwind
417
- ```
418
-
419
- ```toml title="bunfig.toml" icon="settings"
420
- [serve.static]
421
- plugins = ["bun-plugin-tailwind"]
422
- ```
423
-
424
- This will allow you to use TailwindCSS utility classes in your HTML and CSS files. All you need to do is import `tailwindcss` somewhere:
425
-
426
- ```html title="index.html" icon="file-code"
427
- <!doctype html>
428
- <html>
429
- <head>
430
- <!-- [!code ++] -->
431
- <link rel="stylesheet" href="tailwindcss" />
432
- </head>
433
- <!-- the rest of your HTML... -->
434
- </html>
435
- ```
436
-
437
- Alternatively, you can import TailwindCSS in your CSS file:
438
-
439
- ```css title="style.css" icon="file-code"
440
- @import "tailwindcss";
441
-
442
- .custom-class {
443
- @apply bg-red-500 text-white;
444
- }
445
- ```
446
-
447
- ```html index.html icon="file-code"
448
- <!doctype html>
449
- <html>
450
- <head>
451
- <!-- [!code ++] -->
452
- <link rel="stylesheet" href="./style.css" />
453
- </head>
454
- <!-- the rest of your HTML... -->
455
- </html>
456
- ```
457
-
458
- ### Custom Plugins
459
-
460
- Any JS file or module which exports a valid bundler plugin object (essentially an object with a `name` and `setup` field) can be placed inside the plugins array:
461
-
462
- ```toml title="bunfig.toml" icon="settings"
463
- [serve.static]
464
- plugins = ["./my-plugin-implementation.ts"]
465
- ```
466
-
467
- ```ts title="my-plugin-implementation.ts" icon="/icons/typescript.svg"
468
- import type { BunPlugin } from "bun";
469
-
470
- const myPlugin: BunPlugin = {
471
- name: "my-custom-plugin",
472
- setup(build) {
473
- // Plugin implementation
474
- build.onLoad({ filter: /\.custom$/ }, async args => {
475
- const text = await Bun.file(args.path).text();
476
- return {
477
- contents: `export default ${JSON.stringify(text)};`,
478
- loader: "js",
479
- };
480
- });
481
- },
482
- };
483
-
484
- export default myPlugin;
485
- ```
486
-
487
- Bun will lazily resolve and load each plugin and use them to bundle your routes.
488
-
489
- <Note>
490
- This is currently in `bunfig.toml` to make it possible to know statically which plugins are in use when we eventually
491
- integrate this with the `bun build` CLI. These plugins work in `Bun.build()`'s JS API, but are not yet supported in
492
- the CLI.
493
- </Note>
494
-
495
- ## Inline Environment Variables
496
-
497
- Bun can replace `process.env.*` references in your frontend JavaScript and TypeScript with their actual values at build time. Configure the `env` option in your `bunfig.toml`:
498
-
499
- ```toml title="bunfig.toml" icon="settings"
500
- [serve.static]
501
- env = "PUBLIC_*" # only inline env vars starting with PUBLIC_ (recommended)
502
- # env = "inline" # inline all environment variables
503
- # env = "disable" # disable env var replacement (default)
504
- ```
505
-
506
- <Note>
507
- This only works with literal `process.env.FOO` references, not `import.meta.env` or indirect access like `const env =
508
- process.env; env.FOO`.
509
-
510
- If an environment variable is not set, you may see runtime errors like `ReferenceError: process
511
- is not defined` in the browser.
512
-
513
- </Note>
514
-
515
- See the [HTML & static sites documentation](/docs/bundler/html-static#inline-environment-variables) for more details on build-time configuration and examples.
516
-
517
- ## How It Works
518
-
519
- Bun uses `HTMLRewriter` to scan for `<script>` and `<link>` tags in HTML files, uses them as entrypoints for Bun's bundler, generates an optimized bundle for the JavaScript/TypeScript/TSX/JSX and CSS files, and serves the result.
520
-
521
- ### Processing Pipeline
522
-
523
- <Steps>
524
- <Step title="1. <script> Processing">
525
- - Transpiles TypeScript, JSX, and TSX in `<script>` tags
526
- - Bundles imported dependencies
527
- - Generates sourcemaps for debugging
528
- - Minifies when `development` is not `true` in `Bun.serve()`
529
-
530
- ```html title="index.html" icon="file-code"
531
- <script type="module" src="./counter.tsx"></script>
532
- ```
533
-
534
- </Step>
535
- <Step title="2. <link> Processing">
536
- - Processes CSS imports and `<link>` tags
537
- - Concatenates CSS files
538
- - Rewrites url and asset paths to include content-addressable hashes in URLs
539
-
540
- ```html title="index.html" icon="file-code"
541
- <link rel="stylesheet" href="./styles.css" />
542
- ```
543
-
544
- </Step>
545
- <Step title="3. <img> & Asset Processing">
546
- - Links to assets are rewritten to include content-addressable hashes in URLs
547
- - Small assets in CSS files are inlined into `data:` URLs, reducing the total number of HTTP requests sent over the wire
548
- </Step>
549
- <Step title="4. HTML Rewriting">
550
- - Combines all `<script>` tags into a single `<script>` tag with a content-addressable hash in the URL
551
- - Combines all `<link>` tags into a single `<link>` tag with a content-addressable hash in the URL
552
- - Outputs a new HTML file
553
- </Step>
554
- <Step title="5. Serving">
555
- - All the output files from the bundler are exposed as static routes, using the same mechanism internally as when you pass a Response object to `static` in `Bun.serve()`.
556
- - This works similarly to how `Bun.build` processes HTML files.
557
- </Step>
558
- </Steps>
559
-
560
- ## Complete Example
561
-
562
- Here's a complete fullstack application example:
563
-
564
- ```ts title="server.ts" icon="/icons/typescript.svg"
565
- import { serve } from "bun";
566
- import { Database } from "bun:sqlite";
567
- import homepage from "./public/index.html";
568
- import dashboard from "./public/dashboard.html";
569
-
570
- // Initialize database
571
- const db = new Database("app.db");
572
- db.exec(`
573
- CREATE TABLE IF NOT EXISTS users (
574
- id INTEGER PRIMARY KEY AUTOINCREMENT,
575
- name TEXT NOT NULL,
576
- email TEXT UNIQUE NOT NULL,
577
- created_at DATETIME DEFAULT CURRENT_TIMESTAMP
578
- )
579
- `);
580
-
581
- const server = serve({
582
- routes: {
583
- // Frontend routes
584
- "/": homepage,
585
- "/dashboard": dashboard,
586
-
587
- // API routes
588
- "/api/users": {
589
- async GET() {
590
- const users = db.query("SELECT * FROM users").all();
591
- return Response.json(users);
592
- },
593
-
594
- async POST(req) {
595
- const { name, email } = await req.json();
596
-
597
- try {
598
- const result = db.query("INSERT INTO users (name, email) VALUES (?, ?) RETURNING *").get(name, email);
599
-
600
- return Response.json(result, { status: 201 });
601
- } catch (error) {
602
- return Response.json({ error: "Email already exists" }, { status: 400 });
603
- }
604
- },
605
- },
606
-
607
- "/api/users/:id": {
608
- async GET(req) {
609
- const { id } = req.params;
610
- const user = db.query("SELECT * FROM users WHERE id = ?").get(id);
611
-
612
- if (!user) {
613
- return Response.json({ error: "User not found" }, { status: 404 });
614
- }
615
-
616
- return Response.json(user);
617
- },
618
-
619
- async DELETE(req) {
620
- const { id } = req.params;
621
- const result = db.query("DELETE FROM users WHERE id = ?").run(id);
622
-
623
- if (result.changes === 0) {
624
- return Response.json({ error: "User not found" }, { status: 404 });
625
- }
626
-
627
- return new Response(null, { status: 204 });
628
- },
629
- },
630
-
631
- // Health check endpoint
632
- "/api/health": {
633
- GET() {
634
- return Response.json({
635
- status: "ok",
636
- timestamp: new Date().toISOString(),
637
- });
638
- },
639
- },
640
- },
641
-
642
- // Enable development mode
643
- development: {
644
- hmr: true,
645
- console: true,
646
- },
647
-
648
- // Fallback for unmatched routes
649
- fetch(req) {
650
- return new Response("Not Found", { status: 404 });
651
- },
652
- });
653
-
654
- console.log(`🚀 Server running on ${server.url}`);
655
- ```
656
-
657
- ```html title="public/index.html" icon="file-code"
658
- <!DOCTYPE html>
659
- <html>
660
- <head>
661
- <meta charset="utf-8" />
662
- <meta name="viewport" content="width=device-width, initial-scale=1" />
663
- <title>Fullstack Bun App</title>
664
- <link rel="stylesheet" href="../src/styles.css" />
665
- </head>
666
- <body>
667
- <div id="root"></div>
668
- <script type="module" src="../src/main.tsx"></script>
669
- </body>
670
- </html>
671
- ```
672
-
673
- ```tsx title="src/main.tsx"
674
- import { createRoot } from "react-dom/client";
675
- import { App } from "./App";
676
-
677
- const container = document.getElementById("root")!;
678
- const root = createRoot(container);
679
- root.render(<App />);
680
- ```
681
-
682
- ```tsx title="src/App.tsx"
683
- import { useState, useEffect } from "react";
684
-
685
- interface User {
686
- id: number;
687
- name: string;
688
- email: string;
689
- created_at: string;
690
- }
691
-
692
- export function App() {
693
- const [users, setUsers] = useState<User[]>([]);
694
- const [name, setName] = useState("");
695
- const [email, setEmail] = useState("");
696
- const [loading, setLoading] = useState(false);
697
-
698
- const fetchUsers = async () => {
699
- const response = await fetch("/api/users");
700
- const data = await response.json();
701
- setUsers(data);
702
- };
703
-
704
- const createUser = async (e: React.FormEvent) => {
705
- e.preventDefault();
706
- setLoading(true);
707
-
708
- try {
709
- const response = await fetch("/api/users", {
710
- method: "POST",
711
- headers: { "Content-Type": "application/json" },
712
- body: JSON.stringify({ name, email }),
713
- });
714
-
715
- if (response.ok) {
716
- setName("");
717
- setEmail("");
718
- await fetchUsers();
719
- } else {
720
- const error = await response.json();
721
- alert(error.error);
722
- }
723
- } catch (error) {
724
- alert("Failed to create user");
725
- } finally {
726
- setLoading(false);
727
- }
728
- };
729
-
730
- const deleteUser = async (id: number) => {
731
- if (!confirm("Are you sure?")) return;
732
-
733
- try {
734
- const response = await fetch(`/api/users/${id}`, {
735
- method: "DELETE",
736
- });
737
-
738
- if (response.ok) {
739
- await fetchUsers();
740
- }
741
- } catch (error) {
742
- alert("Failed to delete user");
743
- }
744
- };
745
-
746
- useEffect(() => {
747
- fetchUsers();
748
- }, []);
749
-
750
- return (
751
- <div className="container">
752
- <h1>User Management</h1>
753
-
754
- <form onSubmit={createUser} className="form">
755
- <input type="text" placeholder="Name" value={name} onChange={e => setName(e.target.value)} required />
756
- <input type="email" placeholder="Email" value={email} onChange={e => setEmail(e.target.value)} required />
757
- <button type="submit" disabled={loading}>
758
- {loading ? "Creating..." : "Create User"}
759
- </button>
760
- </form>
761
-
762
- <div className="users">
763
- <h2>Users ({users.length})</h2>
764
- {users.map(user => (
765
- <div key={user.id} className="user-card">
766
- <div>
767
- <strong>{user.name}</strong>
768
- <br />
769
- <span>{user.email}</span>
770
- </div>
771
- <button onClick={() => deleteUser(user.id)} className="delete-btn">
772
- Delete
773
- </button>
774
- </div>
775
- ))}
776
- </div>
777
- </div>
778
- );
779
- }
780
- ```
781
-
782
- ```css title="src/styles.css" icon="file-code"
783
- * {
784
- margin: 0;
785
- padding: 0;
786
- box-sizing: border-box;
787
- }
788
-
789
- body {
790
- font-family: -apple-system, BlinkMacSystemFont, sans-serif;
791
- background: #f5f5f5;
792
- color: #333;
793
- }
794
-
795
- .container {
796
- max-width: 800px;
797
- margin: 0 auto;
798
- padding: 2rem;
799
- }
800
-
801
- h1 {
802
- color: #2563eb;
803
- margin-bottom: 2rem;
804
- }
805
-
806
- .form {
807
- background: white;
808
- padding: 1.5rem;
809
- border-radius: 8px;
810
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
811
- margin-bottom: 2rem;
812
- display: flex;
813
- gap: 1rem;
814
- flex-wrap: wrap;
815
- }
816
-
817
- .form input {
818
- flex: 1;
819
- min-width: 200px;
820
- padding: 0.75rem;
821
- border: 1px solid #ddd;
822
- border-radius: 4px;
823
- }
824
-
825
- .form button {
826
- padding: 0.75rem 1.5rem;
827
- background: #2563eb;
828
- color: white;
829
- border: none;
830
- border-radius: 4px;
831
- cursor: pointer;
832
- }
833
-
834
- .form button:hover {
835
- background: #1d4ed8;
836
- }
837
-
838
- .form button:disabled {
839
- opacity: 0.5;
840
- cursor: not-allowed;
841
- }
842
-
843
- .users {
844
- background: white;
845
- padding: 1.5rem;
846
- border-radius: 8px;
847
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
848
- }
849
-
850
- .user-card {
851
- display: flex;
852
- justify-content: space-between;
853
- align-items: center;
854
- padding: 1rem;
855
- border-bottom: 1px solid #eee;
856
- }
857
-
858
- .user-card:last-child {
859
- border-bottom: none;
860
- }
861
-
862
- .delete-btn {
863
- padding: 0.5rem 1rem;
864
- background: #dc2626;
865
- color: white;
866
- border: none;
867
- border-radius: 4px;
868
- cursor: pointer;
869
- }
870
-
871
- .delete-btn:hover {
872
- background: #b91c1c;
873
- }
874
- ```
875
-
876
- ## Best Practices
877
-
878
- ### Project Structure
879
-
880
- ```
881
- my-app/
882
- ├── src/
883
- │ ├── components/
884
- │ │ ├── Header.tsx
885
- │ │ └── UserList.tsx
886
- │ ├── styles/
887
- │ │ ├── globals.css
888
- │ │ └── components.css
889
- │ ├── utils/
890
- │ │ └── api.ts
891
- │ ├── App.tsx
892
- │ └── main.tsx
893
- ├── public/
894
- │ ├── index.html
895
- │ ├── dashboard.html
896
- │ └── favicon.ico
897
- ├── server/
898
- │ ├── routes/
899
- │ │ ├── users.ts
900
- │ │ └── auth.ts
901
- │ ├── db/
902
- │ │ └── schema.sql
903
- │ └── index.ts
904
- ├── bunfig.toml
905
- └── package.json
906
- ```
907
-
908
- ### Environment-Based Configuration
909
-
910
- ```ts title="server/config.ts" icon="/icons/typescript.svg"
911
- export const config = {
912
- development: process.env.NODE_ENV !== "production",
913
- port: process.env.PORT || 3000,
914
- database: {
915
- url: process.env.DATABASE_URL || "./dev.db",
916
- },
917
- cors: {
918
- origin: process.env.CORS_ORIGIN || "*",
919
- },
920
- };
921
- ```
922
-
923
- ### Error Handling
924
-
925
- ```ts title="server/middleware.ts" icon="/icons/typescript.svg"
926
- export function errorHandler(error: Error, req: Request) {
927
- console.error("Server error:", error);
928
-
929
- if (process.env.NODE_ENV === "production") {
930
- return Response.json({ error: "Internal server error" }, { status: 500 });
931
- }
932
-
933
- return Response.json(
934
- {
935
- error: error.message,
936
- stack: error.stack,
937
- },
938
- { status: 500 },
939
- );
940
- }
941
- ```
942
-
943
- ### API Response Helpers
944
-
945
- ```ts title="server/utils.ts" icon="/icons/typescript.svg"
946
- export function json(data: any, status = 200) {
947
- return Response.json(data, { status });
948
- }
949
-
950
- export function error(message: string, status = 400) {
951
- return Response.json({ error: message }, { status });
952
- }
953
-
954
- export function notFound(message = "Not found") {
955
- return error(message, 404);
956
- }
957
-
958
- export function unauthorized(message = "Unauthorized") {
959
- return error(message, 401);
960
- }
961
- ```
962
-
963
- ### Type Safety
964
-
965
- ```ts title="types/api.ts" icon="/icons/typescript.svg"
966
- export interface User {
967
- id: number;
968
- name: string;
969
- email: string;
970
- created_at: string;
971
- }
972
-
973
- export interface CreateUserRequest {
974
- name: string;
975
- email: string;
976
- }
977
-
978
- export interface ApiResponse<T> {
979
- data?: T;
980
- error?: string;
981
- }
982
- ```
983
-
984
- ## Deployment
985
-
986
- ### Production Build
987
-
988
- ```bash terminal icon="terminal"
989
- # Build for production
990
- bun build --target=bun --production --outdir=dist ./server/index.ts
991
-
992
- # Run production server
993
- NODE_ENV=production bun dist/index.js
994
- ```
995
-
996
- ### Docker Deployment
997
-
998
- ```dockerfile title="Dockerfile" icon="docker"
999
- FROM oven/bun:1 as base
1000
- WORKDIR /usr/src/app
1001
-
1002
- # Install dependencies
1003
- COPY package.json bun.lockb ./
1004
- RUN bun install --frozen-lockfile
1005
-
1006
- # Copy source code
1007
- COPY . .
1008
-
1009
- # Build application
1010
- RUN bun build --target=bun --production --outdir=dist ./server/index.ts
1011
-
1012
- # Production stage
1013
- FROM oven/bun:1-slim
1014
- WORKDIR /usr/src/app
1015
- COPY --from=base /usr/src/app/dist ./
1016
- COPY --from=base /usr/src/app/public ./public
1017
-
1018
- EXPOSE 3000
1019
- CMD ["bun", "index.js"]
1020
- ```
1021
-
1022
- ### Environment Variables
1023
-
1024
- ```ini title=".env.production" icon="file-code"
1025
- NODE_ENV=production
1026
- PORT=3000
1027
- DATABASE_URL=postgresql://user:pass@localhost:5432/myapp
1028
- CORS_ORIGIN=https://myapp.com
1029
- ```
1030
-
1031
- ## Migration from Other Frameworks
1032
-
1033
- ### From Express + Webpack
1034
-
1035
- ```ts title="server.ts" icon="/icons/typescript.svg"
1036
- // Before (Express + Webpack)
1037
- app.use(express.static("dist"));
1038
- app.get("/api/users", (req, res) => {
1039
- res.json(users);
1040
- });
1041
-
1042
- // After (Bun fullstack)
1043
- serve({
1044
- routes: {
1045
- "/": homepage, // Replaces express.static
1046
- "/api/users": {
1047
- GET() {
1048
- return Response.json(users);
1049
- },
1050
- },
1051
- },
1052
- });
1053
- ```
1054
-
1055
- ### From Next.js API Routes
1056
-
1057
- ```ts title="server.ts" icon="/icons/typescript.svg"
1058
- // Before (Next.js)
1059
- export default function handler(req, res) {
1060
- if (req.method === 'GET') {
1061
- res.json(users);
1062
- }
1063
- }
1064
-
1065
- // After (Bun)
1066
- "/api/users": {
1067
- GET() { return Response.json(users); }
1068
- }
1069
- ```
1070
-
1071
- ## Limitations and Future Plans
1072
-
1073
- ### Current Limitations
1074
-
1075
- - `bun build` CLI integration is not yet available for fullstack apps
1076
- - Auto-discovery of API routes is not implemented
1077
- - Server-side rendering (SSR) is not built-in
1078
-
1079
- ### Planned Features
1080
-
1081
- - Integration with `bun build` CLI
1082
- - File-based routing for API endpoints
1083
- - Built-in SSR support
1084
- - Enhanced plugin ecosystem
1085
-
1086
- <Note>This is a work in progress. Features and APIs may change as Bun continues to evolve.</Note>