10LOC

#zero-dependency

Bunintermediate

Use Bun.write for zero-dependency file output

import { write } from "bun";

export const saveJsonReport = (path: string, report: Record<string, unknown>) =>
  write(path, JSON.stringify(report, null, 2) + "\n");

Write files in Bun without extra dependencies or shelling out.

Bunintermediate

Bun.serve() with a routes object: a zero-dependency HTTP server

export const app = Bun.serve({
  routes: {
    "/api/health": new Response("ok"),
    "/api/users/:id": (req) => Response.json({ id: req.params.id }),
    "/api/users": {

Bun.serve()'s routes option matches paths, HTTP methods, and :params natively, replacing a router dependency for most REST APIs.