Quick Start
Render your first 3D model with @taucad/runtime in under 4 minutes.
Render a 3D model from TypeScript code with the Replicad kernel and export it to binary glTF.
Prerequisites
- Node.js 24 or later
- A package manager: npm, pnpm, or yarn
Install
pnpm add @taucad/runtime @taucad/replicad @taucad/esbuild zodFor framework wiring (Vite, Next.js, Electron), see Installation.
Render a 3D Model
Create a file called render.ts and paste the following code:
import { defineRuntime } from '@taucad/runtime';
import { createNodeClient } from '@taucad/runtime/node';
import { esbuild } from '@taucad/esbuild';
import { replicad } from '@taucad/replicad';
const runtime = defineRuntime({ plugins: [esbuild(), replicad()] });
const client = await createNodeClient({ runtime });
const code = 'import { makeBaseBox } from "replicad";\nexport default () => makeBaseBox(30, 50, 10);';
const document = client.open({ source: { files: { 'main.ts': code } } });
const result = await document.export('glb');
if (!result.success) throw new Error(`Export failed: ${result.issues[0]?.message}`);
console.log(`Exported ${result.files[0].name}: ${result.files[0].bytes.byteLength} bytes`);
document.close();
await client.shutdown();Run it:
npx tsx render.tsYour application owns the runtime definition: defineRuntime composes the kernel and bundler plugins, and createNodeClient supplies the transport and — with no project path — an in-memory filesystem. The inline source.files map is staged into that filesystem, and the opening the document starts evaluation.
To read model files from disk instead, set projectPath: createNodeClient({ runtime, projectPath: '/path/to/project' }), then open with source: { path: 'main.ts' }.
Expected Output
Exported model.glb: 5824 bytesThe exact byte count depends on the model and tessellation settings. result.files is an ordered, non-empty array of export files. A GLB export returns one file; other formats may return companions (glTF + BIN, OBJ + MTL), so iterate the array when you switch formats:
import type { ExportResult } from '@taucad/runtime';
export const logFiles = (result: ExportResult): void => {
if (!result.success) return;
for (const file of result.files) {
console.log(`Exported ${file.name}: ${file.bytes.byteLength} bytes (${file.mimeType})`);
}
};Each file's bytes is a Uint8Array you can write to disk, stream over HTTP, or hand to a glTF viewer.
This snippet runs one evaluation-and-export cycle. For viewers that re-render on parameter changes or file edits, see Live Rendering.
What's Next
- Your First Kernel — Build a parametric model and export STEP
- Choose a Kernel — Compare the supported kernels
- API Reference: Client — Full documentation for
createRuntimeClientandRuntimeDocument.export