Skip to content

Recipes

David Reed edited this page Nov 20, 2026 · 2 revisions

estrogen fits a handful of build shapes. Each recipe is a full setup: the config, the command or plugin, and what lands. For the config file see Configuration, for the flags CLI, and for each plugin its own page.

Vendor a transport and obfuscate the app

The job SystemYA's prepare scripts did by hand: pull a proxy transport out of node_modules into the served tree under a stamped name, rewrite its wasm reference, and obfuscate the app chunks, in one estrogen build.

estrogen.toml:

[[vendor]]
from = 'node_modules/@mercuryworkshop/epoxy-transport/dist'
to = 'assets'
mode = 'verbatim'          # a transport runs on the hot path, so do not encrypt it
stamp = true

	[[vendor.rewrite]]
	find = 'epoxy.wasm'
	to = 'ln.{stamp}.wasm'

[[canary]]
value = 'epoxy'
reason = 'transport package name'
estrogen build -c estrogen.toml dist

The transport lands under dist/assets with a per-build stamp in its name, its epoxy.wasm reference rewritten to the stamped name, and the app chunks in dist obfuscated. The build fails closed if epoxy survives in plaintext anywhere.

Obfuscate several output dirs at once

A site that emits more than one tree (an AWS build, a jsDelivr cloak, a single-file build) obfuscates them in one run:

estrogen aws/dist svg/jsdelivr singlefile

Each dir is walked and rewritten in place. estrogen with no build vendors nothing; it obfuscates what the bundler already wrote.

Vite

import { defineConfig } from 'vite';
import { pluginEstrogen } from '@sysce/estrogen/vite';

export default defineConfig({
	plugins: [pluginEstrogen({ config: 'estrogen.toml' })],
});

Runs after vite build writes the output, over build.outDir. See Vite.

Rollup

import { pluginEstrogen } from '@sysce/estrogen/rollup';

export default {
	input: 'src/index.js',
	output: { dir: 'dist', format: 'es' },
	plugins: [pluginEstrogen({ config: 'estrogen.toml' })],
};

See Rollup.

esbuild

import { build } from 'esbuild';
import estrogen from '@sysce/estrogen/esbuild';

await build({
	entryPoints: ['src/index.js'],
	bundle: true,
	outdir: 'dist',
	plugins: [estrogen({ config: 'estrogen.toml' })],
});

See esbuild.

Astro

import estrogen from '@sysce/estrogen/astro';
import { defineConfig } from 'astro/config';

export default defineConfig({
	integrations: [estrogen({ config: 'estrogen.toml' })],
});

Runs on astro:build:done, over the final static output directory (the client output directory for an SSR build). See Astro.

Watch while you develop

Run the bundler's own watch build and estrogen's watcher beside it, so each rebuild is re-obfuscated:

vite build --watch &
estrogen --watch dist

estrogen re-runs on each debounced change and obfuscates only the fresh chunks the bundler wrote; its own output carries a marker and is skipped. Dev-server hot reload through a plugin is a separate seam, so run the watcher beside the dev server for now. See Watcher.

The limit

Every recipe here raises the cost of reading the build; none makes it secret. A decoder key ships in each file. See Security and limits.

Clone this wiki locally