salesforce-architecture-variants

Choose and implement Salesforce integration architecture patterns for different scales. Use when designing new Salesforce integrations, choosing between polling/event-driven/Heroku Connect, or planning migration paths for Salesforce applications. Trigger with phrases like "salesforce architecture", "salesforce integration pattern", "how to structure salesforce integration", "salesforce event-driven", "salesforce Heroku Connect".

1,868 stars

Best use case

salesforce-architecture-variants is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Choose and implement Salesforce integration architecture patterns for different scales. Use when designing new Salesforce integrations, choosing between polling/event-driven/Heroku Connect, or planning migration paths for Salesforce applications. Trigger with phrases like "salesforce architecture", "salesforce integration pattern", "how to structure salesforce integration", "salesforce event-driven", "salesforce Heroku Connect".

Teams using salesforce-architecture-variants should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/salesforce-architecture-variants/SKILL.md --create-dirs "https://raw.githubusercontent.com/jeremylongshore/claude-code-plugins-plus-skills/main/plugins/saas-packs/salesforce-pack/skills/salesforce-architecture-variants/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/salesforce-architecture-variants/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How salesforce-architecture-variants Compares

Feature / Agentsalesforce-architecture-variantsStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Choose and implement Salesforce integration architecture patterns for different scales. Use when designing new Salesforce integrations, choosing between polling/event-driven/Heroku Connect, or planning migration paths for Salesforce applications. Trigger with phrases like "salesforce architecture", "salesforce integration pattern", "how to structure salesforce integration", "salesforce event-driven", "salesforce Heroku Connect".

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Salesforce Architecture Variants

## Overview
Three validated architecture blueprints for Salesforce integrations: Direct API (simple), Event-Driven (scalable), and Middleware/iPaaS (enterprise). Each pattern addresses different scale, latency, and complexity requirements.

## Prerequisites
- Understanding of your data volume and sync frequency requirements
- Decision on unidirectional vs bidirectional data flow
- Knowledge of Salesforce edition (affects available features like CDC)

## Variant A: Direct API Integration (Simple)

**Best for:** MVPs, < 50K records/day, single-direction sync

```
┌─────────────┐     jsforce       ┌─────────────┐
│   Your App  │ ──── REST API ──▶ │  Salesforce  │
│ (Node.js)   │ ◀── SOQL/SOSL ── │     Org      │
└─────────────┘                   └─────────────┘

Data flow:
- App queries SF via SOQL (polling or on-demand)
- App writes to SF via sObject CRUD
- Scheduled cron for periodic sync
```

### Key Characteristics
- Single jsforce connection per process
- Polling-based reads (cron schedule)
- Direct REST writes
- In-memory or Redis caching for describe/metadata
- Suitable for: internal tools, admin dashboards, simple data sync

### Code Pattern
```typescript
// Cron-based sync — runs every 15 minutes
import cron from 'node-cron';

cron.schedule('*/15 * * * *', async () => {
  const conn = await getConnection();

  // Fetch recently modified accounts
  const accounts = await conn.query(`
    SELECT Id, Name, Industry, AnnualRevenue
    FROM Account
    WHERE LastModifiedDate >= ${fifteenMinutesAgo}
  `);

  // Sync to local database
  for (const account of accounts.records) {
    await localDb.upsert('accounts', mapFromSalesforce(account));
  }
});
```

---

## Variant B: Event-Driven Integration (Scalable)

**Best for:** Real-time sync, 50K-5M records/day, bidirectional flow

```
┌─────────────┐                      ┌─────────────┐
│   Your App  │ ◀─── CDC Events ───  │  Salesforce  │
│  (listener) │   Change Data Capture │     Org      │
│             │                      │              │
│             │ ── Bulk API 2.0 ──▶  │              │
│             │    (write-back)      │              │
└──────┬──────┘                      └─────────────┘
       │
  ┌────▼────┐
  │  Queue  │  (Redis/SQS/Pub-Sub)
  │  (async │
  │  writes)│
  └─────────┘
```

### Key Characteristics
- CDC for real-time change notifications (no polling waste)
- Bulk API 2.0 for high-volume writes
- Queue-based async processing for write-back
- ReplayId tracking for event resumption
- Suitable for: CRM sync, data warehouse ETL, real-time dashboards

