A Go port of the Razor view engine that compiles templates to Go code for extreme performance and concise syntax.
gorazor is a Razor view engine for Go that compiles HTML templates into Go code for exceptional performance. It ports the concise Razor syntax from ASP.NET, allowing developers to mix Go logic directly in templates while benefiting from Go's compiler optimizations and type safety.
Go developers building web applications who need high-performance HTML templating with a clean syntax and strong typing.
Developers choose gorazor for its benchmark-proven speed—up to 20x faster than html/template—and its familiar Razor syntax, which reduces boilerplate while providing full Go code integration and compile-time validation.
Razor view engine for go
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Compiles templates to optimized Go code, achieving up to 20x speed over html/template in benchmarks, with near-zero allocation in optimized modes using ByteBuffer.
Uses concise @variable notation without clunky delimiters like {{, reducing template noise and leveraging familiarity from ASP.NET Razor.
Allows embedding arbitrary Go code blocks and flow controls directly in templates, enabling complex logic without learning a separate mini-language.
Strongly typed models are validated by the Go compiler, catching type errors early and ensuring robust template execution with no reflection overhead.
Requires running the gorazor tool to generate code, adding an extra step to the build process and complicating development workflows compared to runtime templating.
Mandatory folder naming (helper, layout) and variable names impose constraints that can be error-prone and limit flexibility in template organization.
Smaller community compared to standard templating solutions like html/template, resulting in fewer resources, plugins, and long-term support assurances.