---
title: "Deploy a Bun App"
description: "Learn how to deploy a Bun app to Railway with this step-by-step guide. It covers one-click deploys, Dockerfile setup, and other deployment strategies."
date: 2026-03-30T00:00:00.000Z
updated: 2026-10-29T11:13:54.643Z
topics: ["Frameworks"]
tags: ["Deployment", "Bun", "Javascript", "Backend"]
url: https://railway.com/guides/bun
---

# Deploy a Bun App

<a href="https://bun.sh/" target="_blank">Bun</a> is a fast all-in-one JavaScript runtime and toolkit designed as a drop-in replacement for Node.js.

This guide covers how to deploy a Bun app on Railway in four ways:

1. [One-click deploy from a template](#one-click-deploy-from-a-template).
2. [From a GitHub repository](#deploy-from-a-github-repo).
3. [Using the CLI](#deploy-from-the-cli).
4. [Using a Dockerfile](#use-a-dockerfile).

## One-click deploy from a template

[![Deploy on Railway](https://cms.railway.com/media/aeo-6ec9624cf8f8a7408f19e40a27a1e6020de459a42ac3fe1c4a016cb01cd1aa9b.png)](https://railway.com/new/template/bun-starter)

It is highly recommended that [you eject from the template after deployment](https://docs.railway.com/templates/deploy#eject-from-template-repository) to create a copy of the repo on your GitHub account.

**Note:** You can also choose from a <a href="https://railway.com/templates?q=bun" target="_blank">variety of Bun templates</a> created by the community.

## Deploy from a GitHub repo

To deploy a Bun app on Railway directly from GitHub, follow the steps below:

1. Create a <a href="https://railway.com/new" target="_blank">New Project.</a>
2. Click **Deploy from GitHub repo**.
3. Select your Bun GitHub repo.
   - Railway requires a valid GitHub account to be linked. If your Railway account isn't associated with one, you will be prompted to link it.
4. Click **Deploy Now**.

**Note:** [Railpack](https://docs.railway.com/builds/railpack) does not yet detect Bun projects automatically. Add a `Dockerfile` to your repo for Railway to build and deploy your app.

Once the deployment is successful, a Railway [service](https://docs.railway.com/services) will be created for you. By default, this service will not be publicly accessible.

To set up a publicly accessible URL for the service, navigate to the **Networking** section in the [Settings](https://docs.railway.com/overview/the-basics#service-settings) tab of your new service and click on [Generate Domain](https://docs.railway.com/networking/public-networking#railway-provided-domain).

## Deploy from the CLI

1. <a href="https://docs.railway.com/guides/cli#installing-the-cli" target="_blank">Install</a> and <a href="https://docs.railway.com/guides/cli#authenticating-with-the-cli" target="_blank">authenticate with the CLI.</a>
2. `cd` into your Bun app directory.
3. Run `railway init` within the app directory to create a new project.
4. Run `railway up` to deploy.

**Note:** [Railpack](https://docs.railway.com/builds/railpack) does not yet detect Bun projects automatically. Add a `Dockerfile` to your repo for Railway to build and deploy your app.

## Use a Dockerfile

1. Create a `Dockerfile` in your app's root directory.
2. Add the content below to the `Dockerfile`:

   ```docker
   FROM oven/bun:1-alpine

   WORKDIR /app

   COPY package.json bun.lockb ./

   RUN bun install --frozen-lockfile

   COPY . ./

   ENTRYPOINT ["bun", "run", "src/index.ts"]
   ```

3. Either deploy via the CLI or from GitHub.

Railway automatically detects the `Dockerfile`, [and uses it to build and deploy the app.](https://docs.railway.com/builds/dockerfiles)

**Note:** Railway supports also <a href="https://docs.railway.com/guides/services#deploying-a-public-docker-image" target="_blank">deployment from public and private Docker images</a>.

## Next steps

Explore these resources to learn more about Railway:

- [Add a Database Service](https://docs.railway.com/databases/build-a-database-service)
- [Monitor your app](https://docs.railway.com/observability)
- [Running a Cron Job](https://docs.railway.com/cron-jobs)