{"id":21373265,"url":"https://github.com/instantan/magic","last_synced_at":"2025-03-16T09:13:16.237Z","repository":{"id":178735441,"uuid":"613459693","full_name":"Instantan/magic","owner":"Instantan","description":"Transform your web development with a touch of Magic","archived":false,"fork":false,"pushed_at":"2023-07-12T21:08:12.000Z","size":1180,"stargazers_count":2,"open_issues_count":4,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-01-22T21:16:00.388Z","etag":null,"topics":["liveview"],"latest_commit_sha":null,"homepage":"https://magic.instantan.io","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Instantan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2023-03-13T15:57:37.000Z","updated_at":"2024-01-17T12:39:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"e1a1b009-1da0-4301-ad85-8214fc15d2e8","html_url":"https://github.com/Instantan/magic","commit_stats":null,"previous_names":["instantan/magic"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Instantan%2Fmagic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Instantan%2Fmagic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Instantan%2Fmagic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Instantan%2Fmagic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Instantan","download_url":"https://codeload.github.com/Instantan/magic/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243847061,"owners_count":20357317,"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":["liveview"],"created_at":"2024-11-22T08:26:53.630Z","updated_at":"2025-03-16T09:13:16.211Z","avatar_url":"https://github.com/Instantan.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# magic\n\n\u003cimg height=\"120px\" align=\"right\" title=\"Magic logo\" src=\"docs/assets/images/magic-logo.svg\" /\u003e\n\nMagic is a Golang web framework that simplifies web development.\nWith under 12kb JavaScript, it's powerful yet easy to use for building\nefficient web applications.\n\n# Getting started\n\n\nFor a simple live counter example:\n\n\u003e main.go\n```go\npackage main\n\nfunc main() {\n    mux := http.NewServeMux()\n\tmux.Handle(\"/\", magic.ComponentHTTPHandler(home))\n\tlog.Print(\"Listening to http://localhost:8070\")\n\tif err := http.ListenAndServe(\":8070\", mux); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}\n```\n\n\u003e home.go\n```go\npackage main\n\nimport (\n\t\"time\"\n\n\t\"github.com/Instantan/magic\"\n)\n\nvar homeView = magic.View(`\n\t\u003c!DOCTYPE html\u003e\n\t\u003chtml\u003e\n\t\u003chead\u003e\n\t\t\u003ctitle\u003eTime\u003c/title\u003e\n\t\u003c/head\u003e\n\t\u003cbody\u003e\n\t\t\u003cp\u003e{{time}}\u003c/p\u003e\n\t\u003c/body\u003e\n\t\u003c/html\u003e\n`)\n\nvar home = magic.Component(func(s magic.Socket, e magic.Empty) magic.AppliedView {\n\tmagic.UseLiveRoutine(s, func(quit \u003c-chan struct{}) {\n\t\tt := time.NewTicker(time.Millisecond * 1000)\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase c := \u003c-t.C:\n\t\t\t\tmagic.Assign(s, \"time\", c.String())\n\t\t\tcase \u003c-quit:\n                t.Stop()\n                return\n\t\t\t}\n\t\t}\n\t})\n\treturn homeView(s)\n})\n\n```\n\n# Roadmap\n\n- Implement temporal data patches\n- Clean up socket.go, ref.go and view.go\n- Benchmarking, memory reduction and performance improvements\n- Unit tests\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finstantan%2Fmagic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finstantan%2Fmagic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finstantan%2Fmagic/lists"}