Private betav0.1.0
Docs
Format developer documentation

Node.js

Deploy Format to a Node.js server.

For Node.js servers (Express, Fastify, Hono, etc.), deploy the _generated directory alongside your app. The node target reads assets from the filesystem automatically. No extra configuration needed.

Build script

Compile your Format documents as part of your build:

package.json
{
	"scripts": {
		"build": "format compile && tsc",
		"start": "node dist/index.js"
	}
}

Dependencies

The node target externalizes dependencies by default. Your framework packages (react, react-dom or vue) and any packages your documents import must be installed in node_modules at runtime.

To bundle a package into the compiled output instead, use the --bundle flag:

npx format compile --bundle date-fns @company/shared-utils

Assets

On the node target, assets are read from the filesystem automatically. No extra setup needed.

const doc = await invoice.render(data)

const format = new FormatClient()
const response = await format.pdf(doc)

See Assets for alternative strategies like CDN-hosted or runtime-generated ZIPs.

Was this page helpful?