TypeScript · Integration

Add E-Signatures to Bun

Send documents for legally binding e-signature from your Bun application. One endpoint, no SDK required.

Quick start

  1. Get an API key from signb.ee (free, no credit card)
  2. Set SIGNBEE_API_KEY in your environment
  3. Add the code below to your app

Bun example

TypeScript
Bun.serve({
  port: 3000,
  async fetch(req) {
    if (req.method !== "POST") return new Response("Not found", { status: 404 });
    const body = await req.json();
    const res = await fetch("https://signb.ee/api/send", {
      method: "POST",
      headers: {
        Authorization: `Bearer ${Bun.env.SIGNBEE_API_KEY}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify(body),
    });
    return new Response(await res.text(), {
      headers: { "Content-Type": "application/json" },
    });
  },
});

What happens

  1. Your app sends markdown or a PDF URL to Signbee
  2. Signbee generates a PDF (if markdown) and emails the recipient a signing link
  3. Recipient signs — both parties receive the signed PDF with SHA-256 certificate

Also works with AI agents

Install the MCP server to let Claude, Cursor, or Windsurf send documents directly:

npx -y signbee-mcp

Integration details

Bun is the fastest JavaScript runtime, designed as a drop-in Node.js replacement with native TypeScript support, a built-in bundler, and a built-in HTTP server. Adding e-signatures to Bun is nearly identical to Deno — built-in fetch, built-in server, zero dependencies.

Performance: Bun's HTTP server handles significantly more requests per second than Node.js. For high-volume contract signing services, Bun provides the best JavaScript runtime performance without code changes.

Bun.env: Access environment variables via Bun.env.SIGNBEE_API_KEY (shown in the example). Bun automatically loads .env files without dotenv. This simplifies development setup compared to Node.js.

Node.js compatibility: Bun is designed as a Node.js drop-in replacement. Your existing Express, Fastify, or Hono code runs on Bun without modifications. The example shows Bun's native server, but any Node.js framework works too.

Bun.build: Use Bun's built-in bundler for production builds. This eliminates the need for webpack, esbuild, or rollup in your toolchain. A single bun build command produces an optimised production bundle.

Package management: Bun's package manager is the fastest available. Install dependencies with bun install (10-100x faster than npm). Lock file format is compatible with npm for team environments.

FAQs

How do I add e-signatures to Bun?

Get an API key from signb.ee (free, no credit card), set SIGNBEE_API_KEY in your environment, and add a single POST request to your Bun application. The recipient receives a signing link by email, signs on any device, and both parties get a SHA-256 certified PDF.

Does Signbee work with Bun?

Yes. Signbee is a REST API that works with any language or framework including Bun. Send a POST request with your document content, sender and recipient details, and Signbee handles the entire signing ceremony. No SDK required.

Is Bun faster than Node.js for API calls?

Yes. Bun's HTTP server handles significantly more requests per second than Node.js. For the Signbee API call itself (which is network-bound), the difference is small, but for overall server throughput under load, Bun provides measurably better performance.

Can I use my existing Node.js code with Bun?

Yes. Bun is a drop-in Node.js replacement. Your Express, Fastify, or Hono code runs without modifications. You can also use Bun's native server (Bun.serve) for the simplest possible integration.

How do I load environment variables in Bun?

Bun automatically loads .env files without dotenv. Access variables via Bun.env.SIGNBEE_API_KEY. No additional packages or configuration needed.

Related resources

Try Signbee — free, no credit card.