Skip to main content


go install

With Go 1.20 or greater installed, run:

go install

Github binaries

Download the latest release from


templ provides a Nix flake with an exported package containing the binary at

nix run github:a-h/templ

templ also provides a development shell which includes all of the tools required to build templ, e.g. go, gopls etc. but not templ itself.

nix develop github:a-h/templ

To install in your Nix Flake:

This flake exposes an overlay, so you can add it to your own Flake and/or NixOS system.

inputs = {
templ.url = "github:a-h/templ";
outputs = inputs@{

# For NixOS configuration:
# Add the overlay,
nixpkgs.overlays = [
# and install the package
environment.systemPackages = with pkgs; [

# For a flake project:
forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
inherit system;
pkgs = import nixpkgs { inherit system; };
templ = system: inputs.templ.packages.${system}.templ;
in {
packages = forAllSystems ({ pkgs, system }): {
myNewPackage = pkgs.buildGoModule {
preBuild = ''
${templ system}/bin/templ generate

devShell = forAllSystems ({ pkgs, system }):
pkgs.mkShell {
buildInputs = with pkgs; [
(templ system)


A Docker container is pushed on each release to

Pull the latest version with:

docker pull

To use the container, mount the source code of your application into the /app directory, set the working directory to the same directory and run templ generate, e.g. in a Linux or Mac shell, you can generate code for the current directory with:

docker run -v `pwd`:/app -w=/app generate