SaaS · email marketing
Embeddable email editor: AI-generated templates, a visual editor and a render pipeline in one product
A drag-and-drop email editor that software platforms embed in their own product. AI drafts a layout plan, a fixed compiler builds the email from brand-aware sections, and a render service turns it into client-safe HTML.
- Industry
- SaaS · email marketing
- Technologies
- Laravel 11 · PostgreSQL 16 with row-level security · Redis
Challenge
A marketing-software company wanted its own email builder instead of licensing one: an editor its customers use inside the product, that other SaaS platforms can embed under their own brand, and that uses AI to produce a usable first draft. Two things ruled out the obvious shortcuts. Emails must look the same in Outlook, Gmail and Apple Mail, so free-form HTML from a model was not an option. And every customer's templates, brand kits and API keys had to stay isolated from everyone else's.
Solution
We built the product as a set of services with one contract. A JSON Schema defines what a template is: the API validates every save against it, and the render service validates every render against the same file. The AI never writes HTML. It returns a short blueprint, which sections to use and what copy goes in them, and a deterministic compiler assembles the email from 16 section patterns with the brand's colors and fonts before a linter checks the result. The visual editor works on the same block model, so a generated email stays fully editable. Rendering runs in five stages: validate, resolve, transform, compile with MJML, then post-process and sanitize.
How it connects
- 01 Brief
- 02 AI blueprint
- 03 Pattern compiler
- 04 Visual editor
- 05 MJML render
- 06 Embed or export
What we delivered
- Drag-and-drop editor with 15 block types, layouts of up to six columns, rich text with a slash menu, undo and redo, a contrast checker and a merge-tag picker
- AI chat, inline AI editing, subject line, preheader and call-to-action suggestions, a spam check and a brand-voice profile learned from past emails
- AI template generation through a blueprint and a pattern compiler, followed by a quality linter
- A library of more than 100 ready-made sections, plus saved modules that stay in sync across templates, with version history and conflict handling
- Render service that turns templates into email HTML, including animated countdown images
- Import from HTML files and from exports of other email builders, including bulk import of zip archives through a queue
- Customer portal, template gallery, outgoing webhooks and an embeddable widget delivered as an iframe, a script loader and a React component
- More than 1,200 automated tests across the services
Functionality
- Tenant isolation with PostgreSQL row-level security and per-tenant cache prefixes
- One JSON Schema validates templates in both the API and the render service
- REST API with RFC 7807 error responses, JSON Merge Patch updates, cursor pagination and idempotency keys
- All rendered output sanitized with DOMPurify, including markdown in the AI chat
- Signed webhooks with SSRF protection, IP pinning, retries with back-off and secret rotation with a grace period
- Widget sign-in with short-lived tokens that never appear in a URL; messages posted only to the declared parent origin
- Three layers of AI cost control per tenant, and a second model provider as failover
- Every push to staging passes type checks, linting and all test suites first
- Localized interface with right-to-left layout support
Integrations
- Anthropic API, with a second model provider as failover
- The host platform's API for merge tags, contacts and test sends
- Object storage for images and rendered assets
- Outgoing webhooks for template events
Technologies
Result
Running on a staging environment with every service live: API, render service, AI service, customer portal and widget. Production hosting, billing and widget hardening are the next phase, and this case will be updated when the product goes to production.
Why doesn’t the AI write the HTML?
Email clients still disagree on how to render HTML, and a model that writes markup freely produces emails that break in Outlook or lose their layout on a phone. So the model makes the decisions a copywriter and a layout designer would make: which sections, in what order, with which words. Code does the rest. The compiler only uses tested section patterns and the brand kit, and the output passes the same validation and rendering path as a hand-built email. Any generated template can also be opened and edited block by block.
Discuss your project
Tell us about your project