{"id":13508095,"url":"https://github.com/ggpasqualino/plug_checkup","last_synced_at":"2026-02-22T10:34:55.617Z","repository":{"id":48468086,"uuid":"112725265","full_name":"ggpasqualino/plug_checkup","owner":"ggpasqualino","description":"PlugCheckup provides a Plug for adding simple health checks to your app","archived":false,"fork":false,"pushed_at":"2021-07-24T12:17:27.000Z","size":127,"stargazers_count":73,"open_issues_count":12,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-26T23:41:01.854Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/ggpasqualino.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}},"created_at":"2017-12-01T10:07:59.000Z","updated_at":"2024-11-25T20:11:27.000Z","dependencies_parsed_at":"2022-09-05T06:40:57.294Z","dependency_job_id":null,"html_url":"https://github.com/ggpasqualino/plug_checkup","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ggpasqualino%2Fplug_checkup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ggpasqualino%2Fplug_checkup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ggpasqualino%2Fplug_checkup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ggpasqualino%2Fplug_checkup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ggpasqualino","download_url":"https://codeload.github.com/ggpasqualino/plug_checkup/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246301963,"owners_count":20755512,"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":[],"created_at":"2024-08-01T02:00:47.903Z","updated_at":"2025-10-21T16:02:35.658Z","avatar_url":"https://github.com/ggpasqualino.png","language":"Elixir","funding_links":[],"categories":["Framework Components"],"sub_categories":[],"readme":"[![Build](https://github.com/ggpasqualino/plug_checkup/workflows/Build/badge.svg?branch=master)](https://github.com/ggpasqualino/plug_checkup/actions?query=branch%3Amaster)\n[![Coverage Status](https://coveralls.io/repos/github/ggpasqualino/plug_checkup/badge.svg?branch=master)](https://coveralls.io/github/ggpasqualino/plug_checkup?branch=master)\n||\n[![Hex version](https://img.shields.io/hexpm/v/plug_checkup.svg)](https://hex.pm/packages/plug_checkup)\n[![Hex downloads](https://img.shields.io/hexpm/dt/plug_checkup.svg)](https://hex.pm/packages/plug_checkup)\n\n# PlugCheckup\n\nPlugCheckup provides a Plug for adding simple health checks to your app. The [JSON output](#response) is similar to the one provided by the [MiniCheck](https://github.com/workshare/mini-check) Ruby library. It was started to provide [solarisBank](https://www.solarisbank.de/en/) an easy way of monitoring Plug based applications.\n\n## Usage\n\n- Add the package to \"mix.exs\"\n```elixir\ndefp deps do\n  [\n    {:plug_checkup, \"~\u003e 0.3.0\"}\n  ]\nend\n```\n\n- Create your [checks](#the-checks)\n```elixir\ndefmodule MyHealthChecks do\n  def check_db do\n    :ok\n  end\n\n  def check_redis do\n    :ok\n  end\nend\n```\n\n- Forward your health path to PlugCheckup in your Plug Router\n```elixir\nchecks = [\n  %PlugCheckup.Check{name: \"DB\", module: MyHealthChecks, function: :check_db},\n  %PlugCheckup.Check{name: \"Redis\", module: MyHealthChecks, function: :check_redis}\n]\n\nforward(\n  \"/health\",\n  to: PlugCheckup,\n  init_opts: PlugCheckup.Options.new(json_encoder: Jason, checks: checks)\n)\n```\n\nIf you're working with Phoenix, you need to change the syntax slightly to\naccomodate `Phoenix.Router.forward/4`:\n\n```elixir\nchecks = [\n  %PlugCheckup.Check{name: \"DB\", module: MyHealthChecks, function: :check_db},\n  %PlugCheckup.Check{name: \"Redis\", module: MyHealthChecks, function: :check_redis}\n]\n\nforward(\"/health\", PlugCheckup, PlugCheckup.Options.new(json_encoder: Jason, checks: checks))\n```\n\n## The Checks\nA check is a function with arity zero, which should return either :ok or {:error, term}. In case the check raises an exception or times out, that will be mapped to an {:error, reason} result.\n\n## Response\n\nPlugCheckup should return either 200 or 500 statuses, Content-Type header \"application/json\", and the body should respect [this](priv/schemas/health_check_response.json) JSON schema\n\nIf you configure the `error_code` option when initializing the plug, the specified value will be used when an error occurs instead of the 500 status.\n\n## Demo\n\nCheck [.iex.exs](.iex.exs) for a demo of plug_checkup in a Plug.Router. The demo can be run as following.\n```sh\ngit clone https://github.com/ggpasqualino/plug_checkup\ncd plug_checkup\nmix deps.get\niex -S mix\n```\nOpen your browse either on http://localhost:4000/selfhealth or http://localhost:4000/dependencyhealth\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fggpasqualino%2Fplug_checkup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fggpasqualino%2Fplug_checkup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fggpasqualino%2Fplug_checkup/lists"}