{"id":19049502,"url":"https://github.com/crhntr/muxt","last_synced_at":"2025-09-07T04:31:40.413Z","repository":{"id":251708080,"uuid":"838205275","full_name":"crhntr/muxt","owner":"crhntr","description":"\"html/template\" Enhancing Tools for Hypermedia Web Applications","archived":false,"fork":false,"pushed_at":"2025-08-29T05:46:42.000Z","size":2150,"stargazers_count":3,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-29T09:36:50.149Z","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/crhntr.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}},"created_at":"2024-08-05T06:58:23.000Z","updated_at":"2025-08-29T05:46:05.000Z","dependencies_parsed_at":"2024-08-22T09:31:55.292Z","dependency_job_id":"92f29da5-37b4-4dfd-9455-e698abf593fd","html_url":"https://github.com/crhntr/muxt","commit_stats":null,"previous_names":["crhntr/muxt","typelate/muxt"],"tags_count":86,"template":false,"template_full_name":null,"purl":"pkg:github/crhntr/muxt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crhntr%2Fmuxt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crhntr%2Fmuxt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crhntr%2Fmuxt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crhntr%2Fmuxt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crhntr","download_url":"https://codeload.github.com/crhntr/muxt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crhntr%2Fmuxt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273996593,"owners_count":25204472,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-07T02:00:09.463Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":"2024-11-08T23:11:03.498Z","updated_at":"2025-09-07T04:31:40.406Z","avatar_url":"https://github.com/crhntr.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Muxt [![Go Reference](https://pkg.go.dev/badge/github.com/crhntr/muxt.svg)](https://pkg.go.dev/github.com/crhntr/muxt) [![Go](https://github.com/crhntr/muxt/actions/workflows/go.yml/badge.svg)](https://github.com/crhntr/muxt/actions/workflows/go.yml)\n\n**Muxt** generates and registers HTTP Handler functions specified in HTML templates.\nIt increases locality of behavior when creating server side rendered hypermedia web applications.\n\nMuxt looks for templates with names that match an extended version of the `http.ServeMux` pattern syntax.\n\nThe standard `http.ServeMux` pattern syntax looks like this:\n\n\u003e `[METHOD ][HOST]/[PATH]`\n\nMuxt extends this by adding optional fields for an HTTP status and a call:\n\n\u003e `[METHOD ][HOST]/[PATH][ HTTP_STATUS][ CALL]`\n\n### Route Registration Example\n\nYou tell `muxt` how to generate the handler functions by defining templates like this `{{define \"GET / F()\" -}}`.\n`muxt` will generate a handler function that calls F and pass the result to the template.\nThe template result will then be written to the HTTP response.\n\n```html\n{{define \"GET / F()\" -}}\n\u003c!DOCTYPE html\u003e\n\u003chtml lang='en'\u003e\n\u003chead\u003e\n    \u003cmeta charset='UTF-8'/\u003e\n    \u003ctitle\u003eHello!\u003c/title\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n\u003ch1\u003eNumber {{.Result}}\u003c/h1\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n{{- end}}\n```\n\n### Tiny Examples\n\n`muxt` routes HTML templates to Go methods and handles common web plumbing:\n\n* `{{define \"GET /{id} F(id)\"}}{{end}}` — Parses `{id}` as `int` and passes to `F(int)`.\n* `{{define \"GET / F(ctx)\"}}{{end}}` — Injects `request.Context()` if `ctx` is used.\n* `{{define \"GET / F(request)\"}}{{end}}` — Injects the `*http.Request` when `request` is named.\n* `{{define \"GET / F(response)\"}}{{end}}` — Injects `http.ResponseWriter` if `response` is used.\n* `{{define \"POST / F(form)\"}}{{end}}` — Parses form data into a struct from `url.Values` if the `form` parameter is a struct.\n* `{{define \"POST / F(form)\"}}{{end}}` — Parses form data into a struct if the `form` parameter is a `url.Values`.\n\nThe result of the call is wrapped in a `TemplateData[T]` struct and passed to `ExecuteTemplate`.\n\n### Bigger Examples\n\nFor a small runnable, see: [./example/hypertext/index.gohtml](./example/hypertext/index.gohtml)\nThe Go package documentation for the example shows what is generated `https://pkg.go.dev/github.com/crhntr/muxt/example/hypertext`.\n\nFor larger complete examples, see:\n- [muxt-example-htmx-sortable](http://github.com/crhntr/muxt-example-htmx-sortable) _**(NEW)**_\n- [muxt-template-module-htmx](https://github.com/crhntr/muxt-template-module-htmx)\n\n## License\n\nMuxt is licensed under the [GNU AGPLv3](LICENSE).\n\nHowever, the Go code generated by `muxt` is **not** covered by the AGPL.\nIt is licensed under the MIT license (see `https://choosealicense.com/licenses/mit/`).\nThe code generated by `muxt` is provided as-is, without a warranty of any kind.\nThe `muxt` author disclaims all liability for any bugs, regressions, or defects in generated output.\n## Documentation\n\n### Introduction\n\n- [Getting Started](./docs/getting_started.md)\n- [Notes on Integration with Existing Projects](./docs/integrating.md)\n- [Writing Template Names](./docs/template_names.md)\n\n### Reference\n\n- [Call Parameters](./docs/call_parameters.md)\n- [Call Results](./docs/call_results.md)\n- [Writing Receiver Methods](./docs/writing_receiver_methods.md)\n- [Templates Variable](./docs/templates_variable.md)\n- [Template Action Type-Checking](./docs/action_type_checking.md)\n- [Known Issues](./docs/known_issues.md)\n\n### Testing\n\n- [Testing Hypertext](./docs/testing_hypertext.md)\n\n### Philosophy \u0026 Vision\n\n- [Manifesto](./docs/manifesto.md)\n- [Motivation](./docs/motivation.md)\n- Goals:\n  [see enhancement issues](https://github.com/crhntr/muxt/issues?q=is%3Aissue%20state%3Aopen%20label%3Aenhancement)\n\n\n## Prompting\n\n- [Prompting Helpers](./docs/prompts)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrhntr%2Fmuxt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrhntr%2Fmuxt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrhntr%2Fmuxt/lists"}