### Code Pattern
```typescript
// Event-driven — near-real-time sync
import { getConnection } from './salesforce/connection';

const conn = await getConnection();

// Subscribe to Account changes via CDC
conn.streaming.topic('/data/AccountChangeEvent').subscribe(async (event) => {
  const { changeType, recordIds, changedFields } = event.payload.ChangeEventHeader;

  switch (changeType) {
    case 'CREATE':
      await localDb.insert('accounts', mapFromSalesforce(event.payload));
      break;
    case 'UPDATE':
      await localDb.update('accounts', recordIds[0], mapChangedFields(event.payload, changedFields));
      break;
    case 'DELETE':
      await localDb.delete('accounts', recordIds[0]);
      break;
  }
});

// Write-back via queue (async, decoupled)
queue.process('sync-to-salesforce', async (job) => {
  const conn = await getConnection();
  await conn.sobject(job.data.objectType).upsert(
    job.data.records,
    'External_ID__c'
  );
});
```

### Required Salesforce Features
- Change Data Capture (Enterprise Edition+)
- Platform Events (all editions)
- Bulk API 2.0 (all editions with API access)

---

## Variant C: Middleware/iPaaS Integration (Enterprise)

**Best for:** Multi-system integration, 5M+ records/day, complex transformations

```
┌─────────────┐                ┌─────────────┐               ┌─────────────┐
│   Your App  │ ── API ──────▶ │  Middleware  │ ── REST ────▶ │  Salesforce  │
│             │                │ (MuleSoft/   │               │     Org      │
│             │                │  Workato/    │ ◀─ CDC ──────│              │
│             │ ◀─ Webhooks ── │  Zapier)     │               │              │
└─────────────┘                └──────┬───────┘               └─────────────┘
                                      │
                                ┌─────▼──────┐
                                │  Other      │
                                │  Systems    │
                                │ (ERP, DW,   │
                                │  Marketing) │
                                └─────────────┘
```

### Key Characteristics
- Middleware handles transformation, routing, error handling
- Pre-built Salesforce connectors (no custom code for basic sync)
- Visual flow builders for business users
- Enterprise monitoring and audit trails
- Suitable for: multi-system integration, complex business rules, compliance-heavy

### iPaaS Options
| Platform | Salesforce Integration | Best For |
|----------|----------------------|----------|
| MuleSoft | Native (Salesforce owns it) | Enterprise, complex flows |
| Heroku Connect | Bi-directional auto-sync | Simple sync to Postgres |
| Workato | Pre-built recipes | Business user automation |
| Zapier | Trigger-based | Simple 1:1 integrations |
| Dell Boomi | Enterprise iPaaS | Legacy system integration |

---

## Decision Matrix

| Factor | Direct API (A) | Event-Driven (B) | Middleware (C) |
|--------|---------------|-------------------|----------------|
| Records/day | < 50K | 50K-5M | 5M+ |
| Latency | Minutes (polling) | Seconds (CDC) | Depends on config |
| Direction | Usually one-way | Bidirectional | Multi-directional |
| API call efficiency | Medium | High (no polling) | High (batched) |
| Complexity | Low | Medium | Low (config-driven) |
| Cost | jsforce only | jsforce + queue infra | iPaaS license ($$$) |
| SF Edition required | Any with API | Enterprise+ (CDC) | Any |
| Team skills | Node.js developers | Node.js + streaming | Business analysts OK |

## Migration Path

```
Variant A (Direct API)
    │
    │  Growing data volume / need real-time sync
    ▼
Variant B (Event-Driven)
    │
    │  Multiple systems / compliance / no-code needed
    ▼
Variant C (Middleware/iPaaS)
```

## Output
- Architecture variant selected based on requirements
- Integration pattern implemented
- Data flow documented
- Scaling path planned

## Error Handling
| Issue | Cause | Solution |
|-------|-------|----------|
| Polling misses changes | Interval too long | Switch to CDC (Variant B) |
| CDC events lost | No replay tracking | Persist last replayId |
| API limits exhausted | Polling too frequently | Batch with Collections/Bulk API |
| Middleware cost too high | Over-engineered | Start with Variant A or B |

