Templ: A language for writing HTML user interfaces in Go

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Nutrient – The #1 PDF SDK Library, trusted by 10K+ developers
Other PDF SDKs promise a lot - then break. Laggy scrolling, poor mobile UX, tons of bugs, and lack of support cost you endless frustrations. Nutrient’s SDK handles billion-page workloads - so you don’t have to debug PDFs. Used by ~1 billion end users in more than 150 different countries.
www.nutrient.io
featured
CodeRabbit: AI Code Reviews for Developers
Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
coderabbit.ai
featured
  1. gomponents

    HTML components in pure Go.

    I'm really happy you like it. :) And thank you for your comment, I really appreciate newcomer viewpoints especially.

    Have a look at the `Classes` helper component already available: https://github.com/maragudk/gomponents/blob/main/components/...

    Yeah, I'm not a total fan of the runtime panics, but it was a tradeoff where I chose in favour of API simplicity and readability. In practice, it works out well, because you catch any typos at development time.

    I've had elements and attributes in separate packages before, but then you can't dot-import both packages and not have name clashes, and have to either prefix elements or attributes with the package name, which makes the code much less readable. Again, a tradeoff. :)

  2. Nutrient

    Nutrient – The #1 PDF SDK Library, trusted by 10K+ developers. Other PDF SDKs promise a lot - then break. Laggy scrolling, poor mobile UX, tons of bugs, and lack of support cost you endless frustrations. Nutrient’s SDK handles billion-page workloads - so you don’t have to debug PDFs. Used by ~1 billion end users in more than 150 different countries.

    Nutrient logo
  3. templ

    A language for writing HTML user interfaces in Go.

  4. htmlgo

    A library for writing type-safe HTML in Golang

    Here are a couple:

    https://github.com/julvo/htmlgo

    https://github.com/rohanthewiz/element

    I'm sure there are many more.

    The thing about these is that performance is often not as good as when using templates, especially when the templates are compiled to native code. Quicktemplate [1] is still the leader here IMO, and I don't think the OP project brings much that couldn't be done pretty easily with QT.

    [1] https://github.com/valyala/quicktemplate

  5. element

    Native Go (golang) HTML generator - template eliminator (by rohanthewiz)

    Here are a couple:

    https://github.com/julvo/htmlgo

    https://github.com/rohanthewiz/element

    I'm sure there are many more.

    The thing about these is that performance is often not as good as when using templates, especially when the templates are compiled to native code. Quicktemplate [1] is still the leader here IMO, and I don't think the OP project brings much that couldn't be done pretty easily with QT.

    [1] https://github.com/valyala/quicktemplate

  6. quicktemplate

    Fast, powerful, yet easy to use template engine for Go. Optimized for speed, zero memory allocations in hot paths. Up to 20x faster than html/template

    Here are a couple:

    https://github.com/julvo/htmlgo

    https://github.com/rohanthewiz/element

    I'm sure there are many more.

    The thing about these is that performance is often not as good as when using templates, especially when the templates are compiled to native code. Quicktemplate [1] is still the leader here IMO, and I don't think the OP project brings much that couldn't be done pretty easily with QT.

    [1] https://github.com/valyala/quicktemplate

  7. jte

    Secure and speedy templates for Java and Kotlin.

    For java/Kotlin, we are using JTE (https://jte.gg/#getting-started), pretty nice build tooling and IDE support to generate pre-compiled templates without additional code generation steps.

  8. sprig

    Useful template functions for Go templates.

    Standard Go templating seems really lacking if you come from something like Jinja. Even with libraries like https://masterminds.github.io/sprig/ (used e.g. for Helm templating) it feels hard to use.

  9. CodeRabbit

    CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.

    CodeRabbit logo
  10. maud

    :pencil: Compile-time HTML templates for Rust

    I would like to mention maud in this context:

    https://github.com/lambda-fairy/maud

    It is refreshingly different from other Rust templating libraries. It uses a proc-macro that compiles your HTML into Rust code. I also happen to use it in conjunction with HTMX and it works very well for me (at least in small projects).

  11. gomponents-htmx

    HTMX attributes and helpers for gomponents.

  12. service

    Discontinued A template for Go services. (by maragudk)

    I've got my own super simple service template that I use internally for this: https://github.com/maragudk/service . I don't think I've added HTMX here (because I add it when needed), but it has auth and is totally classic in its setup.

  13. golang-layout-tpl-example

    A small example how to implement page templates using the same layout in Go. Just for education purposes.

    https://github.com/ckilb/golang-layout-tpl-example

    I don't like Go's template engine too much, I find it a bit cumbersome in many cases. But it's quite capable.

  14. webxx

    Declarative, composable, concise & fast HTML & CSS components in C++

    I believe I recently built something to do exactly what you're describing for HTML, though it's C++ (but maybe a useful basis for a rust version - I don't know).

    https://github.com/rthrfrd/webxx

  15. tal

    Here is an example of a old technology

    TAL -Template Attribute Language

    https://en.m.wikipedia.org/wiki/Template_Attribute_Language

    which happens to have an (also old) implementation i Go https://github.com/owlfish/tal

    I wonder what opinion HN has on this type of templating language?

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Do you know any library to make pdf in golang?

    7 projects | /r/golang | 24 Dec 2022
  • How to choose a golang template rending engine for my project?

    2 projects | /r/golang | 20 Jan 2022
  • What's the fastest template parser in Go?

    10 projects | dev.to | 1 Oct 2020
  • Show HN: Gomponents, HTML components in pure Go

    8 projects | news.ycombinator.com | 17 Oct 2024
  • Show HN - htmgo, build simple and scalable systems with go and Htmx

    7 projects | news.ycombinator.com | 28 Sep 2024