{"id":13601312,"url":"https://github.com/elliotforbes/go-webassembly-framework","last_synced_at":"2026-01-23T23:23:23.609Z","repository":{"id":56245743,"uuid":"154977931","full_name":"elliotforbes/go-webassembly-framework","owner":"elliotforbes","description":"A Go Based WebAssembly framework for building frontend applications in Go!","archived":false,"fork":false,"pushed_at":"2023-02-25T02:02:08.000Z","size":5066,"stargazers_count":397,"open_issues_count":4,"forks_count":34,"subscribers_count":24,"default_branch":"master","last_synced_at":"2024-08-02T18:40:19.954Z","etag":null,"topics":["frontend-framework","go","golang","webassembly"],"latest_commit_sha":null,"homepage":"","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/elliotforbes.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}},"created_at":"2018-10-27T15:13:16.000Z","updated_at":"2024-03-05T21:49:14.000Z","dependencies_parsed_at":"2024-01-14T04:53:45.147Z","dependency_job_id":"d9a3a6db-1a95-4031-b454-3575bee486b6","html_url":"https://github.com/elliotforbes/go-webassembly-framework","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elliotforbes%2Fgo-webassembly-framework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elliotforbes%2Fgo-webassembly-framework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elliotforbes%2Fgo-webassembly-framework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elliotforbes%2Fgo-webassembly-framework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elliotforbes","download_url":"https://codeload.github.com/elliotforbes/go-webassembly-framework/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223458231,"owners_count":17148436,"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":["frontend-framework","go","golang","webassembly"],"created_at":"2024-08-01T18:01:00.309Z","updated_at":"2026-01-23T23:23:23.557Z","avatar_url":"https://github.com/elliotforbes.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"Oak - The Go WebAssembly Framework\n===================================\n\n[![Godoc Reference](https://camo.githubusercontent.com/6321d9723db4c8f80466aaa83c19d4afb9fdd208/68747470733a2f2f676f646f632e6f72672f6769746875622e636f6d2f6f616b6d6f756e642f6f616b3f7374617475732e737667)](https://godoc.org/github.com/elliotforbes/go-webassembly-framework)  [![Travis Build Status](https://api.travis-ci.org/elliotforbes/oak.svg?branch=master)](https://travis-ci.org/elliotforbes/go-webassembly-framework)  [![Go Report Card](https://goreportcard.com/badge/github.com/elliotforbes/oak)](https://goreportcard.com/report/github.com/elliotforbes/go-webassembly-framework)\n\n\n\u003cimg alt=\"Oak Framework\" width=\"100px\" height=\"100px\" src=\"logo.jpg\" /\u003e \n\nWith the advent of Go supporting WebAssembly, I thought I'd take a crack at building a really simple Go based WebAssembly framework that allows you to build simple frontend applications in Go, without having to dive too deep into the bushes.\n\n---\n\n## Goals\n\n* Easier frontend application development using Go\n\n## Tutorial\n\nA tutorial describing Oak is avaiable here: \nhttps://tutorialedge.net/golang/writing-frontend-web-framework-webassembly-go/\n\n## CLI\n\nIf you want to easily run the example in this project, I suggest you try out the new `Oak CLI` which attempts to simplify the task of writing WebAssembly applications in Go.\n\n```s\n$ make build-cli\n$ cd examples/blog\n$ ./oak start\nStarting Server\n2019/01/06 12:00:37 listening on \":8080\"...\n```\n\n## Simple Example\n\nLet's take a look at how this framework could be used in a very simple example. We'll be create a really simple app that features on function, `mycoolfunc()`. We'll kick off our Oak framework within our `main()` function and then we'll register our `coolfunc()` function.\n\n```go\npackage main\n\nimport (\n\t\"syscall/js\"\n\n\t\"github.com/elliotforbes/oak\"\n)\n\nfunc mycoolfunc(i []js.Value) {\n\tprintln(\"My Awesome Function\")\n}\n\nfunc main() {\n\toak.Start()\n\toak.RegisterFunction(\"coolfunc\", mycoolfunc)\n\t// keeps our app running\n\tdone := make(chan struct{}, 0)\n\t\u003c-done\n}\n```\n\nWe can then call our `coolfunc()` function from our `index.html` like so: \n\n```html\n\u003c!doctype html\u003e\n\u003chtml\u003e\n\n\u003chead\u003e\n\t\u003cmeta charset=\"utf-8\"\u003e\n\t\u003ctitle\u003eGo wasm\u003c/title\u003e\n\t\u003cscript src=\"./static/wasm_exec.js\"\u003e\u003c/script\u003e\n\t\u003cscript src=\"./static/entrypoint.js\"\u003e\u003c/script\u003e\n\u003c/head\u003e\n\u003cbody\u003e\t\n    \u003ch2\u003eSuper Simple Example\u003c/h2\u003e\n    \u003cbutton class=\"btn btn-primary btn-block\" onClick=\"coolfunc();\" id=\"subtractButton\"\u003eMy Cool Func\u003c/button\u003e\n\u003c/body\u003e\n\n\u003c/html\u003e\n```\n\n## Components \n\n```go\npackage components\n\nimport (\n\t\"syscall/js\"\n\n\t\"github.com/elliotforbes/oak\"\n)\n\ntype AboutComponent struct{}\n\nvar About AboutComponent\n\nfunc init() {\n\toak.RegisterFunction(\"coolFunc\", CoolFunc)\n}\n\nfunc CoolFunc(i []js.Value) {\n\tprintln(\"does stuff\")\n}\n\nfunc (a AboutComponent) Render() string {\n\treturn `\u003cdiv\u003e\n\t\t\t\t\t\t\u003ch2\u003eAbout Component Actually Works\u003c/h2\u003e\n\t\t\t\t\t\t\u003cbutton onClick=\"coolFunc();\"\u003eCool Func\u003c/button\u003e\n\t\t\t\t\t\u003c/div\u003e`\n}\n```\n\n## Routing\n\n```go\npackage main\n\nimport (\n\t\"github.com/elliotforbes/oak\"\n\t\"github.com/elliotforbes/oak/router\"\n\n\t\"github.com/elliotforbes/oak/examples/blog/components\"\n)\n\nfunc main() {\n\t// Starts the Oak framework\n\toak.Start()\n\n\t// Starts our Router\n\trouter.NewRouter()\n\trouter.RegisterRoute(\"about\", aboutComponent)\n\n\t// keeps our app running\n\tdone := make(chan struct{}, 0)\n\t\u003c-done\n}\n```\n\n```html\n\u003c!doctype html\u003e\n\u003chtml\u003e\n\n\u003chead\u003e\n\t\u003cmeta charset=\"utf-8\"\u003e\n\t\u003ctitle\u003eBlog\u003c/title\u003e\n\t\u003clink rel=\"stylesheet\" href=\"./static/bootstrap.css\"\u003e\n\t\u003clink rel=\"stylesheet\" href=\"./static/style.css\"\u003e\n\t\u003cscript src=\"./static/wasm_exec.js\"\u003e\u003c/script\u003e\n\t\u003cscript src=\"./static/entrypoint.js\"\u003e\u003c/script\u003e\n\u003c/head\u003e\n\u003cbody\u003e\t\n\n  \u003cdiv class=\"container\"\u003e\n    \u003ch1\u003eA Simple Blog\u003c/h1\u003e\n\n    \u003cdiv id=\"view\"\u003e\u003c/div\u003e\n\n    \u003cbutton onClick=\"Link('home')\"\u003eHome\u003c/button\u003e\n    \u003cbutton onClick=\"Link('about')\"\u003eAbout\u003c/button\u003e\n\n  \u003c/div\u003e\n\u003c/body\u003e\n\n\u003c/html\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felliotforbes%2Fgo-webassembly-framework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felliotforbes%2Fgo-webassembly-framework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felliotforbes%2Fgo-webassembly-framework/lists"}