Notifications

SES Channel

An AWS SES email channel for the notification service. It handles the `email` message key and validates its own email payload schema.

Install
Add this registry item to your app with shadcn.
bunx --bun shadcn@latest add https://krakstack.net/r/notification-channel-email-ses.json

Overview

notification-channel-email-ses adds AWS SES email delivery to service-notification. It handles the email top-level key in notification messages, contributes the email payload type to NotificationChannels, and keeps the SES-specific payload schema beside the channel implementation.

Included Files

  • services/notification/channels/ses/index.ts - SES channel, config service, and channel layer
  • services/notification/channels/ses/schema.ts - SES email payload schema

Usage

import { Effect, Layer } from "effect";
import { NotificationService } from "@/services/notification";
import { NotificationChannelRegistry } from "@/services/notification/channels";
import { SesNotificationChannel } from "@/services/notification/channels/ses";

const notificationChannelsLayer = Layer.effect(
  NotificationChannelRegistry,
  Effect.gen(function* () {
    const email = yield* SesNotificationChannel;
    return NotificationChannelRegistry.make(email);
  }),
).pipe(Layer.provide(SesNotificationChannel.layer));

const notificationServiceLayer = NotificationService.layer.pipe(
  Layer.provide(notificationChannelsLayer),
);

const program = Effect.gen(function* () {
  const notifications = yield* NotificationService;

  yield* notifications.send({
    email: {
      to: "[email protected]",
      subject: "Deploy succeeded",
      html: "<h1>main -> production</h1><p>All checks passed.</p>",
    },
  });
});

await Effect.runPromise(
  program.pipe(Effect.provide(notificationServiceLayer)),
);

The payload can include from, or the channel can read NOTIFICATION_EMAIL_FROM from the environment.

Merging With Other Channels

Use SesNotificationChannel.layer when building a multi-channel registry. Pull SesNotificationChannel and any other channel services into one NotificationChannelRegistry.make(...), then provide that registry to NotificationService.layer. See the service-notification docs for a complete merge example.

Environment Variables

  • SES_REGION - AWS SES region
  • SES_ACCESS_KEY_ID - AWS access key ID
  • SES_SECRET_ACCESS_KEY - AWS secret access key
  • NOTIFICATION_EMAIL_FROM - Optional default sender address when the payload omits from
Dependencies
Packages and shadcn components required by this registry item.