computer-smartphone-mobile-apple-ipad-technology

Building a Scalable Middleware Architecture with Salesforce & AWS

Introduction 

Integrating Salesforce with multiple external applications can quickly become complex, especially when data volumes grow. A modern, scalable solution is to build a Node.js middleware hosted on AWS App Runner, orchestrated via AWS Lambda and an event-driven architecture. 

This article describes a reliable, scalable, and maintainable design for integrating Salesforce with external systems. 

Architecture Overview 

Component Responsibilities 

Component Role 
Salesforce Sends platform events. 
Event Relay Decouples Salesforce from AWS; reliable event delivery (SNS, EventBridge). 
AWS Lambda Pre-processes events: validation, enrichment, batching, routing to App Runner. 
App Runner (Node.js Middleware) Handles business logic, integrates with external APIs, manages persistent connections, and transforms payloads. 
External APIs Third-party systems receiving processed data from middleware. 

Workflow Description 

  1. Salesforce emits an event (platform event or CDC). 
  1. Event Relay receives it and forwards it to Lambda. 
  1. Lambda validates and transforms the event, then calls App Runner via HTTPS. 
  1. App Runner middleware orchestrates the workflow: 
  1. Calls one or multiple external APIs 
  1. Handles retries, throttling, and response transformations 
  1. Logs requests and responses centrally 
  1. External applications receive processed data reliably. 

Advantages of This Architecture 

  • Event-Driven & Decoupled: Each layer is independent, reducing impact of failures. 
  • Scalable: Lambda handles bursts; App Runner scales for sustained API calls. 
  • Long-Running Operations: App Runner supports multi-step API calls without Lambda time limits. 
  • Centralized Security & Logging: Middleware layer centralizes secrets, tokens, and logging. 
  • Future-Proof: Can migrate App Runner workloads to ECS/Fargate for millions of requests/day. 

Best Practices 

  • Secrets Management: Use AWS Secrets Manager or Parameter Store for API keys. 
  • Rate Limiting: Prevent overloading external APIs with express-rate-limit or similar middleware. 
  • Health Monitoring: Add /health endpoints and CloudWatch alarms. 
  • Retries & Error Handling: Implement exponential backoff and circuit breakers. 
  • Concurrency Tuning: Configure App Runner concurrency to match expected traffic patterns. 
  • Prefer Salesforce Platform Events over CDC when possible 

Scaling Strategy 

  • Startup / MVP: App Runner + Lambda handles hundreds to thousands of events/day. 
  • Growth: Tune concurrency and scale App Runner min/max instances for tens of thousands of events/day. 
  • Enterprise: Migrate App Runner workloads to ECS or Fargate for millions of events/day, keeping the same Docker images. 

Authors

  • Building 1Vendor Platform™ (1VP) – Simplifying e-procurement for Industries. AWS | Amazon | IIMC | Maruti Suzuki | Atos | BIT-Mesra. Innovating in tech and automotive for 15 years—developing cutting-edge products that drive efficiency, scalability, and real-world impact. Passionate about technology, product development, and exploring new frontiers.

  • Roushan Kumar Barnwal SDE @ 1Vendor Platform | AWS, API, SQL, HTML, CSS, JS, Salesforce Admin Graduated with a BTech in Chemical Engineering from Birla Institute of Technology, Mesra, and currently working as an SDE at 1Vendor Platform. Core competencies include AWS, API, Salesforce administration, SQL, and HTML.

Categories:

Leave a Reply