Quickstart
Install the SDK and record your first email without credentials or network calls.
Record a notification with the public Email service. This example uses an in-memory Layer, so you can run it without a provider account or HTTP client.
Requirements
This guide covers SDK 0.1.0 with Effect 4.0.3 on Node.js >=24.18.0. The package supports ESM imports and Node’s synchronous CommonJS loading of the same ESM graph. It does not ship a separate CommonJS bundle; older Node versions, browsers and edge runtimes are outside this runtime contract.
1. Install the package
The SDK is currently available from a local checkout rather than a package registry. From that checkout, build a package archive using the package manager pinned in package.json:
pnpm install --frozen-lockfile
pnpm build
pnpm pack --out ./corven-email-sdk.tgz
In your application, install the archive and its matching Effect peer:
pnpm add /absolute/path/to/corven-email-sdk.tgz effect@4.0.3
2. Record an email
import { Effect } from "effect";
import { Email } from "@corven/email-sdk";
import { RecordedEmails, recordingEmailLayer } from "@corven/email-sdk/testing";
export const recordNotification = Effect.gen(function* recordNotification() {
const email = yield* Email;
const records = yield* RecordedEmails;
const receipt = yield* email.send({
body: { text: "Your fictional order is ready." },
from: "sender@example.test",
subject: "Order ready",
to: "recipient@example.test",
});
const messages = yield* records.messages;
return { messages, receipt };
}).pipe(Effect.provide(recordingEmailLayer));
The program acquires Email to submit the message and RecordedEmails to inspect the recording. Providing recordingEmailLayer connects both services to the same in-memory store.
All addresses in these examples use the fictional .test domain.
3. Run and inspect the result
In your application’s entrypoint, run Effect.runPromise(recordNotification).
The result contains:
receipt: aRecordedreceipt identifying the local recording.messages: the messages recorded in that Layer acquisition.
The recording Layer stores messages in memory without contacting a provider. Use it to test application behavior. It does not persist a queue or confirm delivery. Acquire the recorder and its query service together. A new recording Layer has a separate store.
Next steps
Configure a provider when you are ready to connect an account, or read messages and attachments to build richer content.