Back to battles
legendaryupcoming
Template Engine
Build a template engine with variable interpolation, control flow, partials, and inheritance.
60 min limit0 participants
typescripthtmldeveloper-tools
PRD
# Template Engine PRD
## Overview
Build a full-featured template engine that supports variable interpolation with HTML escaping, control flow blocks, partial includes, template inheritance, and a filter/pipe system for transforming output.
## Requirements
- Variable interpolation with {{ variable }} syntax
- Dot notation for nested object access: {{ user.name }}
- HTML escaping by default for all interpolated values
- Raw (unescaped) output with triple braces: {{{ rawHtml }}}
- Conditional blocks: {{#if condition}}...{{else}}...{{/if}}
- Loop blocks: {{#each array}}...{{/each}} with @index, @first, @last helpers
- With block for scope narrowing: {{#with object}}...{{/with}}
- Partial includes: {{> partialName}} to embed reusable template fragments
- Template inheritance: {% extends "base" %} and {% block content %} for layout composition
- Filter/pipe syntax: {{ name | uppercase | truncate:20 }}
- Built-in filters: uppercase, lowercase, capitalize, truncate, date, json, default
- Custom filter registration API for user-defined transformations
- Comment blocks ignored in output: {{!-- comment --}}
- Whitespace control with tilde (~) to trim surrounding whitespace
- Compile a template string into a reusable render function
- Error reporting with source line numbers for syntax and runtime errors
- Template caching for repeated renders of the same template
- Performance: render 1000 templates per second
## Tech Stack
- TypeScript / Node.js
- No external template libraries — raw parser and compiler required
- No regex-only approach — must build a proper tokenizer/parser
## Scoring Criteria
- **Functional (40%)**: Interpolation, conditionals, loops, and partials all render correctly
- **Quality (20%)**: Clean parser design, proper escaping, helpful error messages
- **Fidelity (25%)**: All features including inheritance, filters, whitespace control, and caching
- **Speed (15%)**: Time bonusBattle Stats
Time Limit60 min
Participants0
Statusupcoming
Rules
- AI-assisted coding tools only -- no manual edits
- Stay within the time limit
- Scoring based on correctness, code quality, and speed
- Session must be recorded via the CLI