{"slug": "compiling-n8n-workflow-jsons-into-standalone-fastify-typescript-microservices", "title": "Compiling n8n Workflow JSONs into Standalone Fastify/TypeScript Microservices (Open-Source + Client-Side Playground)", "summary": "A developer released n8n-to-fastify, an open-source ahead-of-time compiler that converts exported n8n workflow JSON into standalone Fastify and TypeScript microservices, resolving the workflow DAG, node dependencies and n8n expressions into idiomatic TypeScript modules rather than interpreting nodes at runtime. On a compiled Lead Intake plus subworkflow validation pipeline, the generated service handled 1,885 requests per second at 2.77 ms average latency, with 0.530 ms and 0.742 ms reported for the subworkflow path. The tool covers a subset of n8n's 400-plus community nodes, emitting typed TODO stubs for unsupported ones, maps credentials to environment variables, and is available via CLI and an in-browser playground.", "body_md": "n8n is fantastic for prototyping and visual orchestration. You can wire up webhooks, databases, and LLM calls in minutes.\n\nThe pain starts when a workflow grows into critical production infrastructure:\n\nTo 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.\n\nInstead 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`).\n\n`Webhook`, `Respond to Webhook`\n`IF / Filter`, `Switch`, `Merge`, `Split Out`, `Aggregate`, `Wait`\n`Set / Edit Fields`, `Code / Function`\n`HTTP Request`, `PostgreSQL`, `OpenAI / Gemini`\n`Execute Workflow` compiled to an in-memory `WorkflowRegistry` (zero network round-trip between subworkflows)\nOn a compiled Lead Intake + Subworkflow validation pipeline (`bun run benchmark`):\n\n`2.77 ms`\n`1,885 req/s`\n`0.530 ms`\n`0.742 ms`\nIt 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`).\n\nPaste any exported n8n workflow JSON into the [in-browser playground](https://www.rogeriomaciel.com.br/en/n8n-to-fastify/) or clone the CLI:\n\n```\ngit clone https://github.com/rogeriomaciel/n8n-to-fastify\ncd n8n-to-fastify\nbun install\nbun test\n```\n\nIf a real-world workflow from your stack breaks on a specific node or expression (`$json`, `$('Node')`, etc.), open an issue on [GitHub](https://github.com/rogeriomaciel/n8n-to-fastify) — and if you find the approach useful, a **Star** helps a lot!", "url": "https://wpnews.pro/news/compiling-n8n-workflow-jsons-into-standalone-fastify-typescript-microservices", "canonical_source": "https://dev.to/rogerio_maciel_ebdfaa587e/compiling-n8n-workflow-jsons-into-standalone-fastifytypescript-microservices-open-source--2nd3", "published_at": "2026-11-15 22:12:24+00:00", "updated_at": "2026-11-15 22:25:13.484972+00:00", "lang": "en", "topics": ["developer-tools", "ai-tools", "ai-agents", "ai-infrastructure"], "entities": ["n8n", "Fastify", "TypeScript", "GitHub", "OpenAI", "Gemini", "PostgreSQL", "Bun"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/compiling-n8n-workflow-jsons-into-standalone-fastify-typescript-microservices", "markdown": "https://wpnews.pro/news/compiling-n8n-workflow-jsons-into-standalone-fastify-typescript-microservices.md", "text": "https://wpnews.pro/news/compiling-n8n-workflow-jsons-into-standalone-fastify-typescript-microservices.txt", "jsonld": "https://wpnews.pro/news/compiling-n8n-workflow-jsons-into-standalone-fastify-typescript-microservices.jsonld"}}