Skip to content

Latest commit

 

History

2,332 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gsx

Go Reference CI Release Go Version License: MIT

A JSX-like templating language for Go, compiled to plain Go that streams HTML.

Status — alpha, tagged. gsx is used in production today and ships tagged releases from v0.1.0; language and API compatibility may change before 1.0. See Status, the changelog, and the Roadmap.

What is gsx

.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 exact authored Go signature, and markup binds parameters by name.
  • HTML-shaped markup with ordinary Go — use JSX-like markup for templates and ordinary Go for everything else.
  • Safe by context — contextual HTML, URL, CSS, and JavaScript escaping with a standard-library-only runtime.
  • Go-native tooling — generation and builds are Go; Node.js is needed only when your application chooses frontend tooling such as Vite.

A taste

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.

Learn more

Documentation site

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/.

Contributing

Issues and discussion welcome. Runtime code must stay standard-library only; the generator/CLI may use golang.org/x/tools.

License

MIT © 2026 Jackie Li

About

JSX-style HTML templating for Go

Topics

Resources

Stars

60 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages