{"id":21696656,"url":"https://github.com/patrickcurl/gowired","last_synced_at":"2025-03-20T14:48:57.283Z","repository":{"id":57616009,"uuid":"383275649","full_name":"patrickcurl/gowired","owner":"patrickcurl","description":null,"archived":false,"fork":false,"pushed_at":"2021-07-06T01:01:54.000Z","size":1343,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-25T14:12:02.725Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/patrickcurl.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":null}},"created_at":"2021-07-05T22:11:30.000Z","updated_at":"2021-07-06T01:00:58.000Z","dependencies_parsed_at":"2022-08-27T07:30:46.400Z","dependency_job_id":null,"html_url":"https://github.com/patrickcurl/gowired","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickcurl%2Fgowired","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickcurl%2Fgowired/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickcurl%2Fgowired/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickcurl%2Fgowired/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patrickcurl","download_url":"https://codeload.github.com/patrickcurl/gowired/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244636527,"owners_count":20485442,"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","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":[],"created_at":"2024-11-25T19:21:08.543Z","updated_at":"2025-03-20T14:48:57.253Z","avatar_url":"https://github.com/patrickcurl.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GoWired\n\n## 💻 Reactive HTML Server Side Rendered by GoLang over WebSockets 🚀\n\nUse Go and ***Zero JavaScript*** to program reactive front-ends!\n\n![](examples/slider/slider.gif)\n\n## How?\n\n1. Render Server Side HTML\n2. Connect to same server using Websocket\n3. Send user events\n4. Change state of [component](component.go) in server\n5. Render Component and get [diff](diff.go)\n6. Update instructions are sent to the browser\n\n## Getting Started\n\n- [Extended Version Todo Example](https://github.com/SamHennessy/gowired-example)\n- [Project Examples](https://github.com/patrickcurl/gowired/tree/master/examples)\n- [GoBook - Interactive Go REPL in browser](https://github.com/brendonmatos/gobook)\n\n**Any suggestions are absolutely welcome**\n\nThis project it's strongly inspired by Elixir Phoenix LiveView.\n\n## Component Example\n\n```go\npackage components\n\nimport (\n \"github.com/patrickcurl/gowired\"\n \"time\"\n)\n\ntype Clock struct {\n gowired.WiredComponentWrapper\n ActualTime string\n}\n\nfunc NewClock() *gowired.WiredComponent {\n return gowired.NewWiredComponent(\"Clock\", \u0026Clock{})\n}\n\nfunc (t *Clock) Mounted(_ *gowired.WiredComponent) {\n go func() {\n  for {\n   t.ActualTime = time.Now().Format(time.RFC3339Nano)\n   time.Sleep((time.Second * 1) / 60)\n   t.Commit()\n  }\n }()\n}\n\nfunc (t *Clock) TemplateHandler(_ *gowired.WiredComponent) string {\n return `\n  \u003cdiv\u003e\n   \u003cspan\u003eTime: {{ .ActualTime }}\u003c/span\u003e\n  \u003c/div\u003e\n `\n}\n```\n\n### Server Example\n\n```go\n\npackage main\n\nimport (\n \"github.com/patrickcurl/gowired\"\n \"github.com/patrickcurl/gowired/examples/components\"\n \"github.com/gofiber/fiber/v2\"\n \"github.com/gofiber/websocket/v2\"\n)\n\nfunc main() {\n app := fiber.New()\n wiredServer := gowired.NewServer()\n\n app.Get(\"/\", wiredServer.CreateHTMLHandler(components.NewClock, gowired.PageContent{\n  Lang:  \"us\",\n  Title: \"Hello world\",\n }))\n\n app.Get(\"/ws\", websocket.New(wiredServer.HandleWSRequest))\n\n _ = app.Listen(\":3000\")\n}\n```\n\n### That's it\n\n![](examples/clock/demo.gif)\n\n## More Examples\n\n### Slider\n\n![](examples/slider/slider.gif)\n\n### Simple todo\n\n![](examples/todo/todo.gif)\n\n### All at once using components\n\n![](examples/all_at_once/all_at_once.gif)\n\n### GoBook\n\n![](examples/gobook.gif)\n\n[Go to repo](https://github.com/brendonmatos/gobook)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickcurl%2Fgowired","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatrickcurl%2Fgowired","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickcurl%2Fgowired/lists"}