Course contentsShow
← System Design
Lesson 1701 of 1,91941. Real-World System: Notification SystemFree lesson

Template Service for Content

Centralized template management for notification content with variable substitution and localization support.

Template Service for Content

What you'll learn: How to centralize and manage notification content templates with dynamic placeholders and multi-language support in a scalable notification system.

Why Templates Matter

Imagine sending millions of notifications daily: "Hi John, your order #12345 shipped!" versus "Hi Sarah, your order #67890 shipped!" Writing unique messages for each is impossible. Instead, you create one template with placeholders: "Hi {name}, your order {orderId} shipped!" and fill in the blanks at runtime.

Core Responsibilities

A Template Service acts as the central repository for all notification content across channels (push, email, SMS). It stores:

  • Template definitions with variable placeholders like {username} or {amount}
  • Localization variants (English, Spanish, French versions of the same template)
  • Channel-specific formats (HTML for email, plain text for SMS)

How It Works

When a notification worker needs to send a message:

  1. Request template by ID and locale: template_id="order_shipped", locale="es"
  2. Retrieve template: "Hola {name}, tu pedido {orderId} ha sido enviado"
  3. Substitute variables: Pass {name: "Carlos", orderId: "54321"}
  4. Return rendered content: "Hola Carlos, tu pedido 54321 ha sido enviado"

Benefits

Centralization: Update "order shipped" message once, affects all future notifications instantly—no code deploys needed.

Consistency: Brand voice, formatting, and legal disclaimers stay uniform across millions of messages.

Localization: Automatically serve the right language based on user preferences without worker-level logic.

A/B Testing: Swap templates to test different wording and measure engagement.

Key Takeaway: A Template Service centralizes notification content management, enabling variable substitution and localization at scale while keeping notification logic clean and maintainable.