Claxx Auth
Docs
Sign in
User FAQ
  • Reset my password
  • I can't sign in
  • Didn't get reset email
  • Account linking
  • Session expiry
  • Two-factor auth
Admin Guides
Theme Studio
  • Overview
  • Layouts
  • Styling tokens
  • Concept copy
  • Assets & backgrounds
  • Advanced CSS
Admin Shell
  • Users
  • Providers
  • Clients
  • Invitations
Integrations
  • OIDC flow
  • Provider token brokering
  • Email triggers
  • Webhook events
  • Session contract
Reference
  • API
  • Error codes
  • Event shapes
  • Design tokens

Email Triggers

Claxx Auth owns every auth-domain email sent in the connected apps: invitations, password resets, welcome emails, and (roadmap) email verification. Downstream apps do not send these emails themselves — they trigger a Claxx Auth operation which causes Claxx Auth to send the email, themed for the tenant that initiated the action.

This page describes each trigger, the template that renders it, the variables substituted, and how to override the template per tenant via Theme Studio.

Delivery pipeline

  1. A Claxx Auth operation triggers an email (invitation created, password-reset requested, signup completed).
  2. Claxx Auth resolves the tenant theme for the triggering client (resolveEmailTheme(clientId)).
  3. The template renders themed HTML + plain-text bodies via renderEmailBase + per-concept template module.
  4. sendEmail() throws Email sending is not configured. Password reset and invitations fail at send time. There is no email binding in wrangler.jsonc. Do not add one in a drive-by change.

Source: server/utils/email/send.ts, server/utils/email/resolve-theme.ts, shared/utils/email/templates/.

The four emails

EmailWhen it sendsTemplateSender
InvitationAdmin creates an invitation for a new usershared/utils/email/templates/invitation.tsNot sent. sendEmail() throws.
Password ResetUser submits /forgot-passwordshared/utils/email/templates/password-reset.tsNot sent. sendEmail() throws.
WelcomeUser accepts invitation or completes self-signupshared/utils/email/templates/welcome.tsNot sent. sendEmail() throws.
Address confirmationSelf-service sign-up, or a password sign-in to an account whose address is not confirmed yetshared/utils/email/templates/verify-email.tsThe tenant's name.

The templates still render. sendEmail() does not deliver them. They differ in subject line, body HTML, and CTA link.

Template variables

Each template renders from a small, explicit set of inputs. No user-controlled HTML is interpolated.

Invitation — renderInvitationEmail

VariableExampleNotes
themeResolved tenant theme objectDrives logo, primary color, font preset, footer text, tenant display name.
acceptUrlhttps://auth.example.com/invite?token=<opaque>Single-use invitation link. Token valid until expiresAt.
clientName"Example App"Used in the headline copy ("You're invited to Example App").
recipientName"Jane Doe" or nullGreeting line. Falls back to "Hi there" when null.
inviterName"Clay Levering"Personalizes the body ("Clay invited you").
expiresAtDateRendered as a human-friendly expiry.

Password reset — renderPasswordResetEmail

VariableExampleNotes
themeResolved tenant theme objectChrome and branding.
resetUrlhttps://auth.example.com/reset-password-token?token=<opaque>Single-use link, 1-hour default TTL.
userName"Jane" or nullGreeting.

Welcome — renderWelcomeEmail

VariableExampleNotes
themeResolved tenant theme objectChrome and branding.
signInUrlhttps://auth.example.com/loginCTA link.
userName"Jane" or nullGreeting.

Theme resolution

At send time, Claxx Auth resolves the theme for the triggering client:

  1. Look up the OAuth client by ID.
  2. Load the client_themes row bound to the client.
  3. Fall back to the service-default theme if no client-bound theme exists.
  4. Fall back to HOSTED_LOGIN_THEME_DEFAULTS for any missing fields.

Resolved values that affect email rendering:

  • name — tenant display name. It is used in subject copy. Mail is not sent, so there is no From address in production.
  • primaryColor — hex color for CTA buttons and accent strokes.
  • logoUrl — tenant logo rendered in the email header.
  • footerText — legal/support line in the email footer.
  • fontFamilyPreset — web-safe stack referenced in the email stylesheet.

