n8n is fantastic for prototyping and visual orchestration. You can wire up webhooks, databases, and LLM calls in minutes.
The pain starts when a workflow grows into critical production infrastructure:
To solve this without rewriting everything by hand, I built n8n-to-fastify — an Ahead-of-Time (AOT) compiler that converts exported n8n workflow JSONs into standalone Fastify + TypeScript microservices.
Instead of interpreting JSON nodes dynamically at runtime, n8n-to-fastify parses the workflow DAG, resolves node dependencies and n8n expressions, and emits clean, idiomatic TypeScript modules (workflow.ts + routes/index.ts).
Webhook, Respond to Webhook
IF / Filter, Switch, Merge, Split Out, Aggregate, Wait
Set / Edit Fields, Code / Function
HTTP Request, PostgreSQL, OpenAI / Gemini
Execute Workflow compiled to an in-memory WorkflowRegistry (zero network round-trip between subworkflows)
On a compiled Lead Intake + Subworkflow validation pipeline (bun run benchmark):
2.77 ms
1,885 req/s
0.530 ms
0.742 ms
It does not cover all 400+ n8n community nodes yet. When the compiler encounters an unsupported node, it generates a typed TODO stub in the output TypeScript so you can drop in your own SDK or handler cleanly. Credentials are mapped to environment variables (process.env).
Paste any exported n8n workflow JSON into the in-browser playground or clone the CLI:
git clone https://github.com/rogeriomaciel/n8n-to-fastify
cd n8n-to-fastify
bun install
bun test
If a real-world workflow from your stack breaks on a specific node or expression ($json, $('Node'), etc.), open an issue on GitHub — and if you find the approach useful, a Star helps a lot!