We wanted to build our message editor as an embeddable library for customers to use and integrate. This would allow users of their products to design and edit messages without needing to leave their application, and use Courier's messaging infrastructure and document format.

I took the lead on this project as the first engineer to work on this tool. I clarified requirements, picked a tech stack to start with, designed the architecture, and wrote most of the initial code. Other engineers came on board, and we continued to build and maintain the product. You can see this in the public repository.

I picked TipTap and ProseMirror as the editor foundation, as this would reduce the time taken to get to a working solution. If I had built a rich text editor from scratch I would have had greater control over features, but a lot more work to do. I had to build features specific to our product using the TipTap document structure and extension points.

A library inside another product

The editor needed to be used within an application that I did not control. This meant that the product using the editor could show multiple templates, manage its own persistence, and update content outside of the editor.

As I built the design tool I split out the editor state into a separate store per instance. I also fixed an issue with the feedback loop between external data, internal editor state, and callbacks. We needed to keep external syncing separate from user editing.

This meant we could pass data from the host application without receiving the same change multiple times. Each editor also had its own store for the template state. You can see this in the instance separation change and controlled state fix.

Preserving the document through editing

The editor had its own document structure, and we needed to convert between this and the Elemental format used by Courier. We needed to ensure formatting, links, variables, and translations were maintained, including data outside the current editing view.

I wrote conversion functions, and added locale preservation for converting both ways. I later fixed an issue where a complete conversion cycle was losing translations for list items. This was fixed by ensuring that translations were maintained throughout the editor and back to Elemental. I also added regression tests.

You can see this in the locale change and list item fix. We don't want the user to lose any translations while editing the visible text.

When saving we need to make sure we are saving the latest edit. The user may see new text but the request could still be using an old document. I updated the save flow to retain content arriving during a save and added a step to apply any pending changes to the editor before reading the document. Regression tests covered these timing scenarios.

Checking beyond the canvas

The document then went to Courier's backend renderer. Just because the editor looked correct and the JSON was valid didn't mean the message would preserve the same content. I added full-cycle tests that edited a template, converted it to Elemental, submitted it to the Courier API, and checked the returned HTML.

The suite combined semantic assertions and visual comparisons to check formatting and content after processing by the server. You can see this in the test implementation.

I worked on the SDK, rather than Courier's document format or backend renderer. These tests target specific scenarios around conversion, editing, and rendering. They don't confirm compatibility with every document or email client, or guarantee against every save failure. The full-cycle suite shows our verification approach; it does not establish that the tests run on every PR.