Serverless Pub/Sub Node.js Process

Architectural Diagram of the Process

Project Description

Klaviyo is an email & SMS marketing automation platform that offers a robust API. One of the many features it has is segmentation lists for targeting segments of one’s customer base.

The purpose of this project was to synchronize some of these segmentation lists out to 3rd party advertising platforms.

The three caveats were:

Therefore, this needed to be a configurable and scalable process.


After some research, vetting, and collaboration with my team, I ultimately proposed this publisher/subscriber, serverless architecture in AWS:

The publisher and subscribers AWS Lambda functions ran in Node.js environment.

I wrote them in TypeScript with promise chaining due to the asynchronous nature of the AWS services libraries, and also due to the procedural nature of coordinating S3, SNS, Secrets Manager, Klaviyo’s API, and the downstream advertisers’ APIs.

Challenges Overcame

The challenges of this project were derived from its constraints:

From these constraints, the pub/sub setup was chosen to solve them.

Since I started learning AWS earlier that year, it was challenging to determine the best AWS services to leverage and how to coordinate them all.


This was the first cloud-native serverless process I built since learning AWS in 2020.

The flexible architecture probably guarantees a long lifespan.

The implementation of this process paved the way for the marketing team to integrate with these advertising networks more effectively.

Technologies Used

  • Languages: TypeScript, JSON
  • Concepts: Cloud-Native, Serverless, REST APIs, Promise Chaining, S3 Fanouts
  • Tools: NPM, AWS Secrets Manager, AWS CloudWatch, AWS EventBridge
  • Stack: Node.js, AWS S3, AWS Lambda, AWS SNS