npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

auth0-email-i18n

v1.0.2

Published

Simple and effective CLI tool for generating bilingual (EN/FR) email templates for Auth0 with Liquid template syntax

Downloads

7

Readme

🚀 Auth0 Email i18n

Simple and effective CLI tool for generating bilingual (EN/FR) email templates for Auth0 with Liquid template syntax.

TypeScript Node.js Auth0 MIT License

✨ Features

  • 🌍 Bilingual support - English (US) and French (FR) out of the box
  • 🔧 Simple CLI - Interactive commands for setup and generation
  • 🔒 Secure - No eval() usage, proper input validation
  • 📝 Liquid templates - Generates Auth0-compatible Liquid conditionals
  • TypeScript - Type-safe configuration and code
  • 🧪 Tested - 55 tests covering core functionality

📦 Installation

From npm (when published)

# Install globally
npm install -g auth0-email-i18n

# Or use with npx
npx auth0-email-i18n init

For Development

# Clone the repository
git clone https://github.com/Lingelo/auth0-international-email.git
cd auth0-international-email

# Install dependencies
yarn install

# Build the project
yarn build

# Generate templates
yarn generate

🚀 Quick Start

# Build and generate templates
yarn generate

# Output will be in dist/output/

Your internationalized email templates will be generated with Liquid conditionals ready for Auth0.

📁 Project Structure

src/
├── cli/                    # CLI commands
│   ├── CliApp.ts          # Main CLI application
│   └── commands/          # Command implementations
├── core/
│   ├── interfaces/        # TypeScript interfaces
│   └── services/          # Core services (I18n, Template, Validation)
├── generators/            # Template generators
│   └── LiquidGenerator.ts # Liquid template generator
├── languages/             # Translation files
│   └── README.md         # Guide for creating translations
├── templates/             # Email templates
│   └── README.md         # Guide for creating templates
└── utils/                 # Utilities
    ├── ConfigLoader.ts    # Config validation
    ├── FileSystem.ts      # File operations
    ├── Logger.ts          # Logging
    └── templateEngine.ts  # Template processing

config.json                # Project configuration (empty by default)
dist/output/               # Generated templates (created on build)

🎯 Available Commands

Development Commands

yarn generate              # Build and generate templates
yarn build                 # Compile TypeScript
yarn test                  # Run tests
yarn lint                  # Check code style
yarn typecheck             # TypeScript validation

CLI Commands (after build)

node dist/main.js init              # Initialize project
node dist/main.js build             # Generate templates
node dist/main.js validate          # Validate config
node dist/main.js add-language      # Add new language

🌍 Getting Started with Languages

The library comes with no default language files - you create your own!

Step 1: Create Language Files

Create JSON files in src/languages/ for each language you want to support.

Example: src/languages/en-US.json

{
  "welcome": {
    "subject": "Welcome!",
    "title": "Welcome to our service",
    "content": "We're glad to have you."
  }
}

Example: src/languages/fr-FR.json

{
  "welcome": {
    "subject": "Bienvenue !",
    "title": "Bienvenue sur notre service",
    "content": "Nous sommes ravis de vous accueillir."
  }
}

See src/languages/README.md for detailed examples and best practices.

📧 Getting Started with Templates

The library comes with no default templates - you create your own!

Step 1: Create Template Files

Create HTML files in src/templates/ using ${localizeMessage("key")} for translatable content.

Example: src/templates/welcome_email.html

<!DOCTYPE html>
<html lang="en">
<head>
    <title>${localizeMessage("welcome.subject")}</title>
</head>
<body>
    <h1>${localizeMessage("welcome.title")}</h1>
    <p>${localizeMessage("welcome.content")}</p>
</body>
</html>

See src/templates/README.md for detailed examples and best practices.

Step 2: Register in config.json

{
  "templates": [
    {
      "name": "welcome_email",
      "from": "[email protected]",
      "subjectKey": "welcome.subject",
      "enabled": true
    }
  ]
}

Generated Output

The build process converts templates to Liquid conditionals for Auth0:

{% if user.user_metadata.language == 'fr-FR' %}Bienvenue
{% elsif user.user_metadata.language == 'en-US' %}Welcome
{% else %}Welcome{% endif %}

Output files in dist/output/:

  • {template-name}.html - Localized HTML with Liquid syntax
  • {template-name}.json - Auth0 configuration metadata

⚙️ Configuration

The default config.json is empty - a clean slate for your project:

{
  "name": "Auth0 Email i18n",
  "version": "1.0.0",
  "templates": [],
  "languages": [],
  "build": {
    "outputDir": "dist/output",
    "cleanOutput": true
  }
}

Adding Your Configuration

Step 1: Add Languages

{
  "languages": [
    {
      "code": "en-US",
      "name": "English (United States)",
      "enabled": true,
      "priority": 1,
      "fallback": null
    },
    {
      "code": "fr-FR",
      "name": "Français (France)",
      "enabled": true,
      "priority": 2,
      "fallback": "en-US"
    }
  ]
}

Step 2: Add Templates

{
  "templates": [
    {
      "name": "welcome_email",
      "from": "[email protected]",
      "subjectKey": "welcome.subject",
      "enabled": true
    }
  ]
}

Configuration Fields

  • templates: Array of template configurations
  • languages: Supported languages with priority and fallbacks
  • build.outputDir: Where generated files are placed
  • build.cleanOutput: Clean output directory before each build

🔧 Development

Code Quality

yarn lint              # ESLint + Prettier check
yarn lint:fix          # Auto-fix issues
yarn format            # Format with Prettier
yarn typecheck         # TypeScript validation

Testing

yarn test              # Run all tests (55 tests)
yarn test:watch        # Watch mode
yarn test:coverage     # Coverage report

Build Process

  1. TypeScript compilation (tsc)
  2. Copy language files to dist/languages/
  3. Copy templates to dist/templates/
  4. Generate output in dist/output/

🏗️ Architecture

  • Service-oriented - Core business logic in services
  • Command pattern - CLI commands are extensible
  • Factory pattern - Template generators
  • Type-safe - Full TypeScript coverage
  • Tested - Comprehensive test suite

Key Components

  • TemplateService - Template loading and processing
  • I18nService - Translation management with fallbacks
  • ValidationService - Config and template validation
  • LiquidGenerator - Converts templates to Liquid syntax
  • ConfigLoader - Type-safe configuration loading

🔒 Security

  • ✅ No eval() usage - secure regex-based template processing
  • ✅ Input validation - all user inputs validated
  • ✅ Path sanitization - safe file operations
  • ✅ Error handling - comprehensive error boundaries

📊 Project Status

Current Version: 1.0.0

What's Implemented:

  • ✅ Bilingual template generation (EN/FR)
  • ✅ Liquid syntax conversion
  • ✅ Interactive CLI commands
  • ✅ Config validation
  • ✅ Comprehensive test suite
  • ✅ TypeScript compilation
  • ✅ Build system

Planned Features:

  • 🔄 Plugin system for custom processors
  • 🔄 Advanced caching strategies
  • 🔄 Additional language support
  • 🔄 Performance metrics collection
  • 🔄 HTML minification

📄 License

MIT License - see LICENSE file for details.

🤝 Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

🔗 Links

  • Repository: https://github.com/Lingelo/auth0-international-email
  • Issues: https://github.com/Lingelo/auth0-international-email/issues
  • Auth0 Documentation: https://auth0.com/docs

Made for Auth0 email internationalization 🌍