Skip to content

openpeeps/tim

Repository files navigation

Tim - Template Engine
⚡️ A high-performance templating engine & markup language
FastCompiledSource-to-SourceInterpreter

nimble install tim / npm install @openpeeps/tim

API reference
Github Actions Github Actions

About

Tim Engine is a powerful development tool designed to boost developer productivity. It combines a high-performance templating engine with a versatile micro programming language, enabling developers to create dynamic web applications with ease.

Additionally, Tim Engine supports source-to-source transpilation to multiple target languages: Lua, Python, Ruby, JavaScript and PHP and Nim. Note that all transpilation targets are currently in very early stages of development and may not yet be fully functional or stable.

Note

The primary focus of the project is currently on the core templating engine and its features, with transpilation capabilities being developed incrementally over time.

Key features

  • ⚡️ Fast, Compiled, Clean syntax
  • 🎯 Template engine with support for layouts, partials and views
  • 🍭 Source-to-Source transpilation to Lua, Python, Ruby, JavaScript and PHP
  • 📚 Standard Library with many built-in utilities for web development
  • 📦 Built-in Package Manager for easy installation of third-party packages
  • 🔁 Built-in Browser Sync & Reload
  • 🪄 SPA Awareness with support for client-side routing and dynamic content updates
  • 👑 Written in Nim language

Syntax Overview

Here is a simple example of Tim Engine's syntax for creating a basic web page template:

var title = "Welcome to Tim Engine"
div.container > div.row > div.col-12
  h1.display-4.fw-bold: $title // passing variable to template
  p.lead: "Tim Engine is a powerful templating engine and scripting language for developers."
  a.btn.btn-primary.px-4.rounded-3
    href="https://example.com": "Get Started"

Find more about Tim's syntax and features here https://tim.openpeeps.dev/language/syntax

Getting Started

To get started with Tim Engine, you can install it using Nimble, or download the latest release from GitHub. For detailed installation instructions and usage examples, please refer to the Official Documentation.

Documentation

Benchmarks

Here are some benchmarks comparing the performance of Tim Engine's virtual machine (VM) when executing pre-compiled templates. The benchmarks include various scenarios such as rendering HTML, dynamic data, conditionals, loops, and more.

Benchmark                           Iterations    Total (ms)    Mean (µs)       Ops/sec
─────────────────────────────────────────────────────────────────────────────────────
VM — static HTML                     10000        30.094         3.009       332289.
VM — dynamic data                    10000        39.361         3.936       254060.
VM — conditionals (true)             10000        22.154         2.215       451380.
VM — conditionals (false)            10000        22.737         2.274       439810.
VM — loops (10 items)                10000        68.805         6.880       145339.
VM — loops (1000 items)               1000       418.102       418.102         2392.
VM — string stdlib                   10000        23.358         2.336       428125.
VM — deep nesting                    10000        58.691         5.869       170384.
VM — mixed template                   5000       177.691        35.538        28139.
─────────────────────────────────────────────────────────────────────────────────────

While these benchmarks shows the full pipeline (lexing, parsing > ast > codegen > vm execution) for the same templates, which includes the overhead of parsing and code generation, it gives a more realistic picture of the overall performance of the engine when rendering templates without a prepared VM bytecode.

Benchmark                           Iterations    Total (ms)    Mean (µs)       Ops/sec
─────────────────────────────────────────────────────────────────────────────────────
Parsing — small                        10000        21.169         2.117       472396.
Parsing — complex                       5000       100.764        20.153        49621.
Full pipeline — static                  2000       607.031       303.515         3295.
Full pipeline — dynamic                 2000       627.298       313.649         3188.
Conditionals — true                     2000       609.800       304.900         3280.
Conditionals — false                    2000       610.486       305.243         3276.
Loops — 10 items                        1000       321.576       321.576         3110.
Loops — 1000 items                        50        37.672       753.439         1327.
String stdlib                           1000       303.507       303.507         3295.
Deep nesting                             500       161.140       322.281         3103.
Mixed template                           500       205.136       410.272         2437.

Awesome Projects using Tim Engine

❤ Contributions & Support

  • 🐛 Found a bug? Create a new Issue
  • 👋 Wanna help? Fork it!
  • 🎉 Spread the word! Tell your friends about Tim Engine
  • ⚽️ Play with Tim Engine in your next web-project

🎩 License

Tim Engine | LGPLv3 license. Made by Humans from OpenPeeps.
Copyright © 2026 OpenPeeps & Contributors — All rights reserved.