The fan-out/fan-in pattern splits work across multiple parallel branches, processes each branch independently, then merges all results back together.
The fan-out/fan-in pattern splits work across multiple parallel branches, processes each branch independently, then merges all results back together. This is essential when you need data from multiple independent sources to produce a single output, and you want all sources queried simultaneously rather than sequentially.
Real-world example: Your daily report workflow needs data from three independent APIs -- GitHub (commits), Jira (tickets), and Datadog (error rates). Fetching them sequentially takes 12 seconds; in parallel it takes 4 seconds (the slowest single API).
Schedule Trigger (daily at 08:00)
|
+---> GitHub - Get Commits (yesterday) --> Set: format_github
|
+---> Jira - Get Resolved Tickets --> Set: format_jira
|
+---> HTTP Request - Datadog Error Rates --> Set: format_datadog
|
Merge Node (mode: Append, wait for all 3)
|
Code Node: Build Report
|
Slack - Post Daily Summary
```text
```javascript title="Code Node: Build Report"
// All three data sources arrive as separate items
const items = $input.all();
const github = items.find(i => i.json.source === 'github')?.json;
const jira = items.find(i => i.json.source === 'jira')?.json;
const datadog = items.find(i => i.json.source === 'datadog')?.json;
const report = {
date: new Date().toISOString().split('T')[0],
summary: [
`Commits: ${github?.commit_count ?? 'N/A'} across ${github?.repos ?? 'N/A'} repos`,
`Tickets Resolved: ${jira?.resolved_count ?? 'N/A'} (${jira?.story_points ?? 'N/A'} story points)`,
`Error Rate: ${datadog?.error_rate ?? 'N/A'}% (${datadog?.trend ?? 'N/A'} vs yesterday)`,
].join('\n'),
details: { github, jira, datadog }
};
return [{ json: report }];
```text
```text title="Slack Message Output"
Daily Engineering Report - 2025-01-15
--------------------------------------
Commits: 23 across 4 repos
Tickets Resolved: 12 (34 story points)
Error Rate: 0.3% (down vs yesterday)
```text
> **Note: Merge Node Wait Behavior**
>
> When three branches connect to a single Merge node in "Append" mode, the Merge node waits until all three branches have completed before passing data downstream. If one branch fails, the Merge node can be configured to continue with partial data or stop the workflow.
This pattern reduces overall execution time from the sum of all API call times to the time of the slowest single call.
**Related:** [Use Path Parameters in Webhook URLs for Dynamic Routing](../webhook-mastery/01-use-path-parameters-in-webhook-urls-for-dynamic-routing.md) | [Use Edit Fields in "Map Each" Mode for Simple Renames](../data-transformation/01-use-edit-fields-in-map-each-mode-for-simple-renames.md)
I build production n8n and Cloudflare automation for teams — the same engineering behind HarperFlow. Fixed-price, escrow-protected, US-based.