Writing web-applications in Go
Frictions and how we've overcome them.
Journey of web development
A brief history of the web, and how we got here.
-
2026
Hypermedia revolution
Pain surfaces from now maintaining business-logic in 2+ places. "JavaScript fatigue" is common knowledge, and browser performance suffers. JS Platform authors solve this by adding server-side rendering
It's time to go back to the server.
Turbo, htmx, Datastar and more are bringing the business-logic back to the server. Not to repeat our old mistakes, but to take advantage of how far the web has come since the 1990s.
Modern CSS, HTML5 and web-components didn't exist when we did our templates failed us. We're not hating on JavaScript. It's simply not as necessary as it once was.
-
Early 2010s
Single-Page-Applications
Rich web-applications exist, but as user-experience expectations rose, the amount of jQuery snippets were starting to cause pain. Single-page applications and components (React, Vue, Angular, etc) were celebrated as our saviors.
-
Mid 2000s
Rise of JavaScript
Google releases Gmail and Google Calendar with superior user-experience and developers all over the world looked at JS with new eyes. jQuery was born, but only used partially on top of existing server-rendered systems.
-
Early 2000s
Server Rendered HTML
Systems came online and more complicated applications were needed. PHP, Perl, ASP.net were born. JavaScript was used for popups, period.
-
Late 1990s
Static web-pages
The dawn of the world-wide-web. Geocities, Frontpage and Netscape. Pages were "dumb" and most interactivity was through cgi-bin forms.
Why Gastro?
Your programming language has strict types. Why doesn't that extend to templates and routing?
File-Based Routing
Pages in your pages/ directory automatically become routes. Dynamic parameters with [slug] syntax. No configuration needed — just create a file and it’s live.
Go Frontmatter
Write type-safe Go in the frontmatter, import libraries or services and make variables and functions available to your template.
HTML Body, using html/template
Uses the standard Go templating engine. Syntax validation and autocomplete for variables and functions.
Editors & Coding Agents
Full language server (LSP) with completions, diagnostics, and go-to-definition. For both the Go frontmatter and the HTML template body.
Extensions for VS Code, Zed and Nevim. More can be created as interest grows.
Single Binary Deploy
Templates and static assets are embedded at build time. Zero runtime dependencies. Ship one file anywhere.
Idiomatic Go
Standard Go syntax you already know. html/template, net/http, go:embed — no new language to learn, full type-safety throughout.
The project is still a Go project and you can build it as you see fit. We just take away the pain of managing page handlers and templates.
TODO: §3 eyebrow
TODO: §3 headline
TODO: §3 lede
TODO: server snippet
TODO: rendered preview
Anatomy of a Gastro
Get a Gastro project running in under a minute.
Write a component
---
type Props struct {
Title string
Author string
}
p := gastro.Props()
Title := p.Title
Author := p.Author
---
<article>
<h2>{{ .Title }}</h2>
<p>By {{ .Author }}</p>
</article>
Develop
# Start the dev server
gastro dev
# Watches for changes, rebuilds,
# and restarts automatically.
# Template changes are hot-reloaded.
Deploy
# Build a single binary
gastro build
# Templates and static assets are
# embedded. Ship one file anywhere.
./app