templ.js

Status

Accepted - February 2026

Context

Temple was initially implemented in Python 3.10+ for rapid prototyping and leveraging Python’s rich parsing ecosystem (Lark). However, several factors have emerged that favor migrating to TypeScript:

Current Pain Points

  1. VS Code Extension Complexity: The current architecture requires a Python LSP server, Node.js LSP proxy, and virtual document providers, creating a multi-language maintenance burden
  2. Deployment Friction: End users must install Python runtime + dependencies for the VS Code extension
  3. Browser Support: Python cannot run in browser environments, limiting use cases (web playgrounds, browser-based editors)
  4. Type Safety Gaps: Python’s gradual typing system (mypy) is less strict than TypeScript’s compile-time enforcement
  5. npm Ecosystem: Template authors expect Node.js tooling (npm packages, bundlers) for integration

Opportunities with TypeScript

  1. Unified Stack: Single language for core library, VS Code extension, CLI, and browser bundles
  2. Native VS Code Integration: TypeScript is VS Code’s native language, enabling simpler language server implementations
  3. Performance: V8/Node.js performance characteristics are well-understood for text processing workloads
  4. Ecosystem Alignment: npm is the de facto package manager for frontend tooling

Migration Feasibility

Decision

Full migration to TypeScript with rebrand to templ.js.

Implementation Approach

  1. Core Library: Rewrite temple package as @templjs/core in TypeScript
  2. VS Code Extension: Migrate to native TypeScript language server (Volar framework)
  3. CLI Tool: Implement @templjs/cli as Node.js binary
  4. Test Parity: Port all 800+ Python tests to Vitest
  5. Documentation: Update all docs to reflect TypeScript APIs

Non-Goals

Consequences

Positive

Negative

Neutral

References