Postbote
Plugins

Plugin Overview

Add cross-cutting behavior without coupling your application to a provider.

Plugins are optional packages that extend Postbote at three distinct points.

PluginCapabilityUse it for
hooks()MiddlewarePolicy checks, message changes, lifecycle callbacks
failover()MiddlewareSwitching to fallback adapters
rateLimit()MiddlewareClient-side throttling before a provider returns 429
dryRun()MiddlewareStaging and CI sends without calling an adapter
redirect()MiddlewareReplacing real recipients in staging
logger()MiddlewareJSON-safe lifecycle events
otel()MiddlewareOpenTelemetry spans and attempt events
reactEmail()Input transformRendering a ReactElement to HTML and text
betterResult()Send wrapperReturning Result instead of rejecting

All plugins are explicit. Install only the capability you need and keep them in a tuple when their type extension matters.

src/lib/mailer.ts
const plugins = [reactEmail(), betterResult()] as const;
const mailer = createPostbote({ adapter, plugins });