Vercel
Deploy Format to Vercel.
Next.js
The withFormat Next.js plugin handles Vercel deployment automatically. It configures:
serverExternalPackages: adds@format.dev/compileand all detected externals from the node buildoutputFileTracingIncludes: ensures the_generateddirectory is included in the standalone build output
No manual configuration needed. Run next build and deploy.
Serverless functions (non-Next.js)
For Vercel serverless functions without Next.js, deploy the _generated directory alongside your function code.
Compile your documents as part of your build:
{
"scripts": {
"build": "format compile"
}
}The node target works out of the box. Vercel serverless functions have filesystem access, and format.pdf(doc) reads assets automatically.
Edge functions
Vercel Edge functions cannot read from the filesystem. Use the worker target and host your asset ZIPs externally:
npx format compile --preset edgeUpload the generated assets.zip files to Vercel Blob, S3, or another CDN. Then call setAssetsUrl at runtime:
invoice.setAssetsUrl(process.env.ASSETS_URL!)
const doc = await invoice.render(data)See Assets for more on CDN-hosted assets.
Environment variables
Add FORMAT_API_KEY to your Vercel project environment variables in the Vercel dashboard or via CLI:
vercel env add FORMAT_API_KEY