Every email Claxx Auth sends is theme-accurate for the tenant initiating the action. Changes made in Theme Studio (/admin/themes) take effect on the next send without redeploy.

Triggering from downstream apps

You don't invoke the email sender directly. You trigger a Claxx Auth operation that causes Claxx Auth to send.

Trigger an invitation email

POST https://auth.example.com/api/admin/invitations
Authorization: Bearer <admin-token>
Content-Type: application/json

{
  "email": "invitee@example.com",
  "recipientName": "First Last",
  "clientId": "7f9b0e7e-...-a11c",
  "expiresAt": "2026-04-23T00:00:00.000Z"
}

Claxx Auth creates the invitations row and publishes invitation.created. The invitation mail is not sent. sendEmail() throws Email sending is not configured. The same is true for password reset and welcome.

Trigger a password-reset email

POST https://auth.example.com/api/auth/forgot-password
Content-Type: application/json

{
  "email": "user@example.com"
}

This endpoint is exposed through the Better Auth catch-all at server/api/auth/[...all].ts. The reset token can be persisted. The themed reset email is not sent.

Trigger a welcome email

You don't trigger it directly. The welcome template is selected when:

  • A user accepts an invitation at /api/auth/accept-invite.
  • A user completes self-signup (where self-signup is enabled on the client).

That path calls sendEmail(), which throws. Users do not receive a welcome message.

What downstream apps should do

  • Don't duplicate these emails. Claxx Auth owns the invitation, password-reset, and welcome templates. If your app wants to send a different welcome-to-the-product sequence after the auth welcome lands, subscribe to the user.created or invitation.accepted webhook and drive your sequence from there.
  • Do subscribe to webhooks (webhook events) when you need to react to these lifecycle events — e.g. to create a tenant record in your app the moment a user signs up.
  • Do customize your theme in /admin/themes. Every email inherits the theme bound to the initiating client, including logo, colors, and footer copy.

Previewing and testing templates

Admins can preview and test-send any template from /admin/settings → Email test (backed by POST /api/admin/email-test).

Preview only (renders HTML, does not send)

POST https://auth.example.com/api/admin/email-test
Authorization: Bearer <admin-token>
Content-Type: application/json

{
  "themeId": "b1f2c3d4-...-0001",
  "recipientEmail": "qa@example.com",
  "previewOnly": true,
  "emailConcept": "invitation"
}

Response:

{
    "success": true,
    "data": {
        "html": "<!doctype html>...",
        "text": "You're invited...",
        "theme": "Example App",
        "emailConcept": "invitation"
    }
}

The admin UI renders this HTML in a sandboxed iframe so you can review layout, colors, logo, and copy without sending anything.

Test send

Omit previewOnly (or set it to false). The route calls sendEmail(), which throws Email sending is not configured. No message leaves the Worker.

emailConcept accepts "password-reset", "welcome", or "invitation". The test route is admin-only.

Source: server/api/admin/email-test.post.ts.

Sender identity

Mail is not configured. There is no From address and no Cloudflare email binding. Do not add an email provider in this change.

Localization

Not implemented — all emails are English. Localization is gated on the first tenant with a non-English primary locale. When added, locale will be resolved from the recipient's profile locale field, falling back to the tenant default, falling back to en-US.

Logging

Nothing is sent, so there is no provider message id to search for.

On this page

  • Delivery pipeline
  • The four emails
  • Template variables
  • Invitation — renderInvitationEmail
  • Password reset — renderPasswordResetEmail
  • Welcome — renderWelcomeEmail
  • Theme resolution
  • Triggering from downstream apps
  • Trigger an invitation email
  • Trigger a password-reset email
  • Trigger a welcome email
  • What downstream apps should do
  • Previewing and testing templates
  • Preview only (renders HTML, does not send)
  • Test send
  • Sender identity
  • Localization
  • Logging
DocsPrivacyTerms
© 2026 Claxx Digital Group