@effect/platform-bun package provides Bun-specific implementations for the abstractions defined in @effect/platform, optimized for the high-performance Bun runtime.
Installation
Available Modules
HTTP
BunHttpServer
Create high-performance HTTP servers using Bun’s native server:BunHttpClient
Make HTTP requests using Bun’s optimized fetch:File System
BunFileSystem
Access the file system with Bun’s fast file I/O:Process Management
BunChildProcessSpawner
Spawn child processes with Bun:Networking
BunSocket
Create TCP socket clients using Bun’s socket API:BunSocketServer
Create TCP socket servers:Redis
BunRedis
Integrate with Redis:Workers
BunWorker
Use Bun’s Worker API:Streams
BunStream
Convert between Bun streams and Effect streams:Utilities
BunPath
Path manipulation utilities:BunTerminal
Terminal/TTY operations:Complete Runtime
BunRuntime
TheBunRuntime provides all Bun services in a single layer:
Performance Benefits
Bun provides significant performance improvements over Node.js in many scenarios:- Faster startup time: Bun starts applications much faster
- Optimized file I/O: File operations are significantly faster
- Built-in bundler: No need for separate build tools in many cases
- Native TypeScript: Direct TypeScript execution without transpilation
Configuration
Many services accept configuration options:Requirements
- Bun 1.0.0 or higher
- Effect 4.0.0 or higher
Migration from Node.js
Migrating from@effect/platform-node to @effect/platform-bun is straightforward: