Email Editor Quickstart
Set up the Email Editor in a React project in under 5 minutes.
Installation
npm install @marlinjai/email-editor
# or
pnpm add @marlinjai/email-editorBasic React Integration
import { EmailEditorReact } from '@marlinjai/email-editor/react';
import '@marlinjai/email-editor/styles.css';
function App() {
return (
<EmailEditorReact
initialTemplate={myTemplate}
onChange={(template) => console.log(template)}
onExport={(template) => sendToServer(template)}
/>
);
}The EmailEditorReact component includes everything: sidebar, canvas, property inspector, and block library.
Server-Side MJML Compilation
The editor uses MST (MobX State Tree) for instant in-browser editing. MJML is only compiled on export — server-side:
// api/compile.ts
import { MJMLExporter } from '@marlinjai/email-editor-core/server';
const exporter = new MJMLExporter();
export async function POST(request: Request) {
const template = await request.json();
const { html, mjml, errors } = exporter.export(template);
return Response.json({ html, mjml, errors });
}Why server-only? MJML is a large dependency (100-300ms compile time). Keeping it server-side means the client bundle stays small and editing stays instant (<16ms).
Architecture Overview
The editor is split into four packages:
| Package | Purpose |
|---|---|
@marlinjai/email-editor | High-level wrapper (start here) |
@marlinjai/email-editor-ui | React components |
@marlinjai/email-editor-blocks | Block definitions and templates |
@marlinjai/email-editor-core | Framework-agnostic MST engine |
The core package has no React dependency — it can work with Vue, Svelte, or vanilla JS.
Next Steps
- Full installation guide — Detailed setup options
- React & vanilla JS integration — Advanced integration patterns
- API Reference — Complete API documentation
- Architecture — Package layering and design decisions