Conversation
🦋 Changeset detectedLatest commit: 38c349a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for stacks ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
…mail # Conflicts: # package-lock.json
…mail # Conflicts: # package-lock.json
dancormier
left a comment
There was a problem hiding this comment.
Really nice work here @abovedave. Adding stacks-email seems reasonable and I think this is looking pretty solid. I noticed a few bugs that I think shouldn't be too tough to handle
Note
I noticed a bunch of whitespace-only changes to a couple of yaml files and undid just the whitespace changes to reduce the noise.
…mail # Conflicts: # package-lock.json
dancormier
left a comment
There was a problem hiding this comment.
I pushed a few follow-up fixes:
- Made
@stackoverflow/stacks-emailpublishable outside the repo, including a changeset - Safely validated custom asset URLs
- Fixed component props being silently ignored
- Made gallery MJML reflect the selected target
- Added regression and catalog-wide tests, now run in CI
The package, docs build, type checks, lint, tests, and external-consumer smoke test all pass.
@abovedave when you have a moment, can you take a moment to verify that these changes match the intention of the PR (especially the publishing of @stackoverflow/stacks-email and the gallery MJML change)? If it all looks good, feel free to merge!
STACKS-905
Introduces
@stackoverflow/stacks-email, a new (experimental) MJML powered email package for building, previewing, documenting, and compiling Stack Overflow email templates.stacks-docsBackground
Historically, Stack Overflow's email design system lived across several separate implementations, including the monolith and external marketing tools. Since 2020, the system has had limited modernization or maintenance.
This work is part of the 2026 rebrand rollout. The goal is to create a shared source of truth for email design patterns, implementation, previewing, and downstream consumption.
We selected MJML because it is widely adopted, MIT licensed, and abstracts much of the client-specific complexity of writing production email HTML.
Overview
Components
~/packages/stacks-email/componentsAdds reusable email building blocks such as
Button,Header,Footer,Cardetc. Each defines their variants, options, tokens, and MJML render output in one place.Templates
~/packages/stacks-email/templatesAdds example and reusable template definitions including
Transactional,Newsletter,Promotional. These compose components into full MJML documents and can expose variants and props.Compile APIs
The package can be consumed in several ways:
@stackoverflow/stacks-emailPOST /api/compileThe package API and HTTP API intentionally serve different use cases.
The package API is the full in-process integration surface for trusted TypeScript consumers. It supports catalog discovery, component compilation, template compilation, renderable dispatch, and lower-level MJML compilation primitives.
The HTTP endpoint is a narrower service integration surface. It currently focuses on composing transactional emails from a validated JSON block list, then returning compiled MJML and HTML. This keeps the cross-service contract small while still enabling non-TypeScript consumers to generate branded email output without embedding the package.
Documentation
Adds a new Email section to
stacks-docs, including:Usage
As a package
As an endpoint
As static docs artifacts
@stackoverflow/stacks-email/sveltekitexports route handlers used bystacks-docsto serve precompiled email HTML, MJML, and manifest data.Compile targets
Every compile supports a target:
preview: replaces tokens with sample valuesdotnet: replaces tokens with Razor model bindingsbraze: replaces tokens with Braze/Liquid-style valuesThis allows the same email source to produce output for different downstream systems.
Notes for reviewers
Suggested review path:
packages/stacks-email/README.mdpackages/stacks-email/componentspackages/stacks-email/templatespackages/stacks-email/src/lib/pipelinepackages/stacks-email/src/lib/apipackages/stacks-email/src/routes/api/compile/+server.tspackages/stacks-docs/src/components/StacksEmailEmbed.sveltepackages/stacks-docs/src/routes/email/compiledCurrent limitations / Follow-ups