@reliverse/rebun is a beginner-friendly wrapper around the Bun runtime API. Because Bun is fast-first โ but not always beginner-first.
๐ฆ NPM โข โจ GitHub โข ๐ฌ Discord
Bun is amazing: fast, native, batteries-included.
But for newer devs โ or folks migrating from Node.js โ its API can be inconsistent in places. Rebun is here to help:
- Wraps core Bun APIs with more predictable and friendly interfaces
- Removes gotchas around
Bun.file,Bun.write,Bun.serve, and more - Adds ergonomic helpers for building apps, CLIs, tools, and servers
โ ๏ธ Heads up!
Most of the things mentioned in this doc arenโt implemented yet โ theyโre part of the vision forv1.0.0. Got thoughts? Ideas? Complaints? Drop your feedback in Discord or use GitHub Issues. Your feedback means the world and helps shape where this project goes next. Thank you!
- ๐ฐ Simpler
read,write,serve, andspawnutilities - ๐ง Fully typed (TypeScript-first)
- ๐ฆ Drop-in replacement for most Bun APIs
- ๐ฅ Clean
serve()with middleware support (like Express) - ๐ช Automatic MIME type handling, encoding, etc.
- โ๏ธ Works in CLI tools, scripts, servers, and test runners
- ๐ซ No monkey-patching or shims โ just ergonomic wrappers
bun add @reliverse/rebun
# or: npm install @reliverse/rebunimport { readFile, writeFile, serve } from "@reliverse/rebun";
const text = await readFile("./hello.txt");
await writeFile("./copy.txt", text);
serve(({ req }) => {
return new Response("Hello from Rebun!");
});await readFile("file.txt"); // Reads file as UTF-8 string
await readFileBuffer("image.png"); // Reads file as Uint8Array
await writeFile("out.txt", "Hello!"); // Writes string
await copyFile("a.txt", "b.txt"); // Simple copy
await removeFile("temp.log"); // Delete file
await ensureDir("logs/"); // Create dir if missingserve(({ req, url, json, text }) => {
if (url.pathname === "/hello") return text("Hello!");
if (url.pathname === "/json") return json({ ok: true });
return text("404 Not Found", 404);
});Supports:
- โจ auto-parsing URL
- โก
.text(),.json(),.html()response helpers - ๐งฑ static file serving (coming soon)
- ๐งฉ middleware (coming soon)
const result = await run("echo Hello!");
console.log(result.stdout); // "Hello!"import { serve } from "@reliverse/rebun";
serve(() => new Response("Hello world!"));import { readFile, writeFile } from "@reliverse/rebun";
const data = await readFile("data.json");
await writeFile("backup.json", data);- Core file utils (
readFile,writeFile, etc.) - Clean
serve()with DX enhancements - Built-in static file server
-
fetch()wrappers with auto JSON, timeout, retry - Test utilities
- CLI generator templates
- Bun plugin system support
-
๐ New Bun users who want a smoother, less quirky API surface
-
๐งฐ Tool builders and CLI authors who want fast bootstraps without low-level Bun fiddling
-
๐ Script writers tired of boilerplate just to write a simple utility
-
๐ Teams migrating from Node.js or Deno, seeking familiar ergonomics
-
๐ Developers who donโt want to list
buninpackage.json:Why? In some setups โ like when I was building
@reliverse/relidlerโ you might be forced to addbunas a dep just to pass tools likeJSR. But that breaks tools likeknipthat flag unused deps. The fix? Add"ignoreDependencies": ["bun"]in yourknip.json. Or... just use@reliverse/rebun, which acts as a thin wrapper with zero overhead and smooth developer ergonomics.
Bunโ official docs@reliverse/cliโ CLI toolkit using Rebun@reliverse/remptsโ beautiful prompt & command system
- MIT ยฉ blefnk Nazar Kornienko
- Part of the Reliverse ecosystem
๐ This README was proudly generated with Remdn