Skip to content
Tech Atlas, home
Search
Esc
  • All roadmapsBrowse every learning path
  • ExploreFind a technology area
  • ProjectsGuided projects and builds
  • My AtlasYour learning dashboard
Practice build · Servers and backend infrastructure

Build your own Template Engine

A template engine that turns Hello {{ name }} plus data into HTML, with loops, conditionals and automatic escaping.

  • Intro
  • About 4–8 h
  • 4 checkpoints
  • 3 tutorials · Python, JavaScript

Pick a tutorial, then check yourself at each checkpoint. Work in any language you like.

Choose a tutorial

Why build it

A template engine is a tiny compiler: it tokenises, builds a structure and generates output. Adding auto-escaping shows why templates are the first line of defence against cross-site scripting.

You will be able to

  • Split a template into text and tag tokens.
  • Compile a template once and render it many times with different data.
  • Escape output by default and explain how that prevents XSS.
  • Report template errors with line numbers.

Skills it exercises

Recommended on Backend Engineer and Cybersecurity Engineer.

Checkpoints

How you know you are there

Work in any language. Each checkpoint ends with something you can run or observe, so you can check it yourself.

  1. Checkpoint 1Self-check

    Variables

    Done when: render('Hello {{ user.name }}!', {user: {name: 'Ada'}}) returns Hello Ada!, including dotted lookups.

  2. Checkpoint 2Self-check

    Loops and conditionals

    Done when: for and if blocks render nested lists correctly, and an unclosed block raises an error with its line number.

  3. Checkpoint 3Self-check

    Escaping

    Done when: A value containing <script>alert(1)</script> renders as text, a value marked safe renders as HTML, and tests cover both.

  4. Checkpoint 4Self-check

    Compile once

    Done when: Templates are compiled once and cached, and a benchmark shows 10,000 renders run faster than re-parsing each time.

Stretch goals

  • Template inheritance with extends and block.
  • Filters such as {{ name | upper }}.
Follow a tutorial

Step-by-step guides

Pick one in a language you know (tutorial languages: Python, JavaScript). They open on the author’s site.

Where to go next

Practice builds are self-paced: Tech Atlas does not track them or count them as evidence. To show a skill, take its knowledge check from the skill page.

Tutorials come from codecrafters-io/build-your-own-x (CC0, snapshot of 2026-07-14, commit aa17439; links checked on 2026-10-19). Each tutorial belongs to its author and keeps its own licence; Tech Atlas links to it and does not host it. Briefs, checkpoints and the mapping to skills are Tech Atlas editorial drafts.