{"id":13786706,"url":"https://github.com/gotuna/gotuna","last_synced_at":"2025-05-11T22:33:13.328Z","repository":{"id":52539761,"uuid":"355932498","full_name":"gotuna/gotuna","owner":"gotuna","description":"GoTuna a lightweight web framework for Go with mux router, middlewares, user sessions, templates, embedded views, and static file server.","archived":false,"fork":false,"pushed_at":"2023-08-31T09:50:12.000Z","size":268,"stargazers_count":48,"open_issues_count":1,"forks_count":22,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-08-03T19:10:03.162Z","etag":null,"topics":["framework","go","golang","router","web","webapp"],"latest_commit_sha":null,"homepage":"https://gotuna.netlify.app","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gotuna.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-04-08T14:08:08.000Z","updated_at":"2024-06-29T00:40:31.000Z","dependencies_parsed_at":"2024-01-08T16:08:43.425Z","dependency_job_id":"da7b42c6-2a88-4522-888e-f4486fab8a62","html_url":"https://github.com/gotuna/gotuna","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gotuna%2Fgotuna","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gotuna%2Fgotuna/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gotuna%2Fgotuna/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gotuna%2Fgotuna/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gotuna","download_url":"https://codeload.github.com/gotuna/gotuna/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225105767,"owners_count":17421791,"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":["framework","go","golang","router","web","webapp"],"created_at":"2024-08-03T19:01:29.647Z","updated_at":"2025-05-11T22:33:13.317Z","avatar_url":"https://github.com/gotuna.png","language":"Go","readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://avatars.githubusercontent.com/u/82163094?s=200\u0026v=4\"\u003e\n\u003c/p\u003e\n\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://pkg.go.dev/github.com/gotuna/gotuna\"\u003e\u003cimg src=\"https://pkg.go.dev/badge/github.com/gotuna/gotuna\" alt=\"PkgGoDev\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/gotuna/gotuna/actions\"\u003e\u003cimg src=\"https://github.com/gotuna/gotuna/workflows/tests/badge.svg\" alt=\"rests status\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://goreportcard.com/report/github.com/gotuna/gotuna\"\u003e\u003cimg src=\"https://goreportcard.com/badge/github.com/gotuna/gotuna\" alt=\"Go Report Card\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://codecov.io/gh/gotuna/gotuna\"\u003e\u003cimg src=\"https://codecov.io/gh/gotuna/gotuna/branch/main/graph/badge.svg?token=QG7CG4MSPC\" alt=\"Go Report Card\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n# GoTuna - Web framework for Go\nGoTuna is a lightweight web framework for Go with mux router, middlewares, user sessions, templates, embedded views, and static file server.\n\nPlease visit [https://gotuna.netlify.app](https://gotuna.netlify.app) for the latest documentation, examples, and more.\n\n\n# Features\n- Router (gorilla)\n- Standard `http.Handler` interface\n- Middleware support\n- User session management (gorilla)\n- Session flash messages\n- Native view rendering (html/template) with helpers\n- Static file server included with the configurable prefix\n- Standard logger interface\n- Request logging and panic recovery\n- Full support for embedded templates and static files\n- User authentication (via user provider interface)\n- Sample InMemory user provider included\n- Multi-language support\n- Database agnostic\n\n# Requirements\n- Make sure you have Go \u003e= 1.23 installed\n\n# Quick Start\nInitialize new app and install GoTuna:\n\n```shell\nmkdir testapp\ncd testapp\ngo mod init testapp\ngo get -u github.com/gotuna/gotuna\n```\n\nNow create two files `main.go` and `app.html` as an example:\n\n```go\n// main.go\n\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\n\t\"github.com/gotuna/gotuna\"\n)\n\nfunc main() {\n\tapp := gotuna.App{\n\t\tViewFiles: os.DirFS(\".\"),\n\t\tRouter:    gotuna.NewMuxRouter(),\n\t}\n\t\n\tapp.Router.Handle(\"/\", handlerHome(app))\n\tapp.Router.Handle(\"/login\", handlerLogin(app)).Methods(http.MethodGet, http.MethodPost)\n\n\tfmt.Println(\"Running on http://localhost:8888\")\n\thttp.ListenAndServe(\":8888\", app.Router)\n}\n\nfunc handlerHome(app gotuna.App) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tapp.NewTemplatingEngine().\n\t\t\tRender(w, r, \"app.html\")\n\t})\n}\n\nfunc handlerLogin(app gotuna.App) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Fprintf(w, \"Login form...\")\n\t})\n}\n```\n\nThis will be your app's html layout:\n\n```html\n// app.html\n\n{{- define \"app\" -}}\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n  \u003chead\u003e\u003c/head\u003e\n  \u003cbody\u003e\n    \u003ca href=\"/login\"\u003ePlease login!\u003c/a\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n{{- end -}}\n```\n\nRun this simple app and visit http://localhost:8888 in your browser:\n```shell\ngo run main.go\n```\n\n\n# Running example apps\nGoTuna comes with an example app. Make sure you have git and Go \u003e= 1.23 installed.\n```shell\ngit clone https://github.com/gotuna/gotuna.git\ncd gotuna\ngo run examples/fullapp/cmd/main.go\n```\n\n# Testing\n\n```shell\ngo test -race -v ./...\n```\n\n# Licence\nThis project is licensed under the MIT License.\n","funding_links":[],"categories":["Web Frameworks","Web框架","Utility"],"sub_categories":["Utility/Miscellaneous","实用程序/Miscellaneous","Fail injection","HTTP Clients"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgotuna%2Fgotuna","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgotuna%2Fgotuna","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgotuna%2Fgotuna/lists"}