@terreno/comms
v57.3.0
Published
Pluggable mail, SMS, push, and verification providers — part of Terreno, the batteries-included TypeScript framework for universal apps.
Readme
@terreno/comms
Pluggable communications providers for Terreno backends.
Install
bun add @terreno/commsPeer dependency: mongoose ^8.0.0 || ^9.0.0. @terreno/api is required at runtime.
Quick start
import {
CommsApp,
ConsoleMailProvider,
ConsolePushProvider,
ConsoleSmsProvider,
ConsoleVerificationProvider,
} from "@terreno/comms";
import {TerrenoApp} from "@terreno/api";
import {User} from "./models/user";
new TerrenoApp({userModel: User})
.register(
new CommsApp({
defaultFrom: "[email protected]",
mail: new ConsoleMailProvider(),
push: new ConsolePushProvider(),
sms: new ConsoleSmsProvider(),
verification: new ConsoleVerificationProvider(),
})
)
.start();Send from routes or jobs with getCommsService(). Console providers log counts and lengths only — never content, addresses, tokens, or codes.
What's included
CommsApp— TerrenoPlugin for mail, SMS, push, and verification- Console providers for local development
CommsMessage/PushTokenmodels and admin explorer routes- Adapter subpath
@terreno/comms/adapters/sendgrid(optional peer@sendgrid/mail) - Adapter subpath
@terreno/comms/adapters/twilioSms(optional peertwilio) - Adapter subpath
@terreno/comms/adapters/twilioVerify(optional peertwilio) - Adapter subpath
@terreno/comms/adapters/expoPush(optional peerexpo-server-sdk) beforeSend, delivery events, opt-out, and payload retention controls
Documentation
Full API reference: docs/reference/comms.md
License and Contributing
Licensed under the MIT License. See CONTRIBUTING.md for contribution guidelines.
