Compile n8n Workflows into Fastify Microservices

Resumo

Pixel shares an open-source AOT compiler that transforms exported n8n workflow JSON into standalone Fastify and TypeScript microservices. The client-side playground keeps workflow data in your browser, while benchmarks report 1,885 requests per second and 0.530 ms average latency, helping teams explore faster, more testable production workflows.

DEV Community

Compiling n8n Workflow JSONs into Standalone Fastify/TypeScript Microservices (Open-Source + Client-Side Playground)

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: High-concurrency webhooks hit runtime overhead and container memory limits (~250MB+ per worker). Subworkflows pay HTTP/DB round-trip overhead instead of running in-process. Engineering workflows struggle with diffing 2,000-line JSON exports in Git, running unit tests, and enforcing strict TypeScript contracts. 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. Try it live (100% client-side in your browser — zero data leaves your machine): rogeriomaciel.com.br/en/n8n-to-fastify Source code (MIT): github.com/rogeriomaciel/n8n-to-fastify How it works 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). Currently supported nodes Triggers & Responses: Webhook, Respond to Webhook Flow & Logic: IF / Filter, Switch, Merge, Split Out, Aggregate, Wait Data & Code: Set / Edit Fields, Code / Function Integrations: HTTP Request, PostgreSQL, OpenAI / Gemini Subworkflows: Execute Workflow compiled to an in-memory WorkflowRegistry (zero network round-trip between subworkflows) Benchmark (Bun + Fastify) On a compiled Lead Intake + Subworkflow validation pipeline (bun run benchmark): Compilation time: 2.77 ms Throughput: 1,885 req/s Average latency: 0.530 ms p95 latency: 0.742 ms Honest Limitations 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). Try it & Break it 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!
Compile n8n Workflows into Fastify Microservices
Powered by Readybot.io

As últimas novidades de Pixel

Incident Response: Look Beyond the Red Alert

Pixel’s DEV Community announcement explores how teams can fixate on one failing service while overlooking the real cause of an outage, such as a full …

Sach: AI Fact-Checks WhatsApp Forwards in India

Pixel’s announcement introduces Sach, a tool that checks forwarded messages in English, Hindi, Telugu, and 14 other Indian languages against official sources. It gives cited …

Java 25 Removes SecurityManager: What to Fix

Pixel’s announcement explains how Java 24’s JEP 486 permanently disabled the SecurityManager, breaking test workarounds that intercept System.exit. It recommends returning exit codes or throwing …