Why Bun?
- Native TypeScript — Bun runs
.tsfiles directly. No build step needed for development or production. - Faster startup — Bun starts significantly faster than Node.js, which matters during development when your server restarts on every file change.
- Built-in watch mode —
bun --watchreplaces the need fortsx watchornodemon. - Compatible — Bun is compatible with the Node.js ecosystem. Your existing npm packages, MongoDB driver, and Apollo Server all work as-is.
Getting Started
Install Bun
Create a New Project
Run in Development
Run in Production
./app/index.ts directly — no build step, no compiled output directory.
Migrating an Existing Project
If you have an existing Orionjs v4 project using Node.js and pnpm, here’s how to migrate:1. Install Bun
2. Update Dependencies
3. Update package.json Scripts
4. Update Orionjs Packages
@orion-js/* packages to 4.3.0.
5. Run
Using Node.js
Bun is the default but Node.js is fully supported. Pass--node to any CLI command:
--node:
- Dev mode uses
tsx watchfor file watching and TypeScript execution. - Prod mode builds the app with esbuild first, then runs the compiled output with
node --import=tsx.
Check Available Runtimes
What Changed in v4.3
| Area | Before (v4.2) | After (v4.3) |
|---|---|---|
| Default runtime | Node.js (via tsx) | Bun |
| Package manager | pnpm | Bun |
orion dev | tsx watch ./app/index.ts | bun --watch ./app/index.ts |
orion prod | Build + node | bun ./app/index.ts (no build) |
| Node.js support | Default | Opt-in via --node flag |
| Test runner | Vitest (unchanged) | Vitest (unchanged) |
FAQ
Do I need to change my application code?
No. Your services, schemas, resolvers, MongoDB operations, and all other application code work the same on both Bun and Node.js.Does Vitest still work?
Yes. Vitest runs independently of the Orionjs CLI runtime. Usebunx vitest to run your tests.
Can I use npm packages?
Yes. Bun is compatible with the npm registry and supportsnode_modules. All your existing dependencies work.
What about Docker deployments?
Use the official Bun Docker image:--node: