esbuild changed the game for web development. Its blazing-fast performance, written in Go, demonstrated that JavaScript build tooling could be orders of magnitude faster. We went from waiting minutes for builds to waiting seconds—or even milliseconds.
Typically, you interact with this power by installing it via npm and running it from your command line or a local script. But what if you need that speed in an environment where npm install isn't an option? What if you want to access the power of a premier JavaScript bundler without managing the toolchain?
This is where an API-first approach shines. At esbuild.do, we provide esbuild as a Service, giving you full access to its incredible bundling and minification capabilities through a simple, scalable API. This isn't just about convenience; it unlocks powerful new workflows that are difficult or impossible with a local-only tool.
Let's explore five scenarios where the esbuild.do API is an absolute game-changer.
Imagine building the next CodePen, a documentation site with live-editable examples, or an in-browser IDE. Your users write TypeScript, JSX, or modern JavaScript, and they expect to see the bundled, executable result instantly.
The Challenge: You can't run the esbuild binary in the user's browser. Setting up a dedicated backend server to receive code, write it to disk, run the esbuild process, read the output, and send it back is complex. It introduces scaling challenges, security concerns, and maintenance overhead.
The esbuild.do Solution: Your frontend can simply send the user's code directly to our API. We handle the bundling in a virtual file system and return the compiled code immediately. It's a single, stateless API call that is secure, infinitely scalable, and requires zero backend build tool management from you.
In a Continuous Integration/Continuous Deployment (CI/CD) pipeline, every second counts. Long build times mean slower feedback loops and delayed deployments.
The Challenge: A standard npm install && npm run build step can be surprisingly slow. It involves downloading hundreds of megabytes of dependencies and running multiple scripts. Caching node_modules can be tricky and unreliable across different CI providers.
The esbuild.do Solution: Replace that entire multi-step process with a single, atomic API call using curl or our SDK. Your build step becomes:
This drastically simplifies your pipeline configuration, reduces build times, and eliminates a common source of CI failures. It's the ultimate build tool as a service.
Serverless platforms like AWS Lambda, Vercel Functions, and Cloudflare Workers are powerful, but they have constraints. Deployment package size is limited, and including native binaries (like the one esbuild relies on) can be impractical or impossible.
The Challenge: You want to perform a build or transformation step within a serverless function—perhaps to generate a custom script on-the-fly. Packaging esbuild within your function would bloat its size, increase cold start times, and complicate your deployment.
The esbuild.do Solution: Your serverless function can remain lean and fast. When a build is needed, it simply makes an outbound HTTP request to the esbuild.do API. This offloads the heavy lifting to a dedicated, optimized service, keeping your function small and focused on its core logic.
Your application might need to generate assets dynamically. Consider a multi-tenant CMS where each user can add custom CSS, or a theme engine that compiles user-defined variables into a final stylesheet.
The Challenge: Running a Node.js subprocess from a backend written in another language (like Go, Python, Ruby, or PHP) is clunky. It creates a tight coupling with the Node.js ecosystem, introduces security risks if handling user input, and adds another moving part to maintain.
The esbuild.do Solution: Your backend, regardless of the language, can communicate with esbuild.do using a simple HTTP client. Send the raw TS, JS, or CSS strings to our esbuild API and get back minified, bundled code. This decouples your core application from your build tooling, making your system more robust and easier to manage.
Sometimes you just need to bundle a few files. You might be a data scientist writing a Python script or a systems engineer building a tool in Go, and you need to compile a small TypeScript helper for a web view.
The Challenge: Setting up a full Node.js project with package.json and node_modules just to bundle two files feels like overkill. You don't want the cognitive overhead of managing a separate ecosystem for a minor task.
The esbuild.do Solution: With a simple API call, esbuild becomes a universal utility accessible from any language or scripting environment. You can bundle your web assets without ever leaving your preferred development environment.
Integrating esbuild.do is incredibly straightforward. Using our agentic workflow SDK, you can bundle code from strings in just a few lines. All the familiar esbuild options are supported.
import { Agent } from '@do-business/sdk';
const esbuild = new Agent('esbuild.do');
// Bundle TypeScript code from a string
async function bundle() {
const { code, map } = await esbuild.bundle({
entryPoints: ['index.ts'],
sources: {
'index.ts': 'const greet = (name: string): string => `Hello, ${name}!`; console.log(greet("World"));'
},
bundle: true,
minify: true,
platform: 'node',
target: 'es2020'
});
console.log('--- Bundled JS ---');
console.log(code);
}
bundle();
The key here is the sources object, which acts as a virtual file system. You provide entry points and file content as strings, and our agent handles the rest, returning the final code and source maps.
Q: What is esbuild.do?
A: esbuild.do provides esbuild's powerful bundling, transpilation, and minification capabilities as a simple and robust API. It allows you to integrate a high-speed build step into any application or workflow without installing or configuring local build tools.
Q: Why use an API for esbuild instead of the CLI?
A: Using esbuild.do abstracts away the complexity of managing binary dependencies, versions, and build environments. It's perfect for serverless functions, CI/CD pipelines, online playgrounds, and any environment where installing Node.js and npm packages is inconvenient.
Q: What languages and formats does esbuild.do support?
A: Just like the underlying tool, our agent supports JavaScript (JS, JSX) and TypeScript (TS, TSX). It can also bundle CSS, load JSON files, and handle various output formats like IIFE, CommonJS (CJS), and ES Modules (ESM).
Q: How does source data work with the bundle method?
A: You provide an object where keys are filenames and values are the file content as strings. Our agent creates a virtual file system to process these, resolves imports between them, and returns the final bundled code.
The command line is great, but it's not the only way. By moving your build step to an API call, you can simplify your infrastructure, accelerate your pipelines, and enable powerful new features in your applications.
Ready to harness EXTREMELY FAST BUNDLING without the hassle? Visit esbuild.do to explore the docs and make your first API call in minutes.