AgentStack
SKILL verified MIT Self-run

Bun Deploy a Bun application on Railway

skill-jarle-bun-skills-bun-guides-deployment-railway · by jarle

Deploy Bun applications to Railway with this step-by-step guide covering CLI and dashboard methods, optional PostgreSQL setup, and automatic SSL configuration.

No reviews yet
0 installs
14 views
0.0% view→install

Install

$ agentstack add skill-jarle-bun-skills-bun-guides-deployment-railway

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Bun Deploy a Bun application on Railway? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Deploy a Bun application on Railway

> Deploy Bun applications to Railway with this step-by-step guide covering CLI and dashboard methods, optional PostgreSQL setup, and automatic SSL configuration.

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.

This guide walks through deploying a Bun application with a PostgreSQL database (optional), which is exactly what the template below provides.

You can either follow this guide step-by-step or simply deploy the pre-configured template with one click:


Prerequisites:

  • A Bun application ready for deployment
  • A Railway account
  • Railway CLI (for CLI deployment method)
  • A GitHub account (for Dashboard deployment method)

Method 1: Deploy via CLI

Ensure sure you have the Railway CLI installed.

``bash terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}} bun install -g @railway/cli ``

Log into your Railway account.

``bash terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}} railway login ``

After successfully authenticating, initialize a new project.

``bash terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}} railway init ``

After initializing the project, add a new database and service.

Step 4 is only necessary if your application uses a database. If you don't need PostgreSQL, skip to Step 5.

```bash terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}} # Add PostgreSQL database. Make sure to add this first! railway add --database postgres

# Add your application service. railway add --service bun-react-db --variables DATABASEURL=\${{Postgres.DATABASEURL}} ```

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.

```bash terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}} # Deploy your application railway up

# Generate public domain railway domain ```

Your app is now live! Railway auto-deploys on every GitHub push.


Method 2: Deploy via Dashboard

Create a new project

  1. Go to Railway Dashboard
  2. Click "+ New""GitHub repo"
  3. Choose your repository

Add a PostgreSQL database, and connect this database to the service

Step 2 is only necessary if your application uses a database. If you don't need PostgreSQL, skip to Step 3.

  1. Click "+ New""Database""Add PostgreSQL"
  2. After the database has been created, select your service (not the database)
  3. Go to "Variables" tab
  4. Click "+ New Variable""Add Reference"
  5. Select DATABASE_URL from postgres

Generate a public domain

  1. Select your service
  2. Go to "Settings" tab
  3. Under "Networking", click "Generate Domain"

Your app is now live! Railway auto-deploys on every GitHub push.


Configuration (Optional)

By default, Railway uses Nixpacks to automatically detect and build your Bun application with zero configuration.

However, using the Railpack application builder provides better Bun support, and will always support the latest version of Bun. The pre-configured templates use Railpack by default.

To enable Railpack in a custom project, add the following to your railway.json:

```json railway.json icon="file-json" theme={"theme":{"light":"github-light","dark":"dracula"}} { "$schema": "https://railway.com/railway.schema.json", "build": { "builder": "RAILPACK" } }


For more build configuration settings, check out the [Railway documentation](https://docs.railway.com/guides/build-configuration).

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [jarle](https://github.com/jarle)
- **Source:** [jarle/bun-skills](https://github.com/jarle/bun-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.