Skip to main content

Overview

buntime.sh makes it easy to build and preview web applications. Every session gets a unique preview URL, and Bun 1.3’s built-in hot module reloading (HMR) automatically updates your app when code changes.

Quick Start

Create a Simple Server

Preview URLs

Every session gets a unique subdomain:
Key features:
  • ✅ Always uses port 8080 (required)
  • ✅ HTTPS enabled by default
  • ✅ Proxied through Cloudflare for security
  • ✅ Stays active as long as the session exists
  • ✅ No configuration needed
Your web server must listen on port 8080. Other ports are not accessible via the preview URL.

Hot Module Reloading

Bun 1.3 includes built-in HMR that works automatically:
Use the --hot flag when starting your server to enable automatic hot reloading.

Static HTML

You can serve static HTML directly with Bun:

React Application

Build a full React app with JSX support:

API Routes

Create a JSON API:

WebSocket Server

Build real-time apps with WebSockets:

File Uploads

Handle file uploads:

Environment Variables

Pass secrets and config to your web app:

CORS Headers

Enable CORS for external API access:

Debugging Tips

List active processes to see if your server started:
Execution output includes console.log from your server:
Test your server code locally before deploying:
Kill the process and start fresh:

Limitations

Important limitations:
  • Only port 8080 is accessible via preview URL
  • Preview URLs require the session to be active
  • No custom domains (use the provided subdomain)
  • WebSocket connections close when session sleeps
  • Maximum 1 web server per session

Best Practices

Use --hot flag

Enable hot reload for faster iteration during development

Handle errors

Return proper error responses with status codes

Log to stdout

Use console.log for debugging—output is captured in execute results

Test endpoints

Verify your API routes work before sharing preview URLs

Examples

Express Server

Full Express.js application

React SSR

Server-side rendered React app

REST API

Complete CRUD API example

WebSocket Chat

Real-time chat application

Next Steps

Databases

Add databases to your web app

Multi-file Projects

Organize larger applications

Environment Variables

Manage secrets and configuration

API Reference

Explore execution options