Gx
GitHub

Gx

Gx is a Go framework for server-rendered web apps on Datastar.

Gx types the full loop of a web page: the template, the route, the link, the action, the form and the signal in the browser. A renamed field stops the build. It does not give a 404 at run time.

What you get

  • Typed templates. A .gx file is HTML with Go expressions. Props have names and types.
  • Typed routes and links. A route is a Go struct. A link is a value of that struct.
  • Typed actions and forms. An action answers with typed patches. A form has one rule set for the browser and the server.
  • No node. The gx command and the Go toolchain run each default workflow.
  • One binary. gx build puts the pages, the scripts and the stylesheet in one file.
  • Components that you own. gx add copies a component into the app, and gx update merges a later release.
  • Islands. A TypeScript file is a component with typed props from Go, for the part of a page that needs client code.
  • Widgets. A component of your app is a custom element on a page of a different site. Your server renders it. Read Widgets.
  • Tools for agents. An action with .Tool() is a tool that the agent of a user calls, in the browser and over MCP. Read Actions as tools for agents.
  • Plugins. A typed Go value adds directives, commands and build steps to the gx command of a project. Read Plugins.
  • Automatic updates. c.Update sends only the fragments that changed. An optimistic directive shows a change before the server answers.
  • A JSON wire. An action with .API() answers JSON. gx api writes an OpenAPI file and a TypeScript client.
  • Shared signals. Each viewer of a room sees the value of a shared signal.
  • Checks with no test to write. gx check finds content model defects, pages over their budget and dead code. gx fuzz renders each component with random props.
  • Email. The registry item email and gx.RenderEmail make an HTML email and its plain text from a component.