|
Vix Template Engine is a minimal, deterministic and high-performance C++ template rendering engine built for real systems. Designed for predictability, performance, and clarity. |
|
The Vix template engine removes complexity found in traditional template systems.
No magic. No hidden state. Just a clean pipeline:
Loader → Lexer → Parser → AST → Template → Renderer
Hello {{ name }}
{% if user %}Welcome{% endif %}
#include <vix/template/Engine.hpp>
using namespace vix::template_;
int main() {
Engine engine;
Context ctx;
ctx.set("name", "Alice");
ctx.set("user", true);
auto result = engine.render_string(
"Hello {{ name }} {% if user %}Welcome{% endif %}",
ctx
);
std::cout << result.output;
}Hello Alice Welcome
- Variable interpolation
- If conditions
- For loops
- HTML escaping (automatic)
- AST-based rendering
- Deterministic execution
- Optional caching
{{ name }}
{% if user %}
Hello
{% endif %}
{% for item in items %}
{{ item }}
{% endfor %}
Same input → same output No hidden behavior
Only essential features No over-engineering
- AST reused across renders
- no dynamic parsing at runtime
- low allocations
No runtime dependency Full control over memory and performance
cmake --preset dev-ninja
cmake --build --preset build-ninja./build-ninja/template_basic_render
./build-ninja/template_loops_and_conditions./build-ninja/template_render_bench
./build-ninja/template_parse_bench
./build-ninja/template_cache_benchThe engine is built on a clean separation of concerns:
- Loader → source retrieval
- Lexer → tokenization
- Parser → AST creation
- Template → compiled structure
- Renderer → execution
This makes the system:
- easy to understand
- easy to extend
- easy to optimize
Upcoming features:
- Filters (
{{ name | upper }}) - Includes
- Layout inheritance
- Expression system
- Compiler optimizations
The goal is not to be complex first.
The goal is to be:
- correct
- fast
- extensible
Contributions are welcome.
If you care about modern C++, performance, and real-world systems, this project is for you.
⭐ Star the project if you like the direction.
MIT License
