Prerequisites
- Bun installed (https://bun.sh/)
- A Remix application ready to deploy
Server Setup
Create a server entry point:server.ts
Package Management
Install dependencies with Bun’s fast package manager:package.json.
Development Mode
Run with auto-reload:package.json:
Production Build
Bun can bundle your application for production:Environment Variables
Bun automatically loads.env files:
.env
HTTPS Server
Enable HTTPS in production:WebSocket Support
Bun has excellent WebSocket support:SQLite with Bun
Bun includes built-in SQLite support:Deployment Options
VPS/Dedicated Server
- Install Bun on your server:
- Upload your application
- Install dependencies:
bun install - Start your server:
bun server.ts
Docker Container
Create aDockerfile:
Process Management
Use PM2 or systemd to manage your Bun process:Performance Benefits
- Fast startup: Bun starts 4x faster than Node.js
- Fast runtime: Native code execution for web APIs
- Fast package manager: Install packages 10-100x faster
- Built-in bundler: No need for separate build tools
Testing
Bun includes a built-in test runner:Best Practices
- Use
bun buildfor production bundles - Leverage built-in SQLite for local development
- Take advantage of Bun’s fast package installation
- Use
bun --watchfor development - Profile with
bun --inspect
Related Documentation
Runtime Agnostic
How Remix runs on any JavaScript runtime
Performance
Optimize your application