Modern email development with React, TypeScript, and Vite
HTMplar is a developer-friendly React component library for building email-safe HTML templates. Write emails in React with modern tooling, and get production-ready HTML that works across all email clients.
- π¨ React Components - Build emails with familiar React syntax
- π― Type-Safe - Full TypeScript support with strict mode
- β‘ Fast Builds - Turborepo + tsup for lightning-fast builds
- π Dark Mode - Built-in dark mode support
- βΏ Accessible - WCAG AA compliant email templates
- π± Responsive - Mobile-first, works on all devices
- π§ Email Client Compatible - Tested on 20+ email clients including Outlook
| Aspect | v1.0 | v2.0 |
|---|---|---|
| Architecture | Single package | Monorepo (4 packages) |
| Language | JavaScript | TypeScript (strict mode) |
| Build System | Custom | Vite + tsup |
| Styling | Inline styles | Vanilla Extract CSS |
| Module System | CommonJS | ESM + CJS dual build |
| Package Manager | npm | npm workspaces + Turborepo |
| Testing | None | Vitest + Testing Library |
If you're using v1.0 (stable):
- β
Keep using v1.0 - It's on the
masterbranch and still maintained - The v1.0 package name may differ from v2.0 packages
If you want to try v2.0 (alpha):
- Start fresh - v2.0 uses a completely different API
- Create a new project:
# After packages are published npx @htmplar/create-htmplar my-new-project - Rewrite components - Components use new React-based syntax
- Update imports:
// v1.0 (example - actual v1 API may vary) const htmplar = require('htmplar'); // v2.0 import { Block, Text, Button } from '@adidas/htmplar-core'; import { renderToEmail } from '@adidas/htmplar-renderer';
v2.0 addresses technical debt and modernizes the entire stack:
- Type Safety: Full TypeScript with strict mode catches errors at build time
- Developer Experience: Hot reload, better error messages, React DevTools support
- Maintainability: Modular architecture, comprehensive tests, modern tooling
- Performance: Faster builds with Turborepo, optimized rendering
- Ecosystem: Uses modern standards (ESM, Vite, React 18)
See MODERNIZATION_PLAN.md for complete details.
The stable v1.0 version is available on the master branch:
git checkout masterThis is a monorepo containing multiple packages:
| Package | Description | Version |
|---|---|---|
| @adidas/htmplar-core | React component library | 2.0.0-alpha.0 |
| @adidas/htmplar-renderer | Email rendering engine | 2.0.0-alpha.0 |
| @adidas/htmplar-cli | Command line interface | 2.0.0-alpha.0 |
| @adidas/create-htmplar | Project scaffolder | 2.0.0-alpha.0 |
npx @adidas/create-htmplar my-email-project
cd my-email-project
npm run devnpm install @adidas/htmplar-core @adidas/htmplar-rendererimport { Block, Button, Text } from '@adidas/htmplar-core';
import { renderToEmail } from '@adidas/htmplar-renderer';
function WelcomeEmail() {
return (
<Block>
<Text>Welcome to HTMplar!</Text>
<Button href="https://example.com">
Get Started
</Button>
</Block>
);
}
// Render to email-safe HTML
const html = renderToEmail(<WelcomeEmail />);- Node.js >= 20.0.0
- npm >= 10.0.0
# Clone the repository
git clone https://github.com/adidas/htmplar.git
cd htmplar
# Checkout the rewrite branch
git checkout rewrite/monorepo-setup
# Install dependencies
npm install --legacy-peer-deps
# Build all packages
npm run build
# Run type checking
npm run typecheck
# Run linting
npm run linthtmplar/
βββ packages/
β βββ core/ # Component library (Vanilla Extract styling)
β βββ renderer/ # React β HTML rendering engine
β βββ cli/ # CLI tool (dev server, build commands)
β βββ create-htmplar/ # Project scaffolder
βββ .github/workflows/ # CI/CD pipelines
βββ docs/ # Documentation
| Command | Description |
|---|---|
npm run build |
Build all packages with Turborepo |
npm run dev |
Start dev mode with watch |
npm run test |
Run all tests |
npm run lint |
Lint all packages |
npm run typecheck |
Type check all packages |
npm run format |
Format all files |
npm run clean |
Remove build artifacts |
- Modernization Plan - Complete rewrite plan and architecture decisions
- Phase 1 Tasks - Detailed implementation checklist
- Session Summary - Current progress and status
- Setup Status - Setup instructions and next steps
- β Monorepo structure (Turborepo + npm workspaces)
- β TypeScript configuration (strict mode)
- β Build system (tsup for ESM/CJS)
- β Testing infrastructure (Vitest + Testing Library)
- β CI/CD workflows (GitHub Actions)
- β Code quality tools (ESLint 9, Prettier)
- β Documentation
- β³ Renderer: React β HTML conversion
- β³ Core components: Block, Button, Text, Image, etc.
- β³ Vanilla Extract styling system
- β³ CLI: dev server, build commands
- β³ Email optimization & inlining
We welcome contributions! Please see CONTRIBUTING.md for details.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests (
npm test) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
We use Changesets for versioning:
npm run changesetMIT Β© adidas AG
- Original htmplar by Bilal ΓΔ±narlΔ±
- v2.0 rewrite by Berkan Dirim
- π Documentation
- π Issue Tracker
- π¬ Discussions
master branch.
Branch: rewrite/monorepo-setup
Status: Phase 1 Complete, Phase 2 in progress
Built with β€οΈ by the adidas team
