npayload for SaaS Platforms
Multi-tenant messaging, per-customer event delivery, and marketplace extensions
The challenge
SaaS platforms sit at the center of their customers' workflows. Every meaningful action, whether a user signs up, a record changes, or a report completes, needs to reach downstream systems reliably. That means:
- Delivering webhooks to hundreds or thousands of customer endpoints, each with different reliability characteristics
- Processing internal events across microservices without losing messages
- Letting customers build their own integrations and extensions
- Documenting your event API so customers know exactly what to expect
Most teams start with a simple HTTP callback, then spend months building retry logic, circuit breakers, dead letter queues, and monitoring. npayload gives you all of this from day one.
How npayload solves it
Per-customer webhook delivery
Every customer endpoint gets independent retry logic and circuit breakers. If one customer's server goes down, it does not affect delivery to any other customer. Failed deliveries land in a dead letter queue for inspection and replay.
import { NPayload } from "@npayload/node";
const np = new NPayload({ apiKey: process.env.NPAYLOAD_API_KEY });
// Create a channel for each customer
const channel = await np.channels.create({
name: `webhooks.${customerId}`,
type: "standard",
});
// Subscribe the customer's endpoint
await np.subscriptions.create({
channelId: channel.id,
endpoint: customer.webhookUrl,
retryPolicy: {
maxAttempts: 5,
backoffMultiplier: 2,
initialDelay: 1000,
},
});
// Publish events. npayload handles delivery, retries, and circuit breaking.
await np.messages.publish({
channelId: channel.id,
type: "invoice.paid",
payload: {
invoiceId: "inv_abc123",
amount: 9900,
currency: "usd",
},
});Multi-tenant channel design
Two patterns work well depending on your scale:
Channel per customer works best when customers have different subscription configurations, retry policies, or delivery endpoints.
// Each customer gets isolated channels
const channel = await np.channels.create({
name: `events.${customerId}`,
type: "standard",
});Shared channel with routing keys works best when all customers receive the same event types and you want simpler management.
// Single channel, route by customer
await np.messages.publish({
channelId: "events.all",
type: "order.created",
routingKey: customerId,
payload: orderData,
});
// Customer only receives their events
await np.subscriptions.create({
channelId: "events.all",
endpoint: customer.webhookUrl,
routingKeyFilter: customerId,
});Event catalogue for API contracts
Document every event your platform produces. Customers can browse available events, see their schemas, and generate type-safe client code.
await np.eventCatalogue.register({
type: "invoice.paid",
version: "1.0.0",
schema: {
type: "object",
properties: {
invoiceId: { type: "string" },
amount: { type: "number" },
currency: { type: "string" },
},
required: ["invoiceId", "amount", "currency"],
},
description: "Fired when an invoice payment is confirmed.",
});Marketplace for customer extensions
Let your customers publish and discover integrations built on your event streams. npayload's marketplace provides listing management, reviews, and usage tracking.
Architecture
What you get vs. building it yourself
| Capability | npayload | DIY |
|---|---|---|
| Per-customer retries with backoff | Included | Build retry queue, persistence, backoff logic |
| Circuit breaker per endpoint | Included | Implement state machine, failure tracking |
| Dead letter queue with replay | Included | Build DLQ storage, inspection UI, replay logic |
| Event schema registry | Included | Separate service to build and maintain |
| Multi-tenant isolation | Built in | Ongoing security audits |
| Marketplace for extensions | Included | Months of product development |
| Delivery monitoring and metrics | Included | Integrate observability stack |
| Cross-region delivery | Built in | Multi-region infrastructure project |
Next steps
- Use Cases: Detailed patterns for event-driven SaaS architectures
- Marketplace: Publishing and discovering integrations
- Webhooks Guide: Configuring webhook delivery, retries, and monitoring
Was this page helpful?