bun-types 1.3.2-canary.20251106T140813 → 1.3.2-canary.20251108T140624
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.
- package/bun.d.ts +102 -6
- package/docs/bundler/bytecode.mdx +465 -0
- package/docs/bundler/css.mdx +1024 -0
- package/docs/bundler/esbuild.mdx +253 -0
- package/docs/bundler/executables.mdx +535 -0
- package/docs/bundler/fullstack.mdx +1064 -0
- package/docs/bundler/hot-reloading.mdx +229 -0
- package/docs/bundler/html-static.mdx +386 -0
- package/docs/bundler/index.mdx +1499 -0
- package/docs/bundler/loaders.mdx +356 -0
- package/docs/bundler/macros.mdx +328 -0
- package/docs/bundler/minifier.mdx +1306 -0
- package/docs/bundler/plugins.mdx +411 -0
- package/docs/feedback.mdx +85 -0
- package/docs/guides/binary/arraybuffer-to-array.mdx +29 -0
- package/docs/guides/binary/arraybuffer-to-blob.mdx +26 -0
- package/docs/guides/binary/arraybuffer-to-buffer.mdx +27 -0
- package/docs/guides/binary/arraybuffer-to-string.mdx +17 -0
- package/docs/guides/binary/arraybuffer-to-typedarray.mdx +41 -0
- package/docs/guides/binary/blob-to-arraybuffer.mdx +16 -0
- package/docs/guides/binary/blob-to-dataview.mdx +16 -0
- package/docs/guides/binary/blob-to-stream.mdx +16 -0
- package/docs/guides/binary/blob-to-string.mdx +17 -0
- package/docs/guides/binary/blob-to-typedarray.mdx +16 -0
- package/docs/guides/binary/buffer-to-arraybuffer.mdx +16 -0
- package/docs/guides/binary/buffer-to-blob.mdx +16 -0
- package/docs/guides/binary/buffer-to-readablestream.mdx +43 -0
- package/docs/guides/binary/buffer-to-string.mdx +27 -0
- package/docs/guides/binary/buffer-to-typedarray.mdx +16 -0
- package/docs/guides/binary/dataview-to-string.mdx +17 -0
- package/docs/guides/binary/typedarray-to-arraybuffer.mdx +27 -0
- package/docs/guides/binary/typedarray-to-blob.mdx +18 -0
- package/docs/guides/binary/typedarray-to-buffer.mdx +16 -0
- package/docs/guides/binary/typedarray-to-dataview.mdx +16 -0
- package/docs/guides/binary/typedarray-to-readablestream.mdx +43 -0
- package/docs/guides/binary/typedarray-to-string.mdx +18 -0
- package/docs/guides/deployment/aws-lambda.mdx +204 -0
- package/docs/guides/deployment/digital-ocean.mdx +161 -0
- package/docs/guides/deployment/google-cloud-run.mdx +197 -0
- package/docs/guides/deployment/railway.mdx +145 -0
- package/docs/guides/deployment/render.mdx +82 -0
- package/docs/guides/deployment/vercel.mdx +99 -0
- package/docs/guides/ecosystem/astro.mdx +82 -0
- package/docs/guides/ecosystem/discordjs.mdx +80 -0
- package/docs/guides/ecosystem/docker.mdx +151 -0
- package/docs/guides/ecosystem/drizzle.mdx +195 -0
- package/docs/guides/ecosystem/edgedb.mdx +257 -0
- package/docs/guides/ecosystem/elysia.mdx +31 -0
- package/docs/guides/ecosystem/express.mdx +43 -0
- package/docs/guides/ecosystem/hono.mdx +47 -0
- package/docs/guides/ecosystem/mongoose.mdx +92 -0
- package/docs/guides/ecosystem/neon-drizzle.mdx +234 -0
- package/docs/guides/ecosystem/neon-serverless-postgres.mdx +60 -0
- package/docs/guides/ecosystem/nextjs.mdx +57 -0
- package/docs/guides/ecosystem/nuxt.mdx +90 -0
- package/docs/guides/ecosystem/pm2.mdx +55 -0
- package/docs/guides/ecosystem/prisma-postgres.mdx +169 -0
- package/docs/guides/ecosystem/prisma.mdx +164 -0
- package/docs/guides/ecosystem/qwik.mdx +114 -0
- package/docs/guides/ecosystem/react.mdx +52 -0
- package/docs/guides/ecosystem/remix.mdx +97 -0
- package/docs/guides/ecosystem/sentry.mdx +54 -0
- package/docs/guides/ecosystem/solidstart.mdx +66 -0
- package/docs/guides/ecosystem/ssr-react.mdx +49 -0
- package/docs/guides/ecosystem/stric.mdx +54 -0
- package/docs/guides/ecosystem/sveltekit.mdx +138 -0
- package/docs/guides/ecosystem/systemd.mdx +114 -0
- package/docs/guides/ecosystem/upstash.mdx +87 -0
- package/docs/guides/ecosystem/vite.mdx +77 -0
- package/docs/guides/html-rewriter/extract-links.mdx +72 -0
- package/docs/guides/html-rewriter/extract-social-meta.mdx +97 -0
- package/docs/guides/http/cluster.mdx +69 -0
- package/docs/guides/http/fetch-unix.mdx +35 -0
- package/docs/guides/http/fetch.mdx +26 -0
- package/docs/guides/http/file-uploads.mdx +97 -0
- package/docs/guides/http/hot.mdx +28 -0
- package/docs/guides/http/proxy.mdx +26 -0
- package/docs/guides/http/server.mdx +48 -0
- package/docs/guides/http/simple.mdx +20 -0
- package/docs/guides/http/stream-file.mdx +50 -0
- package/docs/guides/http/stream-iterator.mdx +49 -0
- package/docs/guides/http/stream-node-streams-in-bun.mdx +22 -0
- package/docs/guides/http/tls.mdx +32 -0
- package/docs/guides/index.mdx +10 -0
- package/docs/guides/install/add-dev.mdx +28 -0
- package/docs/guides/install/add-git.mdx +38 -0
- package/docs/guides/install/add-optional.mdx +27 -0
- package/docs/guides/install/add-peer.mdx +45 -0
- package/docs/guides/install/add-tarball.mdx +35 -0
- package/docs/guides/install/add.mdx +44 -0
- package/docs/guides/install/azure-artifacts.mdx +76 -0
- package/docs/guides/install/cicd.mdx +43 -0
- package/docs/guides/install/custom-registry.mdx +32 -0
- package/docs/guides/install/from-npm-install-to-bun-install.mdx +230 -0
- package/docs/guides/install/git-diff-bun-lockfile.mdx +47 -0
- package/docs/guides/install/jfrog-artifactory.mdx +28 -0
- package/docs/guides/install/npm-alias.mdx +25 -0
- package/docs/guides/install/registry-scope.mdx +40 -0
- package/docs/guides/install/trusted.mdx +50 -0
- package/docs/guides/install/workspaces.mdx +70 -0
- package/docs/guides/install/yarnlock.mdx +50 -0
- package/docs/guides/process/argv.mdx +66 -0
- package/docs/guides/process/ctrl-c.mdx +18 -0
- package/docs/guides/process/ipc.mdx +69 -0
- package/docs/guides/process/nanoseconds.mdx +15 -0
- package/docs/guides/process/os-signals.mdx +41 -0
- package/docs/guides/process/spawn-stderr.mdx +34 -0
- package/docs/guides/process/spawn-stdout.mdx +28 -0
- package/docs/guides/process/spawn.mdx +43 -0
- package/docs/guides/process/stdin.mdx +62 -0
- package/docs/guides/read-file/arraybuffer.mdx +30 -0
- package/docs/guides/read-file/buffer.mdx +21 -0
- package/docs/guides/read-file/exists.mdx +18 -0
- package/docs/guides/read-file/json.mdx +19 -0
- package/docs/guides/read-file/mime.mdx +22 -0
- package/docs/guides/read-file/stream.mdx +28 -0
- package/docs/guides/read-file/string.mdx +24 -0
- package/docs/guides/read-file/uint8array.mdx +23 -0
- package/docs/guides/read-file/watch.mdx +66 -0
- package/docs/guides/runtime/build-time-constants.mdx +295 -0
- package/docs/guides/runtime/cicd.mdx +45 -0
- package/docs/guides/runtime/codesign-macos-executable.mdx +61 -0
- package/docs/guides/runtime/define-constant.mdx +149 -0
- package/docs/guides/runtime/delete-directory.mdx +39 -0
- package/docs/guides/runtime/delete-file.mdx +21 -0
- package/docs/guides/runtime/heap-snapshot.mdx +28 -0
- package/docs/guides/runtime/import-html.mdx +17 -0
- package/docs/guides/runtime/import-json.mdx +46 -0
- package/docs/guides/runtime/import-toml.mdx +32 -0
- package/docs/guides/runtime/import-yaml.mdx +104 -0
- package/docs/guides/runtime/read-env.mdx +37 -0
- package/docs/guides/runtime/set-env.mdx +51 -0
- package/docs/guides/runtime/shell.mdx +42 -0
- package/docs/guides/runtime/timezone.mdx +38 -0
- package/docs/guides/runtime/tsconfig-paths.mdx +31 -0
- package/docs/guides/runtime/typescript.mdx +51 -0
- package/docs/guides/runtime/vscode-debugger.mdx +48 -0
- package/docs/guides/runtime/web-debugger.mdx +103 -0
- package/docs/guides/streams/node-readable-to-arraybuffer.mdx +13 -0
- package/docs/guides/streams/node-readable-to-blob.mdx +13 -0
- package/docs/guides/streams/node-readable-to-json.mdx +14 -0
- package/docs/guides/streams/node-readable-to-string.mdx +14 -0
- package/docs/guides/streams/node-readable-to-uint8array.mdx +13 -0
- package/docs/guides/streams/to-array.mdx +16 -0
- package/docs/guides/streams/to-arraybuffer.mdx +16 -0
- package/docs/guides/streams/to-blob.mdx +16 -0
- package/docs/guides/streams/to-buffer.mdx +17 -0
- package/docs/guides/streams/to-json.mdx +16 -0
- package/docs/guides/streams/to-string.mdx +16 -0
- package/docs/guides/streams/to-typedarray.mdx +24 -0
- package/docs/guides/test/bail.mdx +24 -0
- package/docs/guides/test/coverage-threshold.mdx +67 -0
- package/docs/guides/test/coverage.mdx +49 -0
- package/docs/guides/test/happy-dom.mdx +73 -0
- package/docs/guides/test/migrate-from-jest.mdx +125 -0
- package/docs/guides/test/mock-clock.mdx +50 -0
- package/docs/guides/test/mock-functions.mdx +70 -0
- package/docs/guides/test/rerun-each.mdx +16 -0
- package/docs/guides/test/run-tests.mdx +116 -0
- package/docs/guides/test/skip-tests.mdx +43 -0
- package/docs/guides/test/snapshot.mdx +102 -0
- package/docs/guides/test/spy-on.mdx +49 -0
- package/docs/guides/test/svelte-test.mdx +113 -0
- package/docs/guides/test/testing-library.mdx +93 -0
- package/docs/guides/test/timeout.mdx +17 -0
- package/docs/guides/test/todo-tests.mdx +74 -0
- package/docs/guides/test/update-snapshots.mdx +49 -0
- package/docs/guides/test/watch-mode.mdx +24 -0
- package/docs/guides/util/base64.mdx +17 -0
- package/docs/guides/util/deep-equals.mdx +41 -0
- package/docs/guides/util/deflate.mdx +20 -0
- package/docs/guides/util/detect-bun.mdx +25 -0
- package/docs/guides/util/entrypoint.mdx +19 -0
- package/docs/guides/util/escape-html.mdx +24 -0
- package/docs/guides/util/file-url-to-path.mdx +16 -0
- package/docs/guides/util/gzip.mdx +20 -0
- package/docs/guides/util/hash-a-password.mdx +56 -0
- package/docs/guides/util/import-meta-dir.mdx +15 -0
- package/docs/guides/util/import-meta-file.mdx +15 -0
- package/docs/guides/util/import-meta-path.mdx +15 -0
- package/docs/guides/util/javascript-uuid.mdx +25 -0
- package/docs/guides/util/main.mdx +43 -0
- package/docs/guides/util/path-to-file-url.mdx +16 -0
- package/docs/guides/util/sleep.mdx +24 -0
- package/docs/guides/util/version.mdx +23 -0
- package/docs/guides/util/which-path-to-executable-bin.mdx +17 -0
- package/docs/guides/websocket/compression.mdx +33 -0
- package/docs/guides/websocket/context.mdx +74 -0
- package/docs/guides/websocket/pubsub.mdx +40 -0
- package/docs/guides/websocket/simple.mdx +35 -0
- package/docs/guides/write-file/append.mdx +54 -0
- package/docs/guides/write-file/basic.mdx +46 -0
- package/docs/guides/write-file/blob.mdx +30 -0
- package/docs/guides/write-file/cat.mdx +19 -0
- package/docs/guides/write-file/file-cp.mdx +18 -0
- package/docs/guides/write-file/filesink.mdx +54 -0
- package/docs/guides/write-file/response.mdx +19 -0
- package/docs/guides/write-file/stdout.mdx +23 -0
- package/docs/guides/write-file/stream.mdx +19 -0
- package/docs/guides/write-file/unlink.mdx +18 -0
- package/docs/index.mdx +133 -0
- package/docs/installation.mdx +365 -0
- package/docs/pm/bunx.mdx +83 -0
- package/docs/pm/catalogs.mdx +292 -0
- package/docs/pm/cli/add.mdx +179 -0
- package/docs/pm/cli/audit.mdx +60 -0
- package/docs/pm/cli/install.mdx +471 -0
- package/docs/pm/cli/link.mdx +48 -0
- package/docs/pm/cli/outdated.mdx +197 -0
- package/docs/pm/cli/patch.mdx +69 -0
- package/docs/pm/cli/pm.mdx +319 -0
- package/docs/pm/cli/publish.mdx +123 -0
- package/docs/pm/cli/remove.mdx +16 -0
- package/docs/pm/cli/update.mdx +140 -0
- package/docs/pm/cli/why.mdx +84 -0
- package/docs/pm/filter.mdx +102 -0
- package/docs/pm/global-cache.mdx +72 -0
- package/docs/pm/isolated-installs.mdx +205 -0
- package/docs/pm/lifecycle.mdx +57 -0
- package/docs/pm/lockfile.mdx +64 -0
- package/docs/pm/npmrc.mdx +111 -0
- package/docs/pm/overrides.mdx +83 -0
- package/docs/pm/scopes-registries.mdx +35 -0
- package/docs/pm/security-scanner-api.mdx +95 -0
- package/docs/pm/workspaces.mdx +109 -0
- package/docs/project/benchmarking.mdx +218 -0
- package/docs/project/bindgen.mdx +223 -0
- package/docs/project/building-windows.mdx +133 -0
- package/docs/project/contributing.mdx +343 -0
- package/docs/project/feedback.mdx +20 -0
- package/docs/project/license.mdx +78 -0
- package/docs/project/roadmap.mdx +8 -0
- package/docs/quickstart.mdx +240 -0
- package/docs/runtime/auto-install.mdx +97 -0
- package/docs/runtime/binary-data.mdx +846 -0
- package/docs/runtime/bun-apis.mdx +59 -0
- package/docs/runtime/bunfig.mdx +642 -0
- package/docs/runtime/c-compiler.mdx +204 -0
- package/docs/runtime/child-process.mdx +532 -0
- package/docs/runtime/color.mdx +267 -0
- package/docs/runtime/console.mdx +67 -0
- package/docs/runtime/cookies.mdx +454 -0
- package/docs/runtime/debugger.mdx +335 -0
- package/docs/runtime/environment-variables.mdx +214 -0
- package/docs/runtime/ffi.mdx +565 -0
- package/docs/runtime/file-io.mdx +306 -0
- package/docs/runtime/file-system-router.mdx +118 -0
- package/docs/runtime/file-types.mdx +354 -0
- package/docs/runtime/glob.mdx +181 -0
- package/docs/runtime/globals.mdx +72 -0
- package/docs/runtime/hashing.mdx +315 -0
- package/docs/runtime/html-rewriter.mdx +340 -0
- package/docs/runtime/http/cookies.mdx +79 -0
- package/docs/runtime/http/error-handling.mdx +40 -0
- package/docs/runtime/http/metrics.mdx +36 -0
- package/docs/runtime/http/routing.mdx +289 -0
- package/docs/runtime/http/server.mdx +647 -0
- package/docs/runtime/http/tls.mdx +101 -0
- package/docs/runtime/http/websockets.mdx +404 -0
- package/docs/runtime/index.mdx +223 -0
- package/docs/runtime/jsx.mdx +115 -0
- package/docs/runtime/module-resolution.mdx +342 -0
- package/docs/runtime/networking/dns.mdx +111 -0
- package/docs/runtime/networking/fetch.mdx +468 -0
- package/docs/runtime/networking/tcp.mdx +239 -0
- package/docs/runtime/networking/udp.mdx +129 -0
- package/docs/runtime/node-api.mdx +19 -0
- package/docs/runtime/nodejs-compat.mdx +468 -0
- package/docs/runtime/plugins.mdx +405 -0
- package/docs/runtime/redis.mdx +582 -0
- package/docs/runtime/s3.mdx +863 -0
- package/docs/runtime/secrets.mdx +336 -0
- package/docs/runtime/semver.mdx +57 -0
- package/docs/runtime/shell.mdx +637 -0
- package/docs/runtime/sql.mdx +1404 -0
- package/docs/runtime/sqlite.mdx +699 -0
- package/docs/runtime/streams.mdx +232 -0
- package/docs/runtime/templating/create.mdx +269 -0
- package/docs/runtime/templating/init.mdx +58 -0
- package/docs/runtime/transpiler.mdx +288 -0
- package/docs/runtime/typescript.mdx +58 -0
- package/docs/runtime/utils.mdx +922 -0
- package/docs/runtime/watch-mode.mdx +161 -0
- package/docs/runtime/web-apis.mdx +29 -0
- package/docs/runtime/workers.mdx +328 -0
- package/docs/runtime/yaml.mdx +469 -0
- package/docs/snippets/cli/add.mdx +166 -0
- package/docs/snippets/cli/build.mdx +196 -0
- package/docs/snippets/cli/feedback.mdx +17 -0
- package/docs/snippets/cli/init.mdx +84 -0
- package/docs/snippets/cli/install.mdx +173 -0
- package/docs/snippets/cli/link.mdx +163 -0
- package/docs/snippets/cli/outdated.mdx +140 -0
- package/docs/snippets/cli/patch.mdx +171 -0
- package/docs/snippets/cli/publish.mdx +198 -0
- package/docs/snippets/cli/remove.mdx +146 -0
- package/docs/snippets/cli/run.mdx +293 -0
- package/docs/snippets/cli/test.mdx +100 -0
- package/docs/snippets/cli/update.mdx +144 -0
- package/docs/snippets/product-card.mdx +32 -0
- package/docs/snippets/product-tiles.mdx +94 -0
- package/docs/test/code-coverage.mdx +409 -0
- package/docs/test/configuration.mdx +467 -0
- package/docs/test/dates-times.mdx +129 -0
- package/docs/test/discovery.mdx +90 -0
- package/docs/test/dom.mdx +226 -0
- package/docs/test/index.mdx +380 -0
- package/docs/test/lifecycle.mdx +348 -0
- package/docs/test/mocks.mdx +637 -0
- package/docs/test/reporters.mdx +117 -0
- package/docs/test/runtime-behavior.mdx +342 -0
- package/docs/test/snapshots.mdx +434 -0
- package/docs/test/writing-tests.mdx +635 -0
- package/docs/typescript.mdx +54 -0
- package/package.json +8 -6
- package/test.d.ts +2 -2
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Deploy a Bun application on DigitalOcean
|
|
3
|
+
sidebarTitle: Deploy on DigitalOcean
|
|
4
|
+
mode: center
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
[DigitalOcean](https://www.digitalocean.com/) is a cloud platform that provides a range of services for building and deploying applications.
|
|
8
|
+
|
|
9
|
+
In this guide, we will deploy a Bun HTTP server to DigitalOcean using a `Dockerfile`.
|
|
10
|
+
|
|
11
|
+
<Note>
|
|
12
|
+
Before continuing, make sure you have:
|
|
13
|
+
|
|
14
|
+
- A Bun application ready for deployment
|
|
15
|
+
- A [DigitalOcean account](https://www.digitalocean.com/)
|
|
16
|
+
- [DigitalOcean CLI](https://docs.digitalocean.com/reference/doctl/how-to/install/#step-1-install-doctl) installed and configured
|
|
17
|
+
- [Docker](https://docs.docker.com/get-started/get-docker/) installed and added to your `PATH`
|
|
18
|
+
|
|
19
|
+
</Note>
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
<Steps>
|
|
24
|
+
<Step title="Create a new DigitalOcean Container Registry">
|
|
25
|
+
Create a new Container Registry to store the Docker image.
|
|
26
|
+
|
|
27
|
+
<Tabs>
|
|
28
|
+
<Tab title="Through the DigitalOcean dashboard">
|
|
29
|
+
In the DigitalOcean dashboard, go to [**Container Registry**](https://cloud.digitalocean.com/registry), and enter the details for the new registry.
|
|
30
|
+
|
|
31
|
+
<Frame>
|
|
32
|
+

|
|
33
|
+
</Frame>
|
|
34
|
+
|
|
35
|
+
Make sure the details are correct, then click **Create Registry**.
|
|
36
|
+
</Tab>
|
|
37
|
+
<Tab title="Through the DigitalOcean CLI">
|
|
38
|
+
|
|
39
|
+
```bash terminal icon="terminal"
|
|
40
|
+
doctl registry create bun-digitalocean-demo
|
|
41
|
+
```
|
|
42
|
+
```txt
|
|
43
|
+
Name Endpoint Region slug
|
|
44
|
+
bun-digitalocean-demo registry.digitalocean.com/bun-digitalocean-demo sfo2
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
</Tab>
|
|
48
|
+
</Tabs>
|
|
49
|
+
|
|
50
|
+
You should see the new registry in the [**DigitalOcean registry dashboard**](https://cloud.digitalocean.com/registry):
|
|
51
|
+
|
|
52
|
+
<Frame>
|
|
53
|
+

|
|
54
|
+
</Frame>
|
|
55
|
+
</Step>
|
|
56
|
+
<Step title="Create a new Dockerfile">
|
|
57
|
+
Make sure you're in the directory containing your project, then create a new `Dockerfile` in the root of your project. This file contains the instructions to initialize the container, copy your local project files into it, install dependencies, and start the application.
|
|
58
|
+
|
|
59
|
+
```docker Dockerfile icon="docker"
|
|
60
|
+
# Use the official Bun image to run the application
|
|
61
|
+
FROM oven/bun:debian
|
|
62
|
+
|
|
63
|
+
# Set the work directory to `/app`
|
|
64
|
+
WORKDIR /app
|
|
65
|
+
|
|
66
|
+
# Copy the package.json and bun.lock into the container
|
|
67
|
+
COPY package.json bun.lock ./
|
|
68
|
+
|
|
69
|
+
# Install the dependencies
|
|
70
|
+
RUN bun install --production --frozen-lockfile
|
|
71
|
+
|
|
72
|
+
# Copy the rest of the application into the container
|
|
73
|
+
COPY . .
|
|
74
|
+
|
|
75
|
+
# Expose the port (DigitalOcean will set PORT env var)
|
|
76
|
+
EXPOSE 8080
|
|
77
|
+
|
|
78
|
+
# Run the application
|
|
79
|
+
CMD ["bun", "index.ts"]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
<Note>
|
|
83
|
+
Make sure that the start command corresponds to your application's entry point. This can also be `CMD ["bun", "run", "start"]` if you have a start script in your `package.json`.
|
|
84
|
+
|
|
85
|
+
This image installs dependencies and runs your app with Bun inside a container. If your app doesn't have dependencies, you can omit the `RUN bun install --production --frozen-lockfile` line.
|
|
86
|
+
</Note>
|
|
87
|
+
|
|
88
|
+
Create a new `.dockerignore` file in the root of your project. This file contains the files and directories that should be _excluded_ from the container image, such as `node_modules`. This makes your builds faster and smaller:
|
|
89
|
+
|
|
90
|
+
```docker .dockerignore icon="Docker"
|
|
91
|
+
node_modules
|
|
92
|
+
Dockerfile*
|
|
93
|
+
.dockerignore
|
|
94
|
+
.git
|
|
95
|
+
.gitignore
|
|
96
|
+
README.md
|
|
97
|
+
LICENSE
|
|
98
|
+
.vscode
|
|
99
|
+
.env
|
|
100
|
+
# Any other files or directories you want to exclude
|
|
101
|
+
```
|
|
102
|
+
</Step>
|
|
103
|
+
<Step title="Authenticate Docker with DigitalOcean registry">
|
|
104
|
+
Before building and pushing the Docker image, authenticate Docker with the DigitalOcean Container Registry:
|
|
105
|
+
|
|
106
|
+
```bash terminal icon="terminal"
|
|
107
|
+
doctl registry login
|
|
108
|
+
```
|
|
109
|
+
```txt
|
|
110
|
+
Successfully authenticated with registry.digitalocean.com
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
<Note>
|
|
114
|
+
This command authenticates Docker with DigitalOcean's registry using your DigitalOcean credentials. Without this step, the build and push command will fail with a 401 authentication error.
|
|
115
|
+
</Note>
|
|
116
|
+
</Step>
|
|
117
|
+
<Step title="Build and push the Docker image to the DigitalOcean registry">
|
|
118
|
+
Make sure you're in the directory containing your `Dockerfile`, then build and push the Docker image to the DigitalOcean registry in one command:
|
|
119
|
+
|
|
120
|
+
```bash terminal icon="terminal"
|
|
121
|
+
docker buildx build --platform=linux/amd64 -t registry.digitalocean.com/bun-digitalocean-demo/bun-digitalocean-demo:latest --push .
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
<Note>
|
|
125
|
+
If you're building on an ARM Mac (M1/M2), you must use `docker buildx` with `--platform=linux/amd64` to ensure compatibility with DigitalOcean's infrastructure. Using `docker build` without the platform flag will create an ARM64 image that won't run on DigitalOcean.
|
|
126
|
+
</Note>
|
|
127
|
+
|
|
128
|
+
Once the image is pushed, you should see it in the [**DigitalOcean registry dashboard**](https://cloud.digitalocean.com/registry):
|
|
129
|
+
|
|
130
|
+
<Frame>
|
|
131
|
+

|
|
132
|
+
</Frame>
|
|
133
|
+
</Step>
|
|
134
|
+
<Step title="Create a new DigitalOcean App Platform project">
|
|
135
|
+
In the DigitalOcean dashboard, go to [**App Platform**](https://cloud.digitalocean.com/apps) > **Create App**. We can create a project directly from the container image.
|
|
136
|
+
|
|
137
|
+
<Frame>
|
|
138
|
+

|
|
139
|
+
</Frame>
|
|
140
|
+
|
|
141
|
+
Make sure the details are correct, then click **Next**.
|
|
142
|
+
|
|
143
|
+
<Frame>
|
|
144
|
+

|
|
145
|
+
</Frame>
|
|
146
|
+
|
|
147
|
+
Review and configure resource settings, then click **Create app**.
|
|
148
|
+
|
|
149
|
+
<Frame>
|
|
150
|
+

|
|
151
|
+
</Frame>
|
|
152
|
+
</Step>
|
|
153
|
+
<Step title="Visit your live application">
|
|
154
|
+
🥳 Your app is now live! Once the app is created, you should see it in the App Platform dashboard with the public URL.
|
|
155
|
+
|
|
156
|
+
<Frame>
|
|
157
|
+

|
|
158
|
+
</Frame>
|
|
159
|
+
</Step>
|
|
160
|
+
|
|
161
|
+
</Steps>
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Deploy a Bun application on Google Cloud Run
|
|
3
|
+
sidebarTitle: Deploy on Google Cloud Run
|
|
4
|
+
mode: center
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
[Google Cloud Run](https://cloud.google.com/run) is a managed platform for deploying and scaling serverless applications. Google handles the infrastructure for you.
|
|
8
|
+
|
|
9
|
+
In this guide, we will deploy a Bun HTTP server to Google Cloud Run using a `Dockerfile`.
|
|
10
|
+
|
|
11
|
+
<Note>
|
|
12
|
+
Before continuing, make sure you have:
|
|
13
|
+
|
|
14
|
+
- A Bun application ready for deployment
|
|
15
|
+
- A [Google Cloud account](https://cloud.google.com/) with billing enabled
|
|
16
|
+
- [Google Cloud CLI](https://cloud.google.com/sdk/docs/install) installed and configured
|
|
17
|
+
|
|
18
|
+
</Note>
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
<Steps>
|
|
23
|
+
<Step title={<span>Initialize <code>gcloud</code> by select/creating a project</span>}>
|
|
24
|
+
|
|
25
|
+
Make sure that you've initialized the Google Cloud CLI. This command logs you in, and prompts you to either select an existing project or create a new one.
|
|
26
|
+
|
|
27
|
+
For more help with the Google Cloud CLI, see the [official documentation](https://docs.cloud.google.com/sdk/gcloud/reference/init).
|
|
28
|
+
|
|
29
|
+
```bash terminal icon="terminal"
|
|
30
|
+
gcloud init
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```txt
|
|
34
|
+
Welcome! This command will take you through the configuration of gcloud.
|
|
35
|
+
|
|
36
|
+
You must sign in to continue. Would you like to sign in (Y/n)? Y
|
|
37
|
+
You are signed in as [email@example.com].
|
|
38
|
+
|
|
39
|
+
Pick cloud project to use:
|
|
40
|
+
[1] existing-bun-app-1234
|
|
41
|
+
[2] Enter a project ID
|
|
42
|
+
[3] Create a new project
|
|
43
|
+
Please enter numeric choice or text value (must exactly match list item): 3
|
|
44
|
+
|
|
45
|
+
Enter a Project ID. my-bun-app
|
|
46
|
+
Your current project has been set to: [my-bun-app]
|
|
47
|
+
|
|
48
|
+
The Google Cloud CLI is configured and ready to use!
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
</Step>
|
|
52
|
+
<Step title="(Optional) Store your project info in environment variables">
|
|
53
|
+
Set variables for your project ID and number so they're easier to reuse in the following steps.
|
|
54
|
+
|
|
55
|
+
```bash terminal icon="terminal"
|
|
56
|
+
PROJECT_ID=$(gcloud projects list --format='value(projectId)' --filter='name="my bun app"')
|
|
57
|
+
PROJECT_NUMBER=$(gcloud projects list --format='value(projectNumber)' --filter='name="my bun app"')
|
|
58
|
+
|
|
59
|
+
echo $PROJECT_ID $PROJECT_NUMBER
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```txt
|
|
63
|
+
my-bun-app-... [PROJECT_NUMBER]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
</Step>
|
|
67
|
+
<Step title="Link a billing account">
|
|
68
|
+
List your available billing accounts and link one to your project:
|
|
69
|
+
|
|
70
|
+
```bash terminal icon="terminal"
|
|
71
|
+
gcloud billing accounts list
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```txt
|
|
75
|
+
ACCOUNT_ID NAME OPEN MASTER_ACCOUNT_ID
|
|
76
|
+
[BILLING_ACCOUNT_ID] My Billing Account True
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Link your billing account to your project. Replace `[BILLING_ACCOUNT_ID]` with the ID of your billing account.
|
|
80
|
+
|
|
81
|
+
```bash terminal icon="terminal"
|
|
82
|
+
gcloud billing projects link $PROJECT_ID --billing-account=[BILLING_ACCOUNT_ID]
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
```txt
|
|
86
|
+
billingAccountName: billingAccounts/[BILLING_ACCOUNT_ID]
|
|
87
|
+
billingEnabled: true
|
|
88
|
+
name: projects/my-bun-app-.../billingInfo
|
|
89
|
+
projectId: my-bun-app-...
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
</Step>
|
|
93
|
+
<Step title="Enable APIs and configure IAM roles">
|
|
94
|
+
Activate the necessary services and grant Cloud Build permissions:
|
|
95
|
+
|
|
96
|
+
```bash terminal icon="terminal"
|
|
97
|
+
gcloud services enable run.googleapis.com cloudbuild.googleapis.com
|
|
98
|
+
gcloud projects add-iam-policy-binding $PROJECT_ID \
|
|
99
|
+
--member=serviceAccount:$PROJECT_NUMBER-compute@developer.gserviceaccount.com \
|
|
100
|
+
--role=roles/run.builder
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
<Note>
|
|
104
|
+
These commands enable Cloud Run (`run.googleapis.com`) and Cloud Build (`cloudbuild.googleapis.com`), which are required for deploying from source. Cloud Run runs your containerized app, while Cloud Build handles building and packaging it.
|
|
105
|
+
|
|
106
|
+
The IAM binding grants the Compute Engine service account (`$PROJECT_NUMBER-compute@developer.gserviceaccount.com`) permission to build and deploy images on your behalf.
|
|
107
|
+
|
|
108
|
+
</Note>
|
|
109
|
+
|
|
110
|
+
</Step>
|
|
111
|
+
<Step title="Add a Dockerfile">
|
|
112
|
+
Create a new `Dockerfile` in the root of your project. This file contains the instructions to initialize the container, copy your local project files into it, install dependencies, and start the application.
|
|
113
|
+
|
|
114
|
+
```docker Dockerfile icon="docker"
|
|
115
|
+
# Use the official Bun image to run the application
|
|
116
|
+
FROM oven/bun:latest
|
|
117
|
+
|
|
118
|
+
# Copy the package.json and bun.lock into the container
|
|
119
|
+
COPY package.json bun.lock ./
|
|
120
|
+
|
|
121
|
+
# Install the dependencies
|
|
122
|
+
# Install the dependencies
|
|
123
|
+
RUN bun install --production --frozen-lockfile
|
|
124
|
+
|
|
125
|
+
# Copy the rest of the application into the container
|
|
126
|
+
COPY . .
|
|
127
|
+
|
|
128
|
+
# Run the application
|
|
129
|
+
CMD ["bun", "index.ts"]
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
<Note>
|
|
133
|
+
Make sure that the start command corresponds to your application's entry point. This can also be `CMD ["bun", "run", "start"]` if you have a start script in your `package.json`.
|
|
134
|
+
|
|
135
|
+
This image installs dependencies and runs your app with Bun inside a container. If your app doesn't have dependencies, you can omit the `RUN bun install --production --frozen-lockfile` line.
|
|
136
|
+
|
|
137
|
+
This image installs dependencies and runs your app with Bun inside a container. If your app doesn't have dependencies, you can omit the `RUN bun install --production --frozen-lockfile` line.
|
|
138
|
+
|
|
139
|
+
</Note>
|
|
140
|
+
|
|
141
|
+
Create a new `.dockerignore` file in the root of your project. This file contains the files and directories that should be _excluded_ from the container image, such as `node_modules`. This makes your builds faster and smaller:
|
|
142
|
+
|
|
143
|
+
```docker .dockerignore icon="Docker"
|
|
144
|
+
node_modules
|
|
145
|
+
Dockerfile*
|
|
146
|
+
.dockerignore
|
|
147
|
+
.git
|
|
148
|
+
.gitignore
|
|
149
|
+
README.md
|
|
150
|
+
LICENSE
|
|
151
|
+
.vscode
|
|
152
|
+
.env
|
|
153
|
+
# Any other files or directories you want to exclude
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
</Step>
|
|
157
|
+
<Step title="Deploy your service">
|
|
158
|
+
Make sure you're in the directory containing your `Dockerfile`, then deploy directly from your local source:
|
|
159
|
+
|
|
160
|
+
<Note>
|
|
161
|
+
Update the `--region` flag to your preferred region. You can also omit this flag to get an interactive prompt to
|
|
162
|
+
select a region. Update the `--region` flag to your preferred region. You can also omit this flag to get an
|
|
163
|
+
interactive prompt to select a region.
|
|
164
|
+
</Note>
|
|
165
|
+
|
|
166
|
+
```bash terminal icon="terminal"
|
|
167
|
+
gcloud run deploy my-bun-app --source . --region=us-west1 --allow-unauthenticated
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
```txt
|
|
171
|
+
Deploying from source requires an Artifact Registry Docker repository to store built containers. A repository named
|
|
172
|
+
[cloud-run-source-deploy] in region [us-west1] will be created.
|
|
173
|
+
|
|
174
|
+
Do you want to continue (Y/n)? Y
|
|
175
|
+
|
|
176
|
+
Building using Dockerfile and deploying container to Cloud Run service [my-bun-app] in project [my-bun-app-...] region [us-west1]
|
|
177
|
+
✓ Building and deploying... Done.
|
|
178
|
+
✓ Validating Service...
|
|
179
|
+
✓ Uploading sources...
|
|
180
|
+
✓ Building Container... Logs are available at [https://console.cloud.google.com/cloud-build/builds...].
|
|
181
|
+
✓ Creating Revision...
|
|
182
|
+
✓ Routing traffic...
|
|
183
|
+
✓ Setting IAM Policy...
|
|
184
|
+
Done.
|
|
185
|
+
Service [my-bun-app] revision [my-bun-app-...] has been deployed and is serving 100 percent of traffic.
|
|
186
|
+
Service URL: https://my-bun-app-....us-west1.run.app
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
</Step>
|
|
190
|
+
<Step title="Visit your live application">
|
|
191
|
+
|
|
192
|
+
🎉 Your Bun application is now live!
|
|
193
|
+
|
|
194
|
+
Visit the Service URL (`https://my-bun-app-....us-west1.run.app`) to confirm everything works as expected.
|
|
195
|
+
|
|
196
|
+
</Step>
|
|
197
|
+
</Steps>
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Deploy a Bun application on Railway
|
|
3
|
+
description: Deploy Bun applications to Railway with this step-by-step guide covering CLI and dashboard methods, optional PostgreSQL setup, and automatic SSL configuration.
|
|
4
|
+
sidebarTitle: Deploy on Railway
|
|
5
|
+
mode: center
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Railway is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud. It enables instant deployments from GitHub with zero configuration, automatic SSL, and built-in database provisioning.
|
|
9
|
+
|
|
10
|
+
This guide walks through deploying a Bun application with a PostgreSQL database (optional), which is exactly what the template below provides.
|
|
11
|
+
|
|
12
|
+
You can either follow this guide step-by-step or simply deploy the pre-configured template with one click:
|
|
13
|
+
|
|
14
|
+
<a
|
|
15
|
+
href="https://railway.com/deploy/bun-react-postgres?referralCode=Bun&utm_medium=integration&utm_source=template&utm_campaign=bun"
|
|
16
|
+
target="_blank"
|
|
17
|
+
>
|
|
18
|
+
<img src="https://railway.com/button.svg" alt="Deploy on Railway" />
|
|
19
|
+
</a>
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
**Prerequisites**:
|
|
24
|
+
|
|
25
|
+
- A Bun application ready for deployment
|
|
26
|
+
- A [Railway account](https://railway.app/)
|
|
27
|
+
- Railway CLI (for CLI deployment method)
|
|
28
|
+
- A GitHub account (for Dashboard deployment method)
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Method 1: Deploy via CLI
|
|
33
|
+
|
|
34
|
+
<Steps>
|
|
35
|
+
<Step title="Step 1">
|
|
36
|
+
Ensure sure you have the Railway CLI installed.
|
|
37
|
+
|
|
38
|
+
```bash terminal icon="terminal"
|
|
39
|
+
bun install -g @railway/cli
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
</Step>
|
|
43
|
+
<Step title="Step 2">
|
|
44
|
+
Log into your Railway account.
|
|
45
|
+
|
|
46
|
+
```bash terminal icon="terminal"
|
|
47
|
+
railway login
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
</Step>
|
|
51
|
+
<Step title="Step 3">
|
|
52
|
+
After successfully authenticating, initialize a new project.
|
|
53
|
+
|
|
54
|
+
```bash terminal icon="terminal"
|
|
55
|
+
railway init
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
</Step>
|
|
59
|
+
<Step title="Step 4">
|
|
60
|
+
After initializing the project, add a new database and service.
|
|
61
|
+
|
|
62
|
+
<Note>Step 4 is only necessary if your application uses a database. If you don't need PostgreSQL, skip to Step 5.</Note>
|
|
63
|
+
|
|
64
|
+
```bash terminal icon="terminal"
|
|
65
|
+
# Add PostgreSQL database. Make sure to add this first!
|
|
66
|
+
railway add --database postgres
|
|
67
|
+
|
|
68
|
+
# Add your application service.
|
|
69
|
+
railway add --service bun-react-db --variables DATABASE_URL=\${{Postgres.DATABASE_URL}}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
</Step>
|
|
73
|
+
<Step title="Step 5">
|
|
74
|
+
After the services have been created and connected, deploy the application to Railway. By default, services are only accessible within Railway's private network. To make your app publicly accessible, you need to generate a public domain.
|
|
75
|
+
|
|
76
|
+
```bash terminal icon="terminal"
|
|
77
|
+
# Deploy your application
|
|
78
|
+
railway up
|
|
79
|
+
|
|
80
|
+
# Generate public domain
|
|
81
|
+
railway domain
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
</Step>
|
|
85
|
+
</Steps>
|
|
86
|
+
|
|
87
|
+
Your app is now live! Railway auto-deploys on every GitHub push.
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Method 2: Deploy via Dashboard
|
|
92
|
+
|
|
93
|
+
<Steps>
|
|
94
|
+
<Step title="Step 1">
|
|
95
|
+
Create a new project
|
|
96
|
+
|
|
97
|
+
1. Go to [Railway Dashboard](http://railway.com/dashboard?utm_medium=integration&utm_source=docs&utm_campaign=bun)
|
|
98
|
+
2. Click **"+ New"** → **"GitHub repo"**
|
|
99
|
+
3. Choose your repository
|
|
100
|
+
|
|
101
|
+
</Step>
|
|
102
|
+
<Step title="Step 2">
|
|
103
|
+
Add a PostgreSQL database, and connect this database to the service
|
|
104
|
+
|
|
105
|
+
<Note>Step 2 is only necessary if your application uses a database. If you don't need PostgreSQL, skip to Step 3.</Note>
|
|
106
|
+
|
|
107
|
+
1. Click **"+ New"** → **"Database"** → **"Add PostgreSQL"**
|
|
108
|
+
2. After the database has been created, select your service (not the database)
|
|
109
|
+
3. Go to **"Variables"** tab
|
|
110
|
+
4. Click **"+ New Variable"** → **"Add Reference"**
|
|
111
|
+
5. Select `DATABASE_URL` from postgres
|
|
112
|
+
|
|
113
|
+
</Step>
|
|
114
|
+
<Step title="Step 3">
|
|
115
|
+
Generate a public domain
|
|
116
|
+
|
|
117
|
+
1. Select your service
|
|
118
|
+
2. Go to **"Settings"** tab
|
|
119
|
+
3. Under **"Networking"**, click **"Generate Domain"**
|
|
120
|
+
|
|
121
|
+
</Step>
|
|
122
|
+
</Steps>
|
|
123
|
+
|
|
124
|
+
Your app is now live! Railway auto-deploys on every GitHub push.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Configuration (Optional)
|
|
129
|
+
|
|
130
|
+
By default, Railway uses [Nixpacks](https://docs.railway.com/guides/build-configuration#nixpacks-options) to automatically detect and build your Bun application with zero configuration.
|
|
131
|
+
|
|
132
|
+
However, using the [Railpack](https://docs.railway.com/guides/build-configuration#railpack) application builder provides better Bun support, and will always support the latest version of Bun. The pre-configured templates use Railpack by default.
|
|
133
|
+
|
|
134
|
+
To enable Railpack in a custom project, add the following to your `railway.json`:
|
|
135
|
+
|
|
136
|
+
```json railway.json icon="file-json"
|
|
137
|
+
{
|
|
138
|
+
"$schema": "https://railway.com/railway.schema.json",
|
|
139
|
+
"build": {
|
|
140
|
+
"builder": "RAILPACK"
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
For more build configuration settings, check out the [Railway documentation](https://docs.railway.com/guides/build-configuration).
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Deploy a Bun application on Render
|
|
3
|
+
sidebarTitle: Deploy on Render
|
|
4
|
+
mode: center
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
[Render](https://render.com/) is a cloud platform that lets you flexibly build, deploy, and scale your apps.
|
|
8
|
+
|
|
9
|
+
It offers features like auto deploys from GitHub, a global CDN, private networks, automatic HTTPS setup, and managed PostgreSQL and Redis.
|
|
10
|
+
|
|
11
|
+
Render supports Bun natively. You can deploy Bun apps as web services, background workers, cron jobs, and more.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
As an example, let's deploy a simple Express HTTP server to Render.
|
|
16
|
+
|
|
17
|
+
<Steps>
|
|
18
|
+
<Step title="Step 1">
|
|
19
|
+
Create a new GitHub repo named `myapp`. Git clone it locally.
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
git clone git@github.com:my-github-username/myapp.git
|
|
23
|
+
cd myapp
|
|
24
|
+
```
|
|
25
|
+
</Step>
|
|
26
|
+
<Step title="Step 2">
|
|
27
|
+
Add the Express library.
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
bun add express
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
</Step>
|
|
34
|
+
|
|
35
|
+
<Step title="Step 3">
|
|
36
|
+
Define a simple server with Express:
|
|
37
|
+
|
|
38
|
+
```ts app.ts icon="/icons/typescript.svg"
|
|
39
|
+
import express from "express";
|
|
40
|
+
|
|
41
|
+
const app = express();
|
|
42
|
+
const port = process.env.PORT || 3001;
|
|
43
|
+
|
|
44
|
+
app.get("/", (req, res) => {
|
|
45
|
+
res.send("Hello World!");
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
app.listen(port, () => {
|
|
49
|
+
console.log(`Listening on port ${port}...`);
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
</Step>
|
|
53
|
+
<Step title="Step 4">
|
|
54
|
+
|
|
55
|
+
Commit your changes and push to GitHub.
|
|
56
|
+
|
|
57
|
+
```sh terminal icon="terminal"
|
|
58
|
+
git add app.ts bun.lock package.json
|
|
59
|
+
git commit -m "Create simple Express app"
|
|
60
|
+
git push origin main
|
|
61
|
+
```
|
|
62
|
+
</Step>
|
|
63
|
+
<Step title="Step 5">
|
|
64
|
+
In your [Render Dashboard](https://dashboard.render.com/), click `New` > `Web Service` and connect your `myapp` repo.
|
|
65
|
+
|
|
66
|
+
</Step>
|
|
67
|
+
<Step title="Step 6">
|
|
68
|
+
In the Render UI, provide the following values during web service creation:
|
|
69
|
+
|
|
70
|
+
| | |
|
|
71
|
+
| ----------------- | ------------- |
|
|
72
|
+
| **Runtime** | `Node` |
|
|
73
|
+
| **Build Command** | `bun install` |
|
|
74
|
+
| **Start Command** | `bun app.ts` |
|
|
75
|
+
|
|
76
|
+
</Step>
|
|
77
|
+
|
|
78
|
+
</Steps>
|
|
79
|
+
|
|
80
|
+
That's it! Your web service will be live at its assigned `onrender.com` URL as soon as the build finishes.
|
|
81
|
+
|
|
82
|
+
You can view the [deploy logs](https://docs.render.com/logging#logs-for-an-individual-deploy-or-job) for details. Refer to [Render's documentation](https://docs.render.com/deploys) for a complete overview of deploying on Render.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Deploy a Bun application on Vercel
|
|
3
|
+
sidebarTitle: Deploy on Vercel
|
|
4
|
+
mode: center
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
import { ProductCard } from "/snippets/product-card.mdx";
|
|
8
|
+
|
|
9
|
+
[Vercel](https://vercel.com/) is a cloud platform that lets you build, deploy, and scale your apps.
|
|
10
|
+
|
|
11
|
+
<Warning>
|
|
12
|
+
The Bun runtime is in Beta; certain features (e.g., automatic source maps, byte-code caching, metrics on
|
|
13
|
+
`node:http/https`) are not yet supported.
|
|
14
|
+
</Warning>
|
|
15
|
+
|
|
16
|
+
<Note>
|
|
17
|
+
`Bun.serve` is currently not supported on Vercel Functions. Use Bun with frameworks supported by Vercel, like Next.js,
|
|
18
|
+
Express, Hono, or Nitro.
|
|
19
|
+
</Note>
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
<Steps>
|
|
24
|
+
<Step title="Configure Bun in vercel.json">
|
|
25
|
+
To enable the Bun runtime for your Functions, add a `bunVersion` field in your `vercel.json` file:
|
|
26
|
+
|
|
27
|
+
```json vercel.json icon="file-json"
|
|
28
|
+
{
|
|
29
|
+
"bunVersion": "1.x" // [!code ++]
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Vercel automatically detects this configuration and runs your application on Bun. The value has to be `"1.x"`, Vercel handles the minor version internally.
|
|
34
|
+
|
|
35
|
+
For best results, match your local Bun version with the version used by Vercel. **Currently, Bun version `1.2.23` is supported**.
|
|
36
|
+
</Step>
|
|
37
|
+
|
|
38
|
+
<Step title="Next.js configuration">
|
|
39
|
+
If you’re deploying a **Next.js** project (including ISR), update your `package.json` scripts to use the Bun runtime:
|
|
40
|
+
|
|
41
|
+
```json package.json icon="file-json"
|
|
42
|
+
{
|
|
43
|
+
"scripts": {
|
|
44
|
+
"dev": "bun --bun next dev", // [!code ++]
|
|
45
|
+
"build": "bun --bun next build" // [!code ++]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
<Note>
|
|
51
|
+
The `--bun` flag runs the Next.js CLI under Bun. Bundling (via Turbopack or Webpack) remains unchanged, but all commands execute within the Bun runtime.
|
|
52
|
+
</Note>
|
|
53
|
+
|
|
54
|
+
This ensures both local development and builds use Bun.
|
|
55
|
+
</Step>
|
|
56
|
+
|
|
57
|
+
<Step title="Deploy your app">
|
|
58
|
+
Connect your repository to Vercel, or deploy from the CLI:
|
|
59
|
+
|
|
60
|
+
```bash terminal icon="terminal"
|
|
61
|
+
# Using bunx (no global install)
|
|
62
|
+
bunx vercel login
|
|
63
|
+
bunx vercel deploy
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Or install the Vercel CLI globally:
|
|
67
|
+
|
|
68
|
+
```bash terminal icon="terminal"
|
|
69
|
+
bun i -g vercel
|
|
70
|
+
vercel login
|
|
71
|
+
vercel deploy
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
[Learn more in the Vercel Deploy CLI documentation →](https://vercel.com/docs/cli/deploy)
|
|
75
|
+
</Step>
|
|
76
|
+
|
|
77
|
+
<Step title="Verify the runtime">
|
|
78
|
+
To confirm your deployment uses Bun, log the Bun version:
|
|
79
|
+
|
|
80
|
+
```ts index.ts icon="/icons/typescript.svg"
|
|
81
|
+
console.log("runtime", process.versions.bun);
|
|
82
|
+
```
|
|
83
|
+
```txt
|
|
84
|
+
runtime 1.2.23
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
[See the Vercel Bun Runtime documentation for feature support →](https://vercel.com/docs/functions/runtimes/bun#feature-support)
|
|
88
|
+
</Step>
|
|
89
|
+
|
|
90
|
+
</Steps>
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
- [Fluid compute](https://vercel.com/docs/fluid-compute): Both Bun and Node.js runtimes run on Fluid compute and support the same core Vercel Functions features.
|
|
95
|
+
- [Middleware](https://vercel.com/docs/routing-middleware): To run Routing Middleware with Bun, set the runtime to `nodejs`:
|
|
96
|
+
|
|
97
|
+
```ts middleware.ts icon="/icons/typescript.svg"
|
|
98
|
+
export const config = { runtime: "nodejs" }; // [!code ++]
|
|
99
|
+
```
|