{"id":37201812,"url":"https://github.com/ynori7/lilypad","last_synced_at":"2026-01-14T23:16:28.262Z","repository":{"id":125457201,"uuid":"268448935","full_name":"ynori7/lilypad","owner":"ynori7","description":"A lightweight web application framework in Go","archived":false,"fork":false,"pushed_at":"2024-03-06T13:18:18.000Z","size":69,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-03-06T14:35:21.885Z","etag":null,"topics":["framework","golang","webapp"],"latest_commit_sha":null,"homepage":"","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/ynori7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2020-06-01T07:03:03.000Z","updated_at":"2024-03-06T14:35:23.494Z","dependencies_parsed_at":"2024-03-06T14:45:32.197Z","dependency_job_id":null,"html_url":"https://github.com/ynori7/lilypad","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/ynori7/lilypad","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ynori7%2Flilypad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ynori7%2Flilypad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ynori7%2Flilypad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ynori7%2Flilypad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ynori7","download_url":"https://codeload.github.com/ynori7/lilypad/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ynori7%2Flilypad/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28437953,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T22:37:52.437Z","status":"ssl_error","status_checked_at":"2026-01-14T22:37:31.496Z","response_time":107,"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":["framework","golang","webapp"],"created_at":"2026-01-14T23:16:27.626Z","updated_at":"2026-01-14T23:16:28.201Z","avatar_url":"https://github.com/ynori7.png","language":"Go","readme":"# Lilypad [![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go\u0026logoColor=white\u0026style=flat-square)](https://pkg.go.dev/github.com/ynori7/lilypad) [![Build Status](https://travis-ci.org/ynori7/lilypad.svg?branch=master)](https://travis-ci.com/github/ynori7/lilypad) [![Coverage Status](https://coveralls.io/repos/github/ynori7/lilypad/badge.svg?branch=master)](https://coveralls.io/github/ynori7/lilypad?branch=master) [![Go Report Card](https://goreportcard.com/badge/ynori7/lilypad)](https://goreportcard.com/report/github.com/ynori7/lilypad)\nA lightweight web application framework in Go.\n\n## Features\nHere is a brief overview of the feature set provided by the Lilypad framework.\nA detailed example can be found in [examples](/examples).\n\n### Routing\nThe Lilypad framework provides a simple wrapper around the Gorilla mux router. This\nallows you to use Lilypad's handlers to simplfy response writing and error handling.\n\nThe framework keeps a global router which allows you to register routes close to the\nhandlers which control them without having to pass a router around everywhere.\n\nTo add a route, simply register it like this:\n\n```go\nimport \"github.com/ynori7/lilypad/http\"\n\n...\n\nhttp.RegisterRoutes(http.Route{\n    Path:    \"/hello/{name}\",\n    Handler: Hello,\n})\n```\n\nRegisterRoutes is variardic, so it's possible to register multiple routes at once:\n\n```go\nhttp.RegisterRoutes([]http.Route{\n    {\n        Path:    \"/hello/{name}\",\n        Handler: Hello,\n    },\n    {\n        Path:    \"/goodbye/{name}\",\n        Handler: Goodbye,\n    },\n}...)\n```\n\n### Handlers\nLilypad's handler definition makes it easier to build your http handlers. You no longer\nneed to care about writing responses for ever place where the method exists. You simply\nreturn either a `SuccessResponse` or an `ErrorResponse`.\n\nFor example:\n\n```go\nimport (\n\t\"github.com/ynori7/lilypad/http\"\n)\n\nfunc Hello(r http.Request) http.Response {\n    name := http.GetVar(r, \"name\")\n\n    if !isValidName(name) {\n        return http.ErrorResponse(errors.BadRequestError(\"Names should be non-empty and contain only letters\"))\n    }\n\n    ...\n\n    return SuccessResponse(resp)\n```\n\nIt's also possible to return a `RedirectResponse` to redirect to another page.\n\nYou can also specify the cache duration like this:\n\n```go\nreturn SuccessResponse(resp).WithMaxAge(300)\n```\n\nOr any other arbitrary headers using the `WithHeaders()` method.\n\n### Errors\nThe errors package provides a definition for HttpErros as well as convenient wrappers\nfor getting some of the most common error types.\n\nOne key attribute of the errors package is the HttpError's `Write()` method. This\nmethod will present the error in a useful format depending on the configuration. In your\nmain.go, you can set errors to be presented in a JSON format, HTML format, or plaintext format.\n\n```go\nerrors.UseMarkupErrors(errorHtmlTemplate)\n//or\nerrors.UseJsonErrors()\n//or\nerrors.UsePlaintextErrors() //the default\n```\n\n### Logging\nThe log package wraps the Sirupsen Logrus library and adds a few useful additions such as\nthe `WithRequest` method which returns a logger with some fields populated from the HTTP\nrequest such as the client's IP address.\n\n### Templating\nThe view package provides a minimalistic method to `RenderTemplate` which accepts a template \nbody as a string and the data used to render it.\n\nAlternatively, you can use nested templates by registering your base layouts like this:\n\n```go\nview.SetLayoutDirectory(\"path/to/layouts\")\n```\n\nThis will configure the framework to load all files with the gohtml extension. Next you can \nrender a view like this:\n\n```go\nout, err := view.New(\"layoutName\", \"templates/specificTemplate.gohtml\").Render(myData)\n```\n\nHere is an example layout.gohtml:\n```gotemplate\n{{ define \"layoutName\" }}\n\u003chtml\u003e\n\u003cbody\u003e\n{{ template \"body\" . }}\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\nAnd an example specificTemplate.gohtml:\n```gotemplate\n{{ define \"body\" }}\n\u003ch1\u003eMy Page!\u003c/h1\u003e\n\u003carticle\u003eblahblah\u003c/article\u003e\n{{ end }}\n```\n\nIt also has a global register of template functions which can be easily registered like this:\n\n```go\nview.RegisterGlobalTemplateFuncs(template.FuncMap{\n    \"UppercaseFirstLetter\": func(s string) string {\n        return strings.Title(strings.ToLower(s))\n    },\n})\n```\n\nAnd from any template, the function can be used like this:\n\n```gotemplate\n{{ UppercaseFirstLetter .Str }}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fynori7%2Flilypad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fynori7%2Flilypad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fynori7%2Flilypad/lists"}