Skip to content

Programmatic API

Import Kiln compiler functions directly into TypeScript or JavaScript build scripts:

import { compileApp, compileStandalone, generateEntryPoint } from "kiln-compiler";

Executes the full end-to-end compilation workflow:

const result = compileApp({
projectDir: "./apps/web",
outputFile: "./bin/app",
framework: "next", // optional (auto-detected if omitted)
});
console.log(result.outputFile); // Path to generated executable
console.log(result.framework); // Detected framework

Generates the asset manifest and server entrypoint without running Bun compile:

import { generateEntryPoint, getAdapter } from "kiln-compiler";
const adapter = getAdapter("next")!;
generateEntryPoint({
standaloneDir: "./.next/standalone",
distDir: "./.next",
projectDir: process.cwd(),
adapter,
});

Compiles the generated entrypoint using bun build --compile:

import { compileStandalone } from "kiln-compiler";
compileStandalone({
standaloneDir: "./.next/standalone",
outfile: "./bin/app",
});