## Resources
- [Salesforce Integration Patterns](https://developer.salesforce.com/docs/atlas.en-us.integration_patterns_and_practices.meta/integration_patterns_and_practices/)
- [Change Data Capture](https://developer.salesforce.com/docs/atlas.en-us.change_data_capture.meta/change_data_capture/)
- [MuleSoft Salesforce Connector](https://docs.mulesoft.com/salesforce-connector/latest/)
- [Heroku Connect](https://devcenter.heroku.com/articles/heroku-connect)

## Next Steps
For common anti-patterns, see `salesforce-known-pitfalls`.

Related Skills

workhuman-reference-architecture

1868
from jeremylongshore/claude-code-plugins-plus-skills

Workhuman reference architecture for employee recognition and rewards API. Use when integrating Workhuman Social Recognition, or building recognition workflows with HRIS systems. Trigger: "workhuman reference architecture".

wispr-reference-architecture

1868
from jeremylongshore/claude-code-plugins-plus-skills

Wispr Flow reference architecture for voice-to-text API integration. Use when integrating Wispr Flow dictation, WebSocket streaming, or building voice-powered applications. Trigger: "wispr reference architecture".

windsurf-reference-architecture

1868
from jeremylongshore/claude-code-plugins-plus-skills

Implement Windsurf reference architecture with optimal project structure and AI configuration. Use when designing workspace configuration for Windsurf, setting up team standards, or establishing architecture patterns that maximize Cascade effectiveness. Trigger with phrases like "windsurf architecture", "windsurf project structure", "windsurf best practices", "windsurf team setup", "optimize for cascade".

windsurf-architecture-variants

1868
from jeremylongshore/claude-code-plugins-plus-skills

Choose workspace architectures for different project scales in Windsurf. Use when deciding how to structure Windsurf workspaces for monorepos, multi-service setups, or polyglot codebases. Trigger with phrases like "windsurf workspace strategy", "windsurf monorepo", "windsurf project layout", "windsurf multi-service", "windsurf workspace size".

webflow-reference-architecture

1868
from jeremylongshore/claude-code-plugins-plus-skills

Implement Webflow reference architecture — layered project structure, client wrapper, CMS sync service, webhook handlers, and caching layer for production integrations. Trigger with phrases like "webflow architecture", "webflow project structure", "how to organize webflow", "webflow integration design", "webflow best practices".

vercel-reference-architecture

1868
from jeremylongshore/claude-code-plugins-plus-skills

Implement a Vercel reference architecture with layered project structure and best practices. Use when designing new Vercel projects, reviewing project structure, or establishing architecture standards for Vercel applications. Trigger with phrases like "vercel architecture", "vercel project structure", "vercel best practices layout", "how to organize vercel project".

vercel-architecture-variants

1868
from jeremylongshore/claude-code-plugins-plus-skills

Choose and implement Vercel architecture blueprints for different scales and use cases. Use when designing new Vercel projects, choosing between static, serverless, and edge architectures, or planning how to structure a multi-project Vercel deployment. Trigger with phrases like "vercel architecture", "vercel blueprint", "how to structure vercel", "vercel monorepo", "vercel multi-project".

veeva-reference-architecture

1868
from jeremylongshore/claude-code-plugins-plus-skills

Veeva Vault reference architecture for REST API and clinical operations. Use when working with Veeva Vault document management and CRM. Trigger: "veeva reference architecture".

vastai-reference-architecture

1868
from jeremylongshore/claude-code-plugins-plus-skills

Implement Vast.ai reference architecture for GPU compute workflows. Use when designing ML training pipelines, structuring GPU orchestration, or establishing architecture patterns for Vast.ai applications. Trigger with phrases like "vastai architecture", "vastai design pattern", "vastai project structure", "vastai ml pipeline".

twinmind-reference-architecture

1868
from jeremylongshore/claude-code-plugins-plus-skills

Production architecture for meeting AI systems using TwinMind: transcription pipeline, memory vault, action item workflow, and calendar integration. Use when implementing reference architecture, or managing TwinMind meeting AI operations. Trigger with phrases like "twinmind reference architecture", "twinmind reference architecture".

together-reference-architecture

1868
from jeremylongshore/claude-code-plugins-plus-skills

Together AI reference architecture for inference, fine-tuning, and model deployment. Use when working with Together AI's OpenAI-compatible API. Trigger: "together reference architecture".

techsmith-reference-architecture

1868
from jeremylongshore/claude-code-plugins-plus-skills

TechSmith reference architecture for Snagit COM API and Camtasia automation. Use when working with TechSmith screen capture and video editing automation. Trigger: "techsmith reference architecture".