A templating language for Go: templ-style component declarations with a
JSX-style markup body, compiled to plain Go.
Status — alpha. gsx is usable end to end, but the language and APIs may change before a stable release. See Status and Roadmap.
.gsx files hold ordinary Go (imports, types, funcs) plus component
declarations. A generator lowers each component to plain Go in a .x.go file the
Go compiler type-checks and builds:
.gsx → parser → AST → codegen → .x.go → go build → HTML
- Checked by Go — each component keeps its authored Go signature; markup binds parameters by exact name and direct Go callers use the same function.
- Close to HTML and to Go — JSX-style markup for templates; ordinary Go for everything else. Tags resolve against package symbols; an unresolved lowercase tag remains an HTML element.
- templ-compatible —
gsx.Nodehas the identical method set totempl.Component, so gsx output drops into the templ ecosystem without importing templ. The runtime is standard-library only.
import "github.com/gsxhq/gsx"
// Markup can bind to a package-level var — inferred as gsx.Node.
var footer = <><hr/><small>Built with gsx</small></>
component Card(title string, featured bool, children gsx.Node) {
<section class={ "card", "card-featured": featured }>
<h2>{title}</h2>
{ if featured { <span class="badge">Featured</span> } }
<div class="body">{children}</div>
{footer}
</section>
}Run gsx generate to compile this to plain Go (.x.go), then go build.
- Docs — Why gsx · Principles · Syntax · CLI
- Examples — the test corpus is the canonical syntax reference (every case parses, generates Go, and pins its rendered output).
- Roadmap & status — docs/ROADMAP.md.
The public docs site — https://gsxhq.github.io/ — is built with VitePress in the
separate gsxhq.github.io repo, which
renders the Markdown in docs/guide/.
Issues and discussion welcome. Runtime code must stay standard-library only; the
generator/CLI may use golang.org/x/tools.
MIT © 2026 Jackie Li