{"id":13582030,"url":"https://github.com/mat/besticon","last_synced_at":"2026-01-11T05:53:01.829Z","repository":{"id":26632395,"uuid":"30088118","full_name":"mat/besticon","owner":"mat","description":"Favicon service written in Go","archived":false,"fork":false,"pushed_at":"2025-04-05T11:16:40.000Z","size":9094,"stargazers_count":922,"open_issues_count":8,"forks_count":172,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-04-05T12:23:29.515Z","etag":null,"topics":["favicon","go","microservice","service"],"latest_commit_sha":null,"homepage":"https://besticon-demo.herokuapp.com","language":"Go","has_issues":false,"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/mat.png","metadata":{"files":{"readme":"Readme.markdown","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":["https://www.buymeacoffee.com/der.matthias","https://paypal.me/matthiasluedtke"]}},"created_at":"2015-01-30T19:50:12.000Z","updated_at":"2025-04-05T11:16:44.000Z","dependencies_parsed_at":"2022-07-12T16:08:37.604Z","dependency_job_id":"5ece8778-bd32-422c-bc97-1a8b23e4435b","html_url":"https://github.com/mat/besticon","commit_stats":{"total_commits":437,"total_committers":14,"mean_commits":"31.214285714285715","dds":0.5697940503432495,"last_synced_commit":"ee1fe52e97c1eecedaf3f6f79d0ed3cc75da8eac"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mat%2Fbesticon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mat%2Fbesticon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mat%2Fbesticon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mat%2Fbesticon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mat","download_url":"https://codeload.github.com/mat/besticon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247478083,"owners_count":20945256,"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":["favicon","go","microservice","service"],"created_at":"2024-08-01T15:02:23.704Z","updated_at":"2026-01-11T05:53:01.799Z","avatar_url":"https://github.com/mat.png","language":"Go","readme":"# favicon-service (besticon)\n\nThis is a favicon service:\n\n- Supports `favicon.ico` and `apple-touch-icon.png`\n- Simple URL API\n- Fallback icon generation\n- Docker image \u0026 single binary download for [easy hosting](#hosting)\n\nTry out the demo at \u003chttps://besticon-demo.herokuapp.com\u003e or find out how to [deploy your own version](#hosting) right now.\n\n[![Build Status](https://github.com/mat/besticon/actions/workflows/go.yml/badge.svg)](https://github.com/mat/besticon/actions/workflows/go.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/mat/besticon)](https://goreportcard.com/report/github.com/mat/besticon)\n[![Donate at PayPal](https://img.shields.io/badge/paypal-donate-orange.svg?style=flat)](https://paypal.me/matthiasluedtke 'Donate once-off to this project using Paypal')\n\n## What's this?\n\nWebsites used to have a `favicon.ico`, or not. With the introduction of the `apple-touch-icon.png` finding “the icon” for a website became more complicated. This service finds and — if necessary — generates icons for web sites.\n\n## API\n\n### GET /icon\n\nThis endpoint always returns an icon image for the given site — it redirects to an official icon if possible or creates and returns a fallback image if needed.\n\n| Parameter           | Example          | Description                                                                                                                                          | Default               |\n| ------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |\n| url                 | http://yelp.com  |                                                                                                                                                      | required              |\n| size                | 32..50..100      | Desired size range (min..perfect..max) If no image of size perfect..max nor perfect..min can be found a fallback icon will be generated.             | required              |\n| formats             | png,ico          | Comma-separated list of accepted image formats: png, ico, gif, jpg                                                                                   | `gif,ico,jpg,png,svg` |\n| fallback_icon_url   | _HTTP image URL_ | If provided, a redirect to this image will be returned in case no suitable icon could be found. This overrides the default fallback image behaviour. |                       |\n| fallback_icon_color | ff0000           | If provided, letter icons will be colored with the hex value provided, rather than be grey, when no color can be found for any icon.                 |                       |\n\n#### Examples\n\n| Input URL                                                                                                         | Icon                                                                                                                                           |\n| ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |\n| \u003chttps://besticon-demo.herokuapp.com/icon?url=yelp.com\u0026size=32..50..120\u003e                                          | ![Icon for yelp.com](https://besticon-demo.herokuapp.com/icon?url=yelp.com\u0026size=32..50..120)                                                   |\n| \u003chttps://besticon-demo.herokuapp.com/icon?url=yelp.com\u0026size=64..64..120\u003e                                          | ![Icon for yelp.com](https://besticon-demo.herokuapp.com/icon?url=yelp.com\u0026size=64..64..120)                                                   |\n| \u003chttps://besticon-demo.herokuapp.com/icon?url=yelp.com\u003e                                                           | size missing                                                                                                                                   |\n| \u003chttps://besticon-demo.herokuapp.com/icon?url=httpbin.org/status/404\u0026size=32..64..120\u003e                            | ![Icon for non-existent page](https://besticon-demo.herokuapp.com/icon?url=httpbin.org/status/404\u0026size=32..64..120)                            |\n| \u003chttps://besticon-demo.herokuapp.com/icon?url=httpbin.org/status/404\u0026size=32..64..120\u0026fallback_icon_color=ff0000\u003e | ![Icon for non-existent page](https://besticon-demo.herokuapp.com/icon?url=httpbin.org/status/404\u0026size=32..64..120\u0026fallback_icon_color=ff0000) |\n| \u003chttps://besticon-demo.herokuapp.com/icon?url=фминобрнауки.рф\u0026size=32..64..120\u003e                                   | ![Icon with cyrillic letter ф](https://besticon-demo.herokuapp.com/icon?url=фминобрнауки.рф\u0026size=32..64..120)                                  |\n\n### GET /allicons.json\n\nThis endpoint returns all icons for a given site.\n\n| Parameter | Example         | Description                                                        | Default           |\n| --------- | --------------- | ------------------------------------------------------------------ | ----------------- |\n| url       | http://yelp.com |                                                                    | required          |\n| formats   | png,ico         | Comma-separated list of accepted image formats: png, ico, gif, jpg | `png,ico,gif,jpg` |\n\n#### Examples\n\n- \u003chttps://besticon-demo.herokuapp.com/allicons.json?url=github.com\u003e\n- \u003chttps://besticon-demo.herokuapp.com/allicons.json?url=github.com\u0026formats=png\u003e\n\n## Bugs \u0026 limitations\n\nI tried hard to make this useful but please note there are some known limitations:\n\n- Poor i18n support for letter icons ([#13](https://github.com/mat/besticon/issues/13))\n\nFeel free to file other bugs - and offer your help - at \u003chttps://github.com/mat/besticon/issues\u003e.\n\n## Hosting\n\nSimple options to host this service are, for example:\n\n- Render: \u003chttps://render.com/deploy?repo=https://github.com/mat/besticon\u003e\n- Heroku: \u003chttps://heroku.com/deploy\u003e\n- Google Cloud Run: \u003chttps://deploy.cloud.run\u003e\n\n## Docker\n\nA docker image is available at \u003chttps://hub.docker.com/r/matthiasluedtke/iconserver/\u003e, generated from the [Dockerfile](https://github.com/mat/besticon/blob/master/Dockerfile) in this repo. I try to keep it updated for every release.\n\nNote that this docker image is not used to run \u003chttps://besticon-demo.herokuapp.com\u003e and therefore not well tested.\n\n## Monitoring\n\n[Prometheus](https://prometheus.io) metrics are exposed under [/metrics](https://besticon-demo.herokuapp.com/metrics). A Grafana dashboard config based on these metrics can be found in [grafana-dashboard.json](https://github.com/mat/besticon/blob/master/grafana-dashboard.json).\n\n## Server Executable\n\n### Download binaries\n\nBinaries for some operating systems can be downloaded from \u003chttps://github.com/mat/besticon/releases/latest\u003e\n\n### Build your own\n\nIf you have Go installed on your system you can use `go get` to fetch the source code and build the server:\n\n    $ go get -u github.com/mat/besticon/v3/...\n\nIf you want to build executables for a different target operating system you can add the `GOOS` and `GOARCH` environment variables:\n\n    $ GOOS=linux GOARCH=amd64 go get -u github.com/mat/besticon/v3/...\n\n### Running\n\nTo start the server on default port 8080 just do\n\n    $ iconserver\n\nTo use a different port use\n\n    $ PORT=80 iconserver\n\nTo listen on a different address (say localhost) use\n\n    $ ADDRESS=127.0.0.1 iconserver\n\nTo enable CORS headers you need to set `CORS_ENABLED=true`. Optionally, you can set [additional environment variables](https://github.com/mat/besticon#configuration) which will be passed as options to the [rs/cors middleware](https://github.com/rs/cors#parameters).\n\n    $ CORS_ENABLED=true iconserver\n\nNow when you open \u003chttp://localhost:8080/icons?url=instagram.com\u003e you should see something like\n![Screenshot of The Favicon Finder](https://github.com/mat/besticon/raw/master/the-icon-finder.png)\n\n## Configuration\n\nThere is not a lot to configure, but these environment variables exist\n\n| Variable                 | Description                                                                                                                                                                                | Default Value              |\n| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------- |\n| `ADDRESS`                | HTTP server listen address                                                                                                                                                                 | 0.0.0.0                    |\n| `CACHE_SIZE_MB`          | Size for the [groupcache](http://github.com/golang/groupcache), set to 0 to disable                                                                                                        | 32                         |\n| `CORS_ENABLED`           | Enables the [rs/cors](https://github.com/rs/cors) middleware                                                                                                                               | false                      |\n| `CORS_ALLOWED_HEADERS`   | Comma-separated, passed to middleware                                                                                                                                                      |                            |\n| `CORS_ALLOWED_METHODS`   | Comma-separated, passed to middleware                                                                                                                                                      |                            |\n| `CORS_ALLOWED_ORIGINS`   | Comma-separated, passed to middleware                                                                                                                                                      |                            |\n| `CORS_ALLOW_CREDENTIALS` | Boolean, passed to middleware                                                                                                                                                              |                            |\n| `CORS_DEBUG`             | Boolean, passed to middleware                                                                                                                                                              |                            |\n| `DISABLE_BROWSE_PAGES`   | Boolean, if true, the server will not serve any of the HTML pages                                                                                                                          | false                      |\n| `HOST_ONLY_DOMAINS`      |                                                                                                                                                                                            | \\*                         |\n| `HTTP_CLIENT_TIMEOUT`    | Timeout used for HTTP requests. Supports units like ms, s, m.                                                                                                                              | 5s                         |\n| `HTTP_MAX_AGE_DURATION`  | Cache duration for all dynamically generated HTTP responses. Supports units like ms, s, m.                                                                                                 | 720h _(30 days)_           |\n| `HTTP_USER_AGENT`        | User-Agent used for HTTP requests                                                                                                                                                          | _iPhone user agent string_ |\n| `METRICS_PATH`           | Path at which the Prometheus metrics are served. Set to `disable` to disable Prometheus metrics                                                                                            | `/metrics`                 |\n| `POPULAR_SITES`          | Comma-separated list of domains used on /popular page                                                                                                                                      | some random web sites      |\n| `PORT`                   | HTTP server port                                                                                                                                                                           | 8080                       |\n| `SERVER_MODE`            | Set to `download` to proxy downloads through besticon or `redirect` to let browser to download instead. (example at [#40](https://github.com/mat/besticon/pull/40#issuecomment-528325450)) | `redirect`                 |\n\n## Contributors\n\n- Erkie - https://github.com/erkie\n- mmkal - https://github.com/mmkal\n- kspearrin - https://github.com/kspearrin\n- karl-ravn - https://github.com/karl-ravn\n- korbenclario - https://github.com/korbenclario\n\n## License\n\nMIT License (MIT)\n\nCopyright (c) 2015-2023 Matthias Lüdtke, Hamburg - \u003chttps://github.com/mat\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n## Donate\n\nIf you find this useful and want to donate... you would make my day :-)\n\n[![Donate at PayPal](https://img.shields.io/badge/paypal-donate-orange.svg?style=flat)](https://paypal.me/matthiasluedtke 'Donate once-off to this project using Paypal')\n","funding_links":["https://www.buymeacoffee.com/der.matthias","https://paypal.me/matthiasluedtke"],"categories":["开源类库","Go","Open source library","service","工具"],"sub_categories":["图形处理","Graphics Processing","在线工具"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmat%2Fbesticon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmat%2Fbesticon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmat%2Fbesticon/lists"}