r/webdev • • 23h ago

Showoff Saturday Complete Go stack for reactive web apps with agentic features for users

I have always been fascinated by the server-driven approach to web development (UI code runs on the server, the browser is extra thin), and I experimented with it throughout my career.

There aren't many server-driven stacks, and they can't compete with what the front-end JS ecosystem offers. I wanted to change that. It was much more complicated than I initially expected and took more than two years.

Layer 1: Templates

You may love JSX, you may hate it, but the ability to write HTML templates in code and treat them like code is a must-have for complex UIs. I tried templ, but it wasn't flexible enough: it lacked features like HTML as an expression (so it can be saved to a variable or passed to a function), and the LSP experience wasn't great.

Meet GoX. It lets you write HTML templates as typed Go expressions that compile to plain Go:

  • Seamless editor support: a near-native language server experience across .gox and .go files.
  • Full templating toolbox: conditionals, loops, composition and reusable components.
  • Extensible rendering pipeline: templates compile to a stream of render jobs, processable with custom printers.
  • templ compatible: gox.Elem implements Render(ctx, w) and drops in wherever a templ component is expected.

Why not contribute to templ? That was my original idea, but when I looked at its code base, I saw it had gone a completely different route in almost every way.

Layer 2: The framework

Doors is somewhat similar to LiveView (see the README for the differences). It lets you build reactive web apps without JavaScript or an API: the server is the application runtime, and the browser is the remote renderer and input layer. When the user presses a button, it triggers a Go function:

<button (doors.AClick{
    On: func(ctx context.Context, _ doors.RequestPointer) bool {
        order.Pay(ctx) 
        return true
    },
})>Pay</button>

Under the hood, it creates a private temporary endpoint, scoped to this particular event on this button for this particular user.

It has both reactive state and DOM containers, and ships a ton of useful features, like routing-free resource serving:

<img (doors.ResourceLocalFS("./private/chart.png"))>

Layer 3: Agent integration

Neui turns each user's page into an agent harness. You can think of it as a more powerful but specialized version of CopilotKit.

Demo GIF, recorded live from example in repo

The agent sees & operates the UI

Annotate what the agent can access (links, inputs, buttons), so the agent sees it and can help the user with UI operations, or even automate them with scripting.

~>neui.Use{ Desc:"submit the form" } <button>Submit</button>

or expose context data for the agent:

<div class="card">
    ~neui.Data{Text: "the product shown in the card", Object: product}
    ...
</div>

Dynamically dispatched tools, right in the markup

Same way as you render a button to the user, you give the agent a tool. No endpoints or lifecycle management needed.

~(if user.IsAdmin() {
    ~neui.Tool[Refund, Receipt]{
        Name: "refund",
        Desc: "Refund the order",
        Handler: orders.Refund,
    }
})

Work environment

Isolated file workspace and sandboxed scripting ("code mode") out of the box. Like a little brother of your local agent.

Agentic apps

When a user needs something your UI doesn't have, the agent builds it on demand, and it runs in your web app's shell.

Complete chat experience

Thread list, history, message edits, search, a message queue and automatic compaction. Use it as is, customize it or fork it.

Batteries included

MCP connector, web and .xlsx tools, and a rich library of building blocks for generative apps.

Budget friendly System prompt and provided tool list do not change during operation - it caches and stays hot (because it's usually the same for all your users!) + pull-based, targeted UI sync (with no html noise); agent monitors only parts of UI that are relevant to the task.

AI use

Doors and GoX were built by hand initially; now I use Claude Code to maintain them. It took me about a year to prepare the initial Doors release, plus one more year to stabilize + rebuild on GoX.

Neui's foundation is written by hand: the core packages, the runtime model, the chat, and the main interfaces and protocol layer. From there I used Claude Code to finish it: spec-driven work on some packages and step-by-step edits on others. It took 3 months from the start to the current state.

P.S. To be honest, I cant be sure whether anybody needs it or not. My goal was to push the boundaries of technology, and as a result I made things accessible to Go developers that I am sure no ecosystem currently offers. I hope someone sees here the potential to build something better than what the competition does. And oh boy, they won't be disappointed.

0 Upvotes

7 comments sorted by

1

u/a_cox-2916 4h ago

Since the refund tool is exposed only for admins, is that permission checked again when the handler runs? Curious where Doors puts the authorization boundary.

0

u/der_struct 4h ago edited 3h ago

Agent lives on the server and calls server function, so there is no http boundary to control; so authorization is enforced by dispatch level and lifecycle control automatically.

This tool exists only while it's "mounted" (like virtual element) and only for agent thread that belongs to this page instance.

Event hooks in doors work the same way, but there is also protected temporary endpoint. In practice that means that you don't have to manage endpoints at all - you render button with attached hander - and only this specific user on this specific page can trigger it while it's mounted.

0

u/nickchomey 20h ago

-1

u/der_struct 20h ago edited 20h ago

I know about datastar, it's HTMX familty, not LiveView. There is no server-side app process, endpoints are static. Your logic in datastar is scattered across templates and endpoints, linked via untyped attribute values; its not the same as writing Go code that controls UI.
I released GoX half year or more earlier then GSX (which is alpha)

1

u/nickchomey 19h ago

OK, good luck to you and gox! 

-1

u/der_struct 19h ago

I made this small port of Datastar htop by Alex Pliutau to doors, if you want to learn the difference clone and ask the agent.