{"id":28591531,"url":"https://github.com/jackielii/structpages","last_synced_at":"2026-05-18T21:12:17.654Z","repository":{"id":296377801,"uuid":"993162302","full_name":"jackielii/structpages","owner":"jackielii","description":"Build Templ pages with Struct-based Routing","archived":false,"fork":false,"pushed_at":"2025-11-04T16:10:07.000Z","size":15546,"stargazers_count":8,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-04T18:10:19.320Z","etag":null,"topics":["go","htmx","routing","templ","urlfor"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jackielii.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"docs/supported-flows.md","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":"2025-05-30T10:17:41.000Z","updated_at":"2025-11-04T16:10:04.000Z","dependencies_parsed_at":"2025-05-30T13:26:59.941Z","dependency_job_id":"a6f417d7-52b7-4844-842f-92dc681db275","html_url":"https://github.com/jackielii/structpages","commit_stats":null,"previous_names":["jackielii/stx","jackielii/structpages","jackielii/srx"],"tags_count":29,"template":false,"template_full_name":null,"purl":"pkg:github/jackielii/structpages","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackielii%2Fstructpages","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackielii%2Fstructpages/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackielii%2Fstructpages/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackielii%2Fstructpages/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jackielii","download_url":"https://codeload.github.com/jackielii/structpages/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackielii%2Fstructpages/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29576850,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T08:38:15.585Z","status":"ssl_error","status_checked_at":"2026-02-18T08:38:14.917Z","response_time":162,"last_error":"SSL_read: 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":["go","htmx","routing","templ","urlfor"],"created_at":"2025-06-11T09:35:57.368Z","updated_at":"2026-05-18T21:12:17.646Z","avatar_url":"https://github.com/jackielii.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# structpages\n\n[![CI](https://github.com/jackielii/structpages/actions/workflows/ci.yml/badge.svg)](https://github.com/jackielii/structpages/actions/workflows/ci.yml)\n[![Go Reference](https://pkg.go.dev/badge/github.com/jackielii/structpages.svg)](https://pkg.go.dev/github.com/jackielii/structpages)\n[![codecov](https://codecov.io/gh/jackielii/structpages/branch/main/graph/badge.svg)](https://codecov.io/gh/jackielii/structpages)\n[![Go Report Card](https://goreportcard.com/badge/github.com/jackielii/structpages)](https://goreportcard.com/report/github.com/jackielii/structpages)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nStruct Pages provides a way to define routing using struct tags and methods. It integrates with Go's `http.ServeMux`, allowing you to quickly build web applications with minimal boilerplate.\n\n**Status**: **Alpha** - This package is in early development and may have breaking changes in the future. Currently used in a medium-sized project, but not yet battle-tested in production.\n\n## Features\n\n- 🏗️ **Struct-based routing** - Define routes using struct tags\n- 🎨 **Templ support** - Built-in integration with [Templ](https://templ.guide/)\n- ⚡ **HTMX-friendly** - Automatic partial rendering support\n- 🔧 **Middleware** - Standard Go middleware pattern\n- 🎯 **Type-safe URLs** - Generate URLs from struct references\n- 📦 **Dependency injection** - Pass dependencies to handlers via options\n\n## Installation\n\n```shell\ngo get github.com/jackielii/structpages\n```\n\n## Quick Start\n\nDefine your page structure using struct tags:\n\n```go\npackage main\n\nimport (\n    \"log\"\n    \"net/http\"\n    \"github.com/jackielii/structpages\"\n)\n\ntype index struct {\n    product `route:\"/product Product\"`\n    team    `route:\"/team Team\"`\n    contact `route:\"/contact Contact\"`\n}\n\n// Implement the Page method using Templ\ntempl (index) Page() {\n    \u003chtml\u003e\n        \u003cbody\u003e\n            \u003ch1\u003eWelcome\u003c/h1\u003e\n            \u003cnav\u003e\n                \u003ca href=\"/product\"\u003eProduct\u003c/a\u003e\n                \u003ca href=\"/team\"\u003eTeam\u003c/a\u003e\n                \u003ca href=\"/contact\"\u003eContact\u003c/a\u003e\n            \u003c/nav\u003e\n        \u003c/body\u003e\n    \u003c/html\u003e\n}\n\nfunc main() {\n    mux := http.NewServeMux()\n    _, err := structpages.Mount(mux, index{}, \"/\", \"Home\")\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    log.Println(\"Starting server on :8080\")\n    http.ListenAndServe(\":8080\", mux)\n}\n```\n\nRoute definitions use the format `[method] path [Title]`:\n\n- `/path` - All methods, no title\n- `POST /path` - POST requests only\n- `GET /path Page Title` - GET requests with title \"Page Title\"\n\n## Documentation\n\n- [API Reference](./docs/api.md) - Complete API documentation for Mount, options, and methods\n- [Routing Patterns](./docs/routing.md) - Route definitions, path parameters, nested routes\n- [Supported Request Flows](./docs/supported-flows.md) - How requests are dispatched to handlers and components\n- [Middleware](./docs/middleware.md) - Using middleware with your pages\n- [HTMX Integration](./docs/htmx.md) - Partial rendering and HTMX support\n- [URLFor \u0026 ID Generation](./docs/urlfor.md) - Type-safe URL and HTML id generation\n- [Templ Patterns](./docs/templ.md) - Working with Templ templates\n- [Advanced Features](./docs/advanced.md) - Dependency injection, Init, dynamic Refs, type aliases\n\n## Examples\n\nCheck out the [examples directory](./examples) for complete working applications:\n\n- [Simple](./examples/simple) - Basic routing and page rendering\n- [HTMX](./examples/htmx) - HTMX integration with partial updates\n- [HTMX RenderTarget](./examples/htmx-render-target) - Standalone-function components shared across pages, with per-component data loading via `RenderTarget`\n- [Todo](./examples/todo) - Full TODO app: form actions via `ServeHTTP` returning `RenderComponent(...)` to re-render a sibling component (in-memory store)\n\n## Contributing\n\nSee [CONTRIBUTING.md](./CONTRIBUTING.md) for development setup and guidelines.\n\n## License\n\nMIT License - see [LICENSE](./LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackielii%2Fstructpages","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjackielii%2Fstructpages","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackielii%2Fstructpages/lists"}