Your first transactional email shouldn't need a new account
Every side project eventually needs to send an email: a welcome message, a password reset, a receipt. And that's usually the moment the project quietly grows a second project — a mail-service account, API keys, a template system, a test setup, and the question of what happens when the provider is down. Yatta JS keeps email inside the backend. It's a backend-as-a-server for Bun: one process with…
Every new project eventually requires sending an email, such as a welcome message, password reset, or receipt. This often leads to the project quietly incorporating a second project - a mail service account, API keys, template system, testing setup, and the question of what happens when the provider is unavailable. Yatta JS simplifies the email process by keeping it within the backend.
It functions as a backend-as-a-server for Bun, incorporating database, authentication, email, storage, real-time, jobs, and observability functionalities into a single process. The mail engine is already included, allowing developers to create a mailer using the createMailer function from the yatta.js/mail package. In development, emails print to the console; however, when ready for real delivery, changing one line in the code switches the mode to SMTP and selects a provider preset like Resend, Postmark, SendGrid, SES, Gmail, Mailgun, or Brevo, which automatically fills in host, port, and TLS settings.
Developers only need to add their credentials and set up a verified From address on a domain. The integration is straightforward, requiring only credentials and a verified From address on a domain. Templates are typed, allowing registration once with their data shape, and sending them with one call. Await the send method to dispatch emails, using a preview call to render without sending, and a memory mode for testing, enabling assertions without network traffic.
Yatta JS offers safety features like stripped header values, template value escaping, RFC 8058 unsubscribe, idempotency keys, retries, and rate limiting. Docs and code can be found at https://yatta.js.org and https://github.com/psrockstar098/yatta.js, respectively.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.