{
  "manifest_version": "1",
  "slug": "bun",
  "title": "Bun",
  "headline": "Deploy a Bun app",
  "description": "Run Bun on an exe.dev VM: a private dev server with hot reloading, bun:sqlite on a real disk, and your app compiled to one binary under systemd.",
  "category": "frameworks",
  "tags": [
    "bun",
    "typescript",
    "javascript",
    "bun.serve",
    "hono",
    "elysia",
    "bun:sqlite",
    "hot reload",
    "websockets",
    "single binary",
    "systemd",
    "railway alternative"
  ],
  "url": "https://exe.dev/deploy/bun",
  "markdown_url": "https://exe.dev/deploy/bun.md",
  "upstream": {
    "website": "https://bun.com",
    "source": "https://github.com/oven-sh/bun",
    "docs": "https://bun.com/docs",
    "license": "MIT"
  },
  "example_vm_name": "my-bun",
  "time": "10 minutes",
  "stack": [
    {
      "name": "Your app, in production",
      "detail": "One binary from bun build --compile, as app.service",
      "port": 8000,
      "data": "~/releases/current → the newest of five kept binaries"
    },
    {
      "name": "The dev server",
      "detail": "bun --hot in ~/app as app-dev.service, behind nginx",
      "port": 3000,
      "data": "~/app, with its own dev.db"
    },
    {
      "name": "Bun 1.4.5",
      "detail": "Pinned, in /usr/local/bin where systemd finds it"
    },
    {
      "name": "SQLite",
      "detail": "Bun's built-in bun:sqlite; settings in ~/app.env",
      "data": "~/data"
    },
    {
      "name": "Releases and backups",
      "detail": "app-release tests, compiles, switches, and rolls back; app-backup.timer runs nightly",
      "data": "~/backups"
    }
  ],
  "access": [
    {
      "url": "https://my-bun.exe.xyz/",
      "who": "private",
      "what": "Your app, until you make it public"
    },
    {
      "url": "https://my-bun.exe.xyz:3000/",
      "who": "private",
      "what": "The dev server, reloading as you edit"
    }
  ],
  "inputs": [
    {
      "name": "REPO",
      "description": "the GitHub repository to run, as owner/name or a URL, or `new` to start a fresh Bun app"
    }
  ],
  "delivers": [
    "Bun 1.4.5, pinned, where your shell, scripts, and systemd all find it.",
    "The app's code in ~/app, served by bun --hot as app-dev.service at port 3000, with hot reloading through exe.dev's proxy.",
    "The same code compiled to one binary and running as app.service on port 8000, shipped with ~/bin/app-release, which puts the old binary back if the new one doesn't answer.",
    "Settings and secrets in ~/app.env (mode 600) and data in ~/data, backed up nightly and before each release, with the newest backup opened and checked.",
    "With REPO=new, a guestbook on Bun.serve, bun:sqlite, and WebSockets, with tests."
  ],
  "deployable": true,
  "deploy": {
    "new_vm_url": "https://exe.dev/new?prompt=REPO%3D%3Cfill-this-in%3E%0A%0ASet%20up%20Bun%20on%20this%20VM%20by%20following%20the%20exe.dev%20recipe%20at%20https%3A%2F%2Fexe.dev%2Fdeploy%2Fbun.md%3Fvia%3Ddeploy%20from%20top%20to%20bottom.%0A%0AThe%20values%20at%20the%20top%20of%20this%20message%20are%20mine%3A%0A-%20REPO%3A%20the%20GitHub%20repository%20to%20run%2C%20as%20owner%2Fname%20or%20a%20URL%2C%20or%20%60new%60%20to%20start%20a%20fresh%20Bun%20app%0AAsk%20me%20for%20any%20that%20still%20say%20%3Cfill-this-in%3E%20before%20you%20need%20them.%0A%0AThe%20recipe%27s%20example%20VM%20name%20is%20my-bun.%20This%20VM%27s%20name%20is%20the%20output%20of%20%60hostname%60%3A%20use%20it%20wherever%20the%20recipe%20writes%20my-bun.%20Skip%20the%20step%20that%20creates%20the%20VM%3B%20you%20are%20on%20it.%0A%0AYou%20are%20done%20when%20all%20of%20these%20are%20true.%20Check%20each%20one%20yourself%3A%0A-%20Bun%201.4.5%2C%20pinned%2C%20where%20your%20shell%2C%20scripts%2C%20and%20systemd%20all%20find%20it.%0A-%20The%20app%27s%20code%20in%20~%2Fapp%2C%20served%20by%20bun%20--hot%20as%20app-dev.service%20at%20port%203000%2C%20with%20hot%20reloading%20through%20exe.dev%27s%20proxy.%0A-%20The%20same%20code%20compiled%20to%20one%20binary%20and%20running%20as%20app.service%20on%20port%208000%2C%20shipped%20with%20~%2Fbin%2Fapp-release%2C%20which%20puts%20the%20old%20binary%20back%20if%20the%20new%20one%20doesn%27t%20answer.%0A-%20Settings%20and%20secrets%20in%20~%2Fapp.env%20%28mode%20600%29%20and%20data%20in%20~%2Fdata%2C%20backed%20up%20nightly%20and%20before%20each%20release%2C%20with%20the%20newest%20backup%20opened%20and%20checked.%0A-%20With%20REPO%3Dnew%2C%20a%20guestbook%20on%20Bun.serve%2C%20bun%3Asqlite%2C%20and%20WebSockets%2C%20with%20tests.%0A%0ARead%20the%20whole%20recipe%2C%20including%20the%20closed%20details.%20Follow%20%22Set%20up%20by%0Ahand%22%20from%20%22Install%20Bun%22%20to%20the%20end%20of%20it%2C%20as%20exedev%3B%20the%20walkthrough%0Aabove%20it%20is%20for%20the%20owner%20afterwards.%20Do%20not%20run%20Restore%20or%20Update%2C%20and%0Ado%20not%20reboot.%20Leave%20public%20sharing%20off.%0AREPO%20picks%20one%20path%20in%20%22Get%20the%20code%22%3A%20%60new%60%20starts%20a%20fresh%20app%3B%0Aanything%20else%20is%20a%20GitHub%20repository%20%28turn%20URLs%20into%20owner%2Fname%29.%20If%20a%0Aclone%20fails%2C%20follow%20the%20private-repository%20steps%2C%20and%20if%20that%20fails%0Atoo%2C%20give%20the%20owner%20the%20integration%20command%20and%20wait%20for%20them.%0AFor%20a%20cloned%20app%2C%20fill%20~%2Fapp.env%20from%20its%20.env.example%20%28or%20README%29%3A%0Agenerate%20secrets%20with%20openssl%2C%20ask%20the%20owner%20for%20keys%20to%20outside%0Aservices%2C%20and%20never%20invent%20values.%20Don%27t%20commit%20to%20a%20cloned%0Arepository%3B%20if%20the%20app%20can%27t%20run%20here%20without%20a%20code%20change%20%28a%0Ahard-coded%20port%2C%20say%29%2C%20make%20the%20smallest%20one%2C%20leave%20it%20uncommitted%2C%0Aand%20tell%20the%20owner.%20If%20its%20dev%20server%20is%20Vite%2C%20follow%20%22Hono%2C%20Elysia%2C%20and%0AVite%22.%20If%20app-release%20fails%2C%20read%20its%20output%2C%20fix%20what%20you%20can%2C%0Aand%20run%20it%20again.%0AFinish%20with%20both%20URLs%2C%20port%208000%20and%20port%203000%2C%20and%20how%20the%20owner%0Aworks%20from%20here%3A%20edit%20in%20~%2Fapp%20%28or%20ask%20Shelley%29%2C%20watch%20port%203000%2C%20then%0Arun%20~%2Fbin%2Fapp-release.%0A%0AFinish%20with%20the%20URLs%20I%20should%20open.%0A",
    "terminal": "curl -fsSL https://exe.dev/deploy/bun/prompt.txt | ssh exe.dev new --prompt=/dev/stdin",
    "prompt": "REPO=\u003cfill-this-in\u003e\n\nSet up Bun on this VM by following the exe.dev recipe at https://exe.dev/deploy/bun.md?via=deploy from top to bottom.\n\nThe values at the top of this message are mine:\n- REPO: the GitHub repository to run, as owner/name or a URL, or `new` to start a fresh Bun app\nAsk me for any that still say \u003cfill-this-in\u003e before you need them.\n\nThe recipe's example VM name is my-bun. This VM's name is the output of `hostname`: use it wherever the recipe writes my-bun. Skip the step that creates the VM; you are on it.\n\nYou are done when all of these are true. Check each one yourself:\n- Bun 1.4.5, pinned, where your shell, scripts, and systemd all find it.\n- The app's code in ~/app, served by bun --hot as app-dev.service at port 3000, with hot reloading through exe.dev's proxy.\n- The same code compiled to one binary and running as app.service on port 8000, shipped with ~/bin/app-release, which puts the old binary back if the new one doesn't answer.\n- Settings and secrets in ~/app.env (mode 600) and data in ~/data, backed up nightly and before each release, with the newest backup opened and checked.\n- With REPO=new, a guestbook on Bun.serve, bun:sqlite, and WebSockets, with tests.\n\nRead the whole recipe, including the closed details. Follow \"Set up by\nhand\" from \"Install Bun\" to the end of it, as exedev; the walkthrough\nabove it is for the owner afterwards. Do not run Restore or Update, and\ndo not reboot. Leave public sharing off.\nREPO picks one path in \"Get the code\": `new` starts a fresh app;\nanything else is a GitHub repository (turn URLs into owner/name). If a\nclone fails, follow the private-repository steps, and if that fails\ntoo, give the owner the integration command and wait for them.\nFor a cloned app, fill ~/app.env from its .env.example (or README):\ngenerate secrets with openssl, ask the owner for keys to outside\nservices, and never invent values. Don't commit to a cloned\nrepository; if the app can't run here without a code change (a\nhard-coded port, say), make the smallest one, leave it uncommitted,\nand tell the owner. If its dev server is Vite, follow \"Hono, Elysia, and\nVite\". If app-release fails, read its output, fix what you can,\nand run it again.\nFinish with both URLs, port 8000 and port 3000, and how the owner\nworks from here: edit in ~/app (or ask Shelley), watch port 3000, then\nrun ~/bin/app-release.\n\nFinish with the URLs I should open.\n",
    "prompt_url": "https://exe.dev/deploy/bun/prompt.txt"
  },
  "published": "2026-11-21",
  "updated": "2026-11-21",
  "verified": "2026-11-20",
  "related": [
    "nodejs",
    "sqlite",
    "postgres",
    "go",
    "dev-test-prod",
    "claude-code"
  ],
  "alternatives": [
    "Railway",
    "Render",
    "Fly.io"
  ],
  "files": [
    "https://exe.dev/deploy/bun/app-backup",
    "https://exe.dev/deploy/bun/app-release",
    "https://exe.dev/deploy/bun/app.test.ts",
    "https://exe.dev/deploy/bun/app.ts",
    "https://exe.dev/deploy/bun/bun-dev.conf",
    "https://exe.dev/deploy/bun/client.ts",
    "https://exe.dev/deploy/bun/db.ts",
    "https://exe.dev/deploy/bun/index.html",
    "https://exe.dev/deploy/bun/server.ts",
    "https://exe.dev/deploy/bun/style.css"
  ]
}
