Installation
Check your Go version
lttr needs Go 1.25 or newer.
go version
Configure private module access
sulv-io/lttr is a private repository. The public module proxy and checksum database cannot read it, so go get fails until you tell Go to fetch it directly and give Git a credential that can read it. You do this once per machine.
Mark the module as private
go env -w GOPRIVATE='github.com/sulv-io/*'
GOPRIVATE sets GONOPROXY and GONOSUMDB to the same pattern, so Go fetches anything under github.com/sulv-io/ straight from GitHub and skips the checksum lookup that would fail on a repository it cannot see.
Let Git authenticate
Go fetches modules over HTTPS. Rewrite those URLs to carry a token that can read the repository:
git config --global url."https://x-access-token:${GITHUB_TOKEN}@github.com/sulv-io/".insteadOf "https://github.com/sulv-io/"
If you already use an SSH key with GitHub, rewrite to SSH instead and no token is stored:
git config --global url."git@github.com:sulv-io/".insteadOf "https://github.com/sulv-io/"
Verify
go env GOPRIVATE
git ls-remote https://github.com/sulv-io/lttr HEAD
The first prints github.com/sulv-io/*. The second prints a commit hash. If it asks for a password or reports Repository not found, the credential is the problem, not Go.
~/.gitconfig. On a workstation prefer SSH; in CI, inject a short-lived token as an environment variable.Add the module
go get github.com/sulv-io/lttr@latest
lttr depends on two modules besides the standard library: goldmark, which the comark parser extends, and yaml.v3, which reads kit.yaml and frontmatter.
Most services import the root package, kit, and one shipped kit:
| Import path | What it holds |
|---|---|
github.com/sulv-io/lttr | Compile, MustCompile, Template, Renderer, Config, Profile, Recipient, Message, Sender, SMTP |
github.com/sulv-io/lttr/kit | Load, Types, Funcs, the *kit.Kit your own kit loads into |
github.com/sulv-io/lttr/kits/plain | MustKit(), the small starter kit |
github.com/sulv-io/lttr/kits/quiet | MustKit(), the complete example kit |
The pipeline packages (comark, data, ir, render, render/html, render/text) are exported for tools and tests. You rarely import them directly.
go list -m github.com/sulv-io/lttr.Install the CLI
go install github.com/sulv-io/lttr/cmd/lttr@latest
lttr -h
usage: lttr <command> [flags]
commands:
preview render every sample to a directory with an index page
render write one sample's .eml to stdout
lint compile, render and check template files
tags list a template's merge tags and bindings
serve the studio: a live preview of the samples that reloads on save
kit init start a new kit in a directory, copied from Plain
kit check load a kit, render its samples and check the HTML
-kit selects the kit: quiet (the default: the example templates), plain,
or a kit directory. Run "lttr <command> -h" for a command's flags.
The CLI's default kit is Quiet: examples/quiet's nine reference emails, with typed sample data. Use it to see the design, try a component or check a change to the library. lttr serve reads Quiet's templates from examples/quiet/templates by default, so run it from a checkout of the repository or pass -dir. Point -kit at plain, or at a directory (./mykit) to work on your own kit; a kit that binds Go types can only be checked from Go, not the CLI (see Go types and funcs). See CLI and Goldens and testing.
Next steps
- Quick start builds, renders and prints a complete email in one file.
- What is a kit walks the file layout Plain and Quiet share.
- Comark syntax covers what a template can contain.