Patterns10 min readUpdated 2026-06-29
Advanced Xero Patterns in n8n
Sub-workflows, dynamic routing, and event-sourced Xero pipelines in n8n — for the ambitious.
Key takeaways
- Sub-workflows are functions.
- Routing tables beat if-else forests.
- Event sourcing makes debugging trivial.
- Per-key locks prevent races.
Once your Xero workflows outgrow single-flow linear logic, these patterns keep them maintainable at 10x scale.
Sub-workflows
Extract every reusable Xero action into a sub-workflow. Version them like functions. Call from anywhere.
Dynamic routing
Use a routing table (Postgres or JSON) to decide which sub-workflow handles each Xero event. Add types without redeploying.
Event sourcing
Persist every raw Xero event to a log. Rebuild any downstream projection by replaying the log. Debugging becomes trivial.
Concurrency
Queue mode plus per-key concurrency locks. Two workflows never step on the same Xero record.
Frequently asked questions
- When do I need these?
- Around the 20th workflow, or when incidents spike.
- Overhead?
- Real but small — the payoff is at scale.
- Alternative?
- Move to a full code service. But most teams don't need to.
- Where to start?
- Extract your most-copied logic into a sub-workflow this week.