@lesto/mailing-lists
v0.1.7
Published
Ghost-style subscriber lists — double opt-in and broadcasts, composed on @lesto/db, @lesto/mail, and @lesto/queue.
Readme
@lesto/mailing-lists
Ghost-style subscriber lists — double opt-in and resumable broadcasts.
Part of Lesto, the batteries-included, agent-native fullstack framework.
bun add @lesto/mailing-listsimport { createMailingLists, insertList } from "@lesto/mailing-lists";
const list = await insertList(db, { name: "Weekly" });
const lists = createMailingLists({
db,
mailer,
confirmationMailer: { name: "confirm", confirmUrl: (t) => `https://x.com/confirm/${t}` },
unsubscribeUrl: (t) => `https://x.com/unsubscribe/${t}`,
});
const sub = await lists.subscribe(list.id, "[email protected]"); // pending; confirm email enqueued
await lists.confirm(sub.confirmToken!); // → subscribed
await lists.broadcast(list.id, "digest", { issue: 42 }); // → resumable broadcastComposes @lesto/db, @lesto/mail, and @lesto/queue. The package opens no
database and holds no request context — hand it a Db and a Mailer.
Rate-limit the HTTP boundary that fronts subscribe.
