DEV Community

Karan Singh
Karan Singh

Posted on

I Built a Production-Style Automation System Using n8n

Most automation tutorials show how to connect nodes and get a quick result. I wanted to understand how automation systems work in real-world conditions.

So I built a two-workflow automation system using n8n, designed with safety, testing, and idempotency in mind.

This post explains the architecture and the engineering decisions behind it.

The Problem I Wanted to Solve

I wanted an automation that:

  • Accepts incoming data reliably
  • Stores it safely
  • Processes it on a schedule
  • Avoids duplicate processing
  • Can be re-run without breaking things

That’s a very common backend automation pattern.

High-Level Architecture

I split the system into two workflows, each with a single responsibility.

Workflow 1 (Writer)
Webhook → Google Sheets

Workflow 2 (Processor)
Schedule → Read Sheet → Transform → Email → Update Status
Enter fullscreen mode Exit fullscreen mode

This separation makes the system easier to test and reason about.

Workflow 1: Webhook → Google Sheets

Workflow 1 acts as a data ingestion layer.

  • Trigger: Webhook (POST)
  • Testing: Mock data inside n8n
  • Output: Append row to Google Sheets

Example mock payload:

{
  "type": "TASK",
  "text": "Finish n8n automation project",
  "createdAt": "2026-01-15T10:30:00Z",
  "status": "PENDING"
}
Enter fullscreen mode Exit fullscreen mode

This workflow is simple, reliable, and easy to extend.

Workflow 2: Scheduled Processing

Workflow 2 runs on a Schedule Trigger (cron-style execution).

Key rule:
Only process rows where:

status = PENDING
Enter fullscreen mode Exit fullscreen mode

This ensures:

  • rows are processed once
  • workflows can be safely re-run
  • failures don’t cause duplicates

JavaScript for Transformation

I used a Code node to format email content:

return items.map(item => ({
  json: {
    subject: `New ${item.json.type}`,
    body: `
Type: ${item.json.type}
Text: ${item.json.text}
Created At: ${item.json.createdAt}
`
  }
}));
Enter fullscreen mode Exit fullscreen mode

This keeps transformation logic separate from infrastructure.

Email + Status Update

After sending the email:

  • The workflow updates the same row
  • status is set to SENT

This completes the idempotency loop.

Testing Strategy

I tested in this order:

  • Run Workflow 1 manually
  • Verify Google Sheet output
  • Run Workflow 2 manually
  • Verify email delivery
  • Verify status update

Only then did I activate the workflows.

What I Learned

  • Automation is still software engineering
  • Schema-first design saves time later
  • Idempotency is non-negotiable
  • Testing triggers properly matters
  • n8n can act like a lightweight backend

What’s Next

  • Error workflows
  • Alerts on failures
  • Webhook authentication
  • Workflow chaining
  • Logging & monitoring

If you’re learning automation tools like n8n:

Don’t build demos. Build systems.

That’s where real understanding comes from.

Top comments (0)