{"id":13826941,"url":"https://github.com/arturovm/min","last_synced_at":"2026-01-18T06:32:35.140Z","repository":{"id":57495024,"uuid":"82351946","full_name":"arturovm/min","owner":"arturovm","description":"A minimalistic web framework with route grouping and middleware chaining","archived":false,"fork":false,"pushed_at":"2024-09-24T20:45:55.000Z","size":69,"stargazers_count":93,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-14T02:59:19.198Z","etag":null,"topics":["framework","go","golang","http","middleware","rest","router","web"],"latest_commit_sha":null,"homepage":null,"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/arturovm.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,"publiccode":null,"codemeta":null}},"created_at":"2017-02-18T01:17:12.000Z","updated_at":"2025-04-16T08:29:42.000Z","dependencies_parsed_at":"2024-11-20T06:30:42.865Z","dependency_job_id":"b43b4734-4429-4c96-93fa-b06cff4c7e0c","html_url":"https://github.com/arturovm/min","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/arturovm/min","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arturovm%2Fmin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arturovm%2Fmin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arturovm%2Fmin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arturovm%2Fmin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arturovm","download_url":"https://codeload.github.com/arturovm/min/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arturovm%2Fmin/sbom","scorecard":{"id":209915,"data":{"date":"2025-08-11","repo":{"name":"github.com/arturovm/min","commit":"be1651551f34033971c106d487bf0a18269770a1"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T00:35:59.220Z","repository_id":57495024,"created_at":"2025-08-17T00:35:59.220Z","updated_at":"2025-08-17T00:35:59.220Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28531997,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","go","golang","http","middleware","rest","router","web"],"created_at":"2024-08-04T09:01:47.163Z","updated_at":"2026-01-18T06:32:35.123Z","avatar_url":"https://github.com/arturovm.png","language":"Go","readme":"# min\n\nv1.1.0\n\n[![GoDoc](https://godoc.org/github.com/arturovm/min?status.svg)](https://godoc.org/github.com/arturovm/min)\n[![Go Report Card](https://goreportcard.com/badge/github.com/arturovm/min)](https://goreportcard.com/report/github.com/arturovm/min)\n[![Build Status](https://travis-ci.com/arturovm/min.svg?branch=master)](https://travis-ci.com/arturovm/min)\n[![Codecov](https://img.shields.io/codecov/c/github/arturovm/min.svg)](https://codecov.io/gh/arturovm/min)\n![GitHub](https://img.shields.io/github/license/arturovm/min.svg)\n\n`min` is a BYO\\*, minimalistic web framework that builds on top of your router\nof choice and adds some additional functionality—namely, middleware chaining\nand route grouping. It's meant to be used on projects large and small that\nrequire flexibility, and varying degrees of custom code and architecture.\n\nThis version of `min` integrates some of the lessons I've learned recently. For\nthis release, I decided to focus on orthogonality and composability, and took a\n\"pure\" TDD approach to the API rewrite. The result is a much smaller library\nwith the same functionality, minus some unnecessary abstractions.\n\nThis package takes some inspiration from design decisions in\n[`chi`](https://github.com/pressly/chi) and\n[`gin`](https://github.com/gin-gonic/gin).\n\n## Usage\n\n### Hello World\n\nYou can initialize a new instance of the `Min` type with whichever type that\nimplements `min.Handler`. An adapter for\n[`httprouter`](https://github.com/julienschmidt/httprouter) is included.\n\n``` go\npackage main\n\nimport (\n    \"fmt\"\n    \"net/http\"\n\n    \"github.com/julienschmidt/httprouter\"\n\n    \"github.com/arturovm/min\"\n    \"github.com/arturovm/min/adapter\"\n)\n\nfunc main() {\n    a := \u0026adapter.Httprouter{Router: httprouter.New()}\n    m := min.New(a)\n\n    m.Get(\"/\", http.HandlerFunc(helloWorld))\n\n    http.ListenAndServe(\":8080\", m)\n}\n\nfunc helloWorld(w http.ResponseWriter, r *http.Request) {\n    fmt.Fprintln(w, \"hello world!\")\n}\n```\n\n### Route Parameters\n\n`min` supports all the syntax variations for defining route parameters that\nthe underlying router does. For instance, in the case of `httprouter`:\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"net/http\"\n\n    \"github.com/julienschmidt/httprouter\"\n\n    \"github.com/arturovm/min\"\n    \"github.com/arturovm/min/adapter\"\n)\n\nfunc main() {\n    a := \u0026adapter.Httprouter{Router: httprouter.New()}\n    m := min.New(a)\n\n    m.Get(\"/:name\", http.HandlerFunc(greet))\n\n    http.ListenAndServe(\":8080\", m)\n}\n\nfunc greet(w http.ResponseWriter, r *http.Request) {\n    name := httprouter.ParamsFromContext(r.Context()).ByName(\"name\")\n    fmt.Fprintf(w, \"hello %s!\", name)\n}\n```\n\n### Route Grouping\n\n``` go\npackage main\n\nimport (\n    \"fmt\"\n    \"net/http\"\n\n    \"github.com/julienschmidt/httprouter\"\n\n    \"github.com/arturovm/min\"\n    \"github.com/arturovm/min/adapter\"\n)\n\nfunc main() {\n    a := \u0026adapter.Httprouter{Router: httprouter.New()}\n    m := min.New(a)\n\n    apiRouter := m.NewGroup(\"/api\")\n    {\n        // GET /api\n        apiRouter.Get(\"/\", http.HandlerFunc(apiRoot))\n        // GET /api/ignacio\n        apiRouter.Get(\"/:name\", http.HandlerFunc(greet))\n    }\n\n    http.ListenAndServe(\":8080\", m)\n}\n\nfunc apiRoot(w http.ResponseWriter, r *http.Request) {\n    fmt.Fprintln(w, \"api root\")\n}\n\nfunc greet(w http.ResponseWriter, r *http.Request) {\n    name := httprouter.ParamsFromContext(r.Context()).ByName(\"name\")\n    fmt.Fprintf(w, \"hello %s!\", name)\n}\n```\n\n### Middleware\n\nMiddleware in `min` are simply functions that take an `http.Handler` (the one\nnext in the chain) and return another one. They are resolved in the order that\nthey are chained. You can chain them together with the `Middleware.Then`\nmethod.\n\nEntry middleware is executed from the start of the request and hands off to the\nhandler at the end of the chain. Exit middleware is executed from after the\nhandler has returned onwards. You are free to keep using the `Group.Use` API,\nwhich has become synonymous with `Group.Entry`.\n\n`min` users are meant to take advantage of `context` to make better use of\nmiddleware.\n\n``` go\npackage main\n\nimport (\n    \"context\"\n\t\"encoding/json\"\n    \"fmt\"\n    \"log\"\n    \"net/http\"\n\n    \"github.com/julienschmidt/httprouter\"\n\n    \"github.com/arturovm/min\"\n    \"github.com/arturovm/min/adapter\"\n)\n\ntype whiplashRequest struct {\n    Whip string `json:\"whip\"`\n    Lash string `json:\"lash\"`\n}\n\nfunc main() {\n    a := \u0026adapter.Httprouter{Router: httprouter.New()}\n    m := min.New(a)\n\n    chain := min.Middleware(logger).Then(printer)\n    m.Use(chain)\n\n    apiRouter := m.NewGroup(\"/api\")\n    {\n        apiRouter.Get(\"/\", http.HandlerFunc(apiRoot))\n        nameRouter := apiRouter.NewGroup(\"/:name\")\n        {\n            // Every request sent to routes defined on this sub-router will now\n            // have a reference to a name in its context.\n            // Useful for RESTful design.\n            nameRouter.Use(nameExtractor)\n\n            // GET /api/ignacio\n            nameRouter.Get(\"/\", http.HandlerFunc(greet))\n            // GET /api/ignacio/goodbye\n            nameRouter.Get(\"/goodbye\", http.HandlerFunc(goodbye))\n\t\t\t\n\t\t\twhiplashRouter := nameRouter.NewGroup(\"/whiplash\")\n\t\t\t{\n\t\t\t    // We can take advantage of generics and deserialize JSON data\n\t\t\t\t// on every reqest sent to this sub-router.\n                whiplashRouter.Entry(deserializer[whiplashRequest])\n                whiplashRouter.Post(\"/\", http.HandlerFunc(createWhiplash))\n            }\n        }\n    }\n\n    http.ListenAndServe(\":8080\", m)\n}\n\n// -- Middleware --\n\n// a simple logger\nfunc logger(next http.Handler) http.Handler {\n    return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n        log.Printf(\"| %s %s\", r.Method, r.URL)\n        next.ServeHTTP(w, r)\n    })\n}\n\n// a useless middleware that prints text\nfunc printer(next http.Handler) http.Handler {\n    return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n        log.Println(\"this prints some text\")\n        next.ServeHTTP(w, r)\n    })\n}\n\n// extracts a name from the URL and injects it into the request's context\nfunc nameExtractor(next http.Handler) http.Handler {\n    return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n        name := httprouter.ParamsFromContext(r.Context()).ByName(\"name\")\n        ctx := context.WithValue(r.Context(), \"name\", name)\n        next.ServeHTTP(w, r.WithContext(ctx))\n    })\n}\n\nfunc deserializer[T any](next http.Handler) http.Handler {\n    return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n        var dst T\n        err := json.NewDecoder(r.Body).Decode(\u0026dst)\n        if err != nil {\n            w.WriteHeader(http.StatusBadRequest)\n            return\n        }\n\n        ctx := context.WithValue(r.Context(), \"data\", dst)\n        next.ServeHTTP(w, r.WithContext(ctx))\n\n    })\n}\n\n// -- Handlers --\n\nfunc apiRoot(w http.ResponseWriter, r *http.Request) {\n    fmt.Fprintln(w, \"api root\")\n}\n\n// greets the user with :name\nfunc greet(w http.ResponseWriter, r *http.Request) {\n    name := r.Context().Value(\"name\").(string)\n    fmt.Fprintf(w, \"hello %s!\", name)\n}\n\n// says \"bye\" to the user with :name\nfunc goodbye(w http.ResponseWriter, r *http.Request) {\n    name := r.Context().Value(\"name\").(string)\n    fmt.Fprintf(w, \"bye %s!\", name)\n}\n\n// creates a whiplash thingamabob\nfunc createWhiplash(w http.ResponseWriter, r *http.Request) {\n    data := r.Context().Value(\"data\").(whiplashRequest)\n    fmt.Fprintf(w, \"whip: %s, lash: %s\", data.Whip, data.Lash)\n}\n```\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farturovm%2Fmin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farturovm%2Fmin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farturovm%2Fmin/lists"}