Thanks to visit codestin.com
Credit goes to github.com

Skip to content

reliverse/rebun

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Reliverse Rebun

@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

๐Ÿ’ก Why Rebun?

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 for v1.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!

โœจ Features

  • ๐Ÿฐ Simpler read, write, serve, and spawn utilities
  • ๐Ÿง  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

๐Ÿ“ฆ Installation

bun add @reliverse/rebun
# or: npm install @reliverse/rebun

๐Ÿš€ Usage

import { 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!");
});

๐Ÿ”ง API Overview

๐Ÿ“„ Files

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 missing

๐ŸŒ Server

serve(({ 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)

๐Ÿ–ฅ Process

const result = await run("echo Hello!");
console.log(result.stdout); // "Hello!"

๐Ÿงช Examples

Hello World Server

import { serve } from "@reliverse/rebun";

serve(() => new Response("Hello world!"));

Bun Script with Better File Handling

import { readFile, writeFile } from "@reliverse/rebun";

const data = await readFile("data.json");
await writeFile("backup.json", data);

๐Ÿ”ฎ Roadmap

  • 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

๐Ÿ‘ถ Whoโ€™s It For?

  • ๐Ÿ†• 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 bun in package.json:

    Why? In some setups โ€” like when I was building @reliverse/relidler โ€” you might be forced to add bun as a dep just to pass tools like JSR. But that breaks tools like knip that flag unused deps. The fix? Add "ignoreDependencies": ["bun"] in your knip.json. Or... just use @reliverse/rebun, which acts as a thin wrapper with zero overhead and smooth developer ergonomics.

๐Ÿง  Similar Projects

๐Ÿ’ฌ Community

๐Ÿ“„ License

๐ŸŒ€ This README was proudly generated with Remdn

About

@reliverse/rebun

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors