After building hundreds of n8n workflows, certain patterns keep proving their worth. Here are five I now use in almost every project.
1. Error Handler Sub-Workflow
Don't scatter error handling across your main workflow. Create a dedicated error handler:
Main Workflow → On Error → Call Error Handler Sub-Workflow
The error handler:
- Logs the full error context
- Sends alerts (Slack/email)
- Stores failed items for retry
- Tracks error frequency
One place to manage all error logic.
2. Config Node at Start
First node in every workflow: a Set node with configuration.
{
"env": "production",
"batchSize": 100,
"retryAttempts": 3,
"alertChannel": "#ops-alerts",
"dryRun": false
}
Change behavior without editing logic. Toggle dry-run mode. Adjust batch sizes. All in one place.
3. Idempotency Checks
Before processing any item, check if it's already been handled:
// Check processed items table
const alreadyProcessed = await checkDatabase(item.id);
if (alreadyProcessed) {
return []; // Skip
}
This prevents:
- Duplicate emails
- Double charges
- Repeated API calls
Essential for workflows that might retry.
4. Batch + Delay Pattern
When hitting APIs with rate limits:
Split In Batches (10 items) → Process → Wait (1 second) → Loop
Simple but prevents 90% of rate limit issues. Adjust batch size and delay based on the API's limits.
5. Health Check Workflow
Separate workflow that monitors your other workflows:
- Check execution history for failures
- Verify expected runs happened
- Test critical API connections
- Alert if something's off
Run it every hour. Know about problems before users do.
Bonus: Logging Pattern
Every workflow should log:
- Start time and trigger info
- Items processed count
- Any skipped items and why
- Duration and outcome
Store in a simple database or even a Google Sheet. Invaluable for debugging.
Implementation Tips
Start simple. Don't add all patterns to every workflow. Add them as you need them.
Use sub-workflows. Error handlers, logging, and notifications should be reusable.
Document decisions. Sticky notes in n8n explaining WHY something works a certain way.
Version control. Export workflows regularly. Use git.
The Result
Workflows that:
- Handle failures gracefully
- Are easy to debug
- Don't break under load
- Can be modified safely
That's the difference between a prototype and production.
More production patterns at mardenseo.com/n8n/tutorials
Top comments (0)