🚀 On-Demand Bundler API

A high-performance bundler API powered by Bun that bundles React/Vite apps on-demand in the cloud.

Endpoints

POST /bun

Bundle your React/Vite app with multiple entry points

Request Body:

{
  "files": {
    "index.tsx": "import React from 'react'; ...",
    "App.tsx": "export function App() { ... }",
    "package.json": "{ ... }"
  },
  "entrypoints": ["index.tsx"],
  "minify": true,
  "sourcemap": "none",
  "target": "browser",
  "splitting": true,
  "format": "esm",
  "development": false
}

Response (Success):

{
  "success": true,
  "outputs": [
    {
      "path": "index.tsx",
      "content": "...",
      "kind": "entry-point",
      "size": 12345
    }
  ],
  "buildTime": 123.45,
  "logs": [
    {
      "message": "Warning message",
      "level": "warning",
      "position": {
        "file": "App.tsx",
        "line": 10,
        "column": 5,
        "lineText": "  const x = 1;"
      }
    }
  ]
}

Response (Error):

{
  "success": false,
  "error": "Build failed",
  "buildTime": 45.67,
  "logs": [
    {
      "message": "Cannot find module 'react'",
      "level": "error",
      "position": {
        "file": "index.tsx",
        "line": 1,
        "column": 23,
        "lineText": "import React from 'react';"
      }
    }
  ]
}

POST /esbuild

Bundle your React/Vite app using esbuild (same request/response as /bun)

Uses a virtual file system instead of writing temp files to disk

GET /health

Health check endpoint

Options

Examples

See example-client.ts for usage examples.