{"id":37155275,"url":"https://github.com/typelate/muxt","last_synced_at":"2026-04-27T03:04:04.599Z","repository":{"id":251708080,"uuid":"838205275","full_name":"typelate/muxt","owner":"typelate","description":"\"html/template\" Enhancing Tools for Hypermedia Web Applications","archived":false,"fork":false,"pushed_at":"2026-01-14T08:19:40.000Z","size":2592,"stargazers_count":6,"open_issues_count":5,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-14T11:14:40.235Z","etag":null,"topics":["generate","go","go-template","golang","htmx","hypermedia-driven-application","interface-description-language","template","type-check","webapps"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/typelate.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-08-05T06:58:23.000Z","updated_at":"2026-01-14T07:13:47.000Z","dependencies_parsed_at":"2025-12-01T08:09:16.182Z","dependency_job_id":null,"html_url":"https://github.com/typelate/muxt","commit_stats":null,"previous_names":["crhntr/muxt","typelate/muxt"],"tags_count":105,"template":false,"template_full_name":null,"purl":"pkg:github/typelate/muxt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typelate%2Fmuxt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typelate%2Fmuxt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typelate%2Fmuxt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typelate%2Fmuxt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/typelate","download_url":"https://codeload.github.com/typelate/muxt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typelate%2Fmuxt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28430513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T16:38:47.836Z","status":"ssl_error","status_checked_at":"2026-01-14T16:34:59.695Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["generate","go","go-template","golang","htmx","hypermedia-driven-application","interface-description-language","template","type-check","webapps"],"created_at":"2026-01-14T18:21:48.413Z","updated_at":"2026-04-27T03:04:04.587Z","avatar_url":"https://github.com/typelate.png","language":"Go","readme":"# Muxt [![Go Reference](https://pkg.go.dev/badge/github.com/typelate/muxt.svg)](https://pkg.go.dev/github.com/typelate/muxt) [![Go](https://github.com/typelate/muxt/actions/workflows/go.yml/badge.svg)](https://github.com/typelate/muxt/actions/workflows/go.yml)\n\n**Server-rendered HTML, type-checked at `go generate` time.**\n\n```gotmpl\n{{define \"GET /article/{id} GetArticle(ctx, id)\"}}\n  \u003ch1\u003e{{.Result.Title}}\u003c/h1\u003e\n{{end}}\n```\n\n```go\nfunc (s Server) GetArticle(ctx context.Context, id int) (Article, error) { ... }\n```\n\nThe template name is the route, the handler call, and the parameter list. Muxt uses `go/types` to verify the whole chain — `GetArticle` exists on `Server`, `id` parses to `int`, `.Result.Title` is valid on `Article` — then writes the `http.Handler` glue. Typos and signature drift become `go generate` errors, not 5 PM pages.\n\n## Why Muxt\n\n- **Single source of truth.** Route, handler, and HTML live together. No separate `mux.HandleFunc` registration to drift out of sync.\n- **Caught at generate time.** `go/types` flags stale field access, parameter mismatches, and missing methods before they ship.\n- **No runtime reflection.** Generated code uses only `net/http` and `html/template`. Reads like hand-written Go.\n- **Built for hypermedia.** HTMX, Datastar, and plain server-rendered HTML are the happy path — not an afterthought.\n\n## Install\n\n```bash\ngo install github.com/typelate/muxt@latest\n```\n\nOr as a project tool: `go get -tool github.com/typelate/muxt` (note the [license](#License)). Pre-built binaries are also attached to each [release](https://github.com/typelate/muxt/releases).\n\n## Quick Start\n\n1. Create a template `index.gohtml`:\n   ```gotmpl\n   {{define \"GET / Home(ctx)\"}}\n   \u003ch1\u003e{{.Result}}\u003c/h1\u003e\n   {{end}}\n   ```\n\n2. Wire it up in `main.go`:\n   ```go\n   //go:embed *.gohtml\n   var templateFS embed.FS\n\n   //go:generate muxt generate --use-receiver-type=Server\n   var templates = template.Must(template.ParseFS(templateFS, \"*.gohtml\"))\n\n   type Server struct{}\n\n   func (s Server) Home(ctx context.Context) string { return \"Hello, Muxt!\" }\n   ```\n\n3. Generate and run:\n   ```bash\n   go generate \u0026\u0026 go run .\n   ```\n\nThe `templates` variable must be package-level — Muxt finds it via static analysis.\n\n## Template Syntax\n\nStandard `http.ServeMux` pattern, optionally with a status code and method call:\n\n```\n[METHOD ][HOST]/[PATH][ HTTP_STATUS][ CALL]\n```\n\nExample: `\"POST /user/{id} 201 CreateUser(ctx, id, form)\"`\n\nSupported parameters: `ctx`, `request`, `response`, path params, `form` (URL-encoded body), `multipart` (file uploads, including `*multipart.FileHeader` fields). Returns and errors flow through `TemplateData[R, T]`. Status codes can come from the template name, return values, or error types.\n\n`TemplateRoutePaths` extends type safety to URLs: `{{$.Path.GetArticle 42}}` instead of hardcoded `href=\"/article/42\"`. Change the route pattern, the compiler finds every stale reference.\n\n## Commands\n\n- `muxt generate` — generate `http.Handler` glue (writes `template_routes.go`)\n- `muxt check` — type-check templates without generating (use in CI or editor save hooks)\n- `muxt list-template-calls` / `muxt list-template-callers` — explore call sites and callers\n\n## Examples\n\n- **[Local example](./docs/examples/simple/)** — complete application with tests ([pkg.go.dev](https://pkg.go.dev/github.com/typelate/muxt/docs/examples/simple/hypertext))\n- **[Sortable Example](http://github.com/typelate/sortable-example)** — HTMX-enabled table row sorting\n- **[HTMX Template](https://github.com/typelate/htmx-template)** — full HTMX integration patterns\n\nThe [command tests](./cmd/muxt/testdata) double as readable examples of every feature.\n\n## Documentation\n\n- **[Reference](docs/reference/)** — CLI, syntax, parameters, type checking\n- **[Explanation](docs/explanation/)** — design philosophy, patterns, decisions\n\nSee the [full documentation index](docs/).\n\n### Go Standard Library\n\n- [html/template](https://pkg.go.dev/html/template) — template syntax, functions, escaping\n- [net/http](https://pkg.go.dev/net/http) — `ServeMux` routing patterns, `Handler` interface\n- [embed](https://pkg.go.dev/embed) — file embedding directives\n- [Routing Enhancements for Go 1.22](https://go.dev/blog/routing-enhancements) — pattern syntax Muxt extends\n\n## Using with AI Assistants\n\nClaude Code skills for working with Muxt codebases:\n\n| Skill | Use Case |\n|-------|----------|\n| [explore-from-route](docs/skills/muxt_explore-from-route/SKILL.md) | Trace from a URL path to its template and receiver method |\n| [explore-from-method](docs/skills/muxt_explore-from-method/SKILL.md) | Find which routes and templates use a receiver method |\n| [explore-from-error](docs/skills/muxt_explore-from-error/SKILL.md) | Trace an error message back to its handler and template |\n| [explore-repo-overview](docs/skills/muxt_explore-repo-overview/SKILL.md) | Map all routes, templates, and the receiver type |\n| [test-driven-development](docs/skills/muxt_test-driven-development/SKILL.md) | Create new templates and receiver methods using TDD |\n| [forms](docs/skills/muxt_forms/SKILL.md) | Form creation, struct binding, validation, accessible HTML |\n| [debug-generation-errors](docs/skills/muxt_debug-generation-errors/SKILL.md) | Diagnose and fix `muxt generate` / `muxt check` errors |\n| [refactoring](docs/skills/muxt_refactoring/SKILL.md) | Rename methods, change patterns, move templates safely |\n| [htmx](docs/skills/muxt_htmx/SKILL.md) | Explore, develop, and test HTMX interactions |\n| [integrate-existing-project](docs/skills/muxt_integrate-existing-project/SKILL.md) | Add Muxt to an existing Go web application |\n| [sqlc](docs/skills/muxt_sqlc/SKILL.md) | Use Muxt with sqlc for type-safe SQL + HTML |\n| [goland-gotype](docs/skills/muxt_goland-gotype/SKILL.md) | Add gotype comments for GoLand IDE support (GoLand-only) |\n| [maintain-tools](docs/skills/muxt_maintain-tools/SKILL.md) | Install and update muxt, gofumpt, counterfeiter, and other tools |\n\nInstall as Claude Code skills:\n\n```bash\nfor d in docs/skills/*/; do cp -r \"$d\" ~/.claude/skills/\"$(basename \"$d\")\"; done\n```\n\n## License\n\nMuxt generator: [GNU AGPLv3](LICENSE)\n\nGenerated code: [MIT License](https://choosealicense.com/licenses/mit/) — Go code generated by Muxt is not covered by AGPL. It is provided as-is without warranty. Use it freely in your projects.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypelate%2Fmuxt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftypelate%2Fmuxt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypelate%2Fmuxt/lists"}