Changing a mail template used to need a deploy. We built an editor that refuses to publish a broken one
说明与用途
新的模板系统允许非开发人员在不部署代码的情况下编辑事务性邮件和 PDF,验证必需变量并阻止错误发布。
问题
Non‑developers could not edit transactional mail or PDF templates without a code deploy, leading to operational bottlenecks and risk of broken content.
结果
The new unified template system allows non‑developers to edit transactional mail and PDFs without code deployments, enforces required placeholders, and prevents publishing broken content.
工作流
- Identify duplicate mail systems and lack of unified template model.
- Design a single template model with slug, locale, document, and meta.
- Implement structured document editing with tiptap and server‑side sanitization.
- Create separate layout templates for mail (MJML) and PDF (letterhead).
- Add required placeholder validation and publish blocking in the editor and server.
- Separate draft and active template storage to prevent accidental overrides.
- Implement PDF rendering via Puppeteer with real preview and metadata.
- Deploy the unified editor and preview system.
- Document the workflow for non‑developers to edit templates safely.
证据
Changing the wording of a password‑reset mail in our framework meant editing a TypeScript file and shipping a release.
The mail editor has the placeholder rail on the left with type, required marker and a check for whether the placeholder is used.
That rule is enforced on the server and not only in the editor. Saving rejects unknown placeholders.
PDFs use the same document model, rendered through Puppeteer in a separate service that runs Chromium behind an egress guard.
- 记录日期: 2026-10-24T22:11:29.652Z