sup has modules for http4s, http4s-client and circe:

libraryDependencies ++= Seq(
  "com.kubukoz" %% "sup-http4s" % "0.7.0",
  "com.kubukoz" %% "sup-http4s-client" % "0.7.0",
  "com.kubukoz" %% "sup-circe" % "0.7.0"
)

Imports:

import sup._
import sup.modules.http4s._, sup.modules.http4sclient._, sup.modules.circe._

What’s included

statusCodeHealthCheck, healthCheckRoutes, Encoder/Decoder

In the http4s module, you get a router for (almost) free. You just need some instances, a healthcheck and an EntityEncoder[F, HealthResult[H]].

The circe module provides circe Encoder/Decoder instances for all the important bits, so you can use them together with http4s-circe and bundle the whole thing up:

import io.circe._, org.http4s.circe.CirceEntityCodec._, org.http4s._, org.http4s.implicits._, org.http4s.client._
import cats.effect._, cats._, cats.data._, sup.data._

implicit val client: Client[IO] = Client.fromHttpApp(HttpApp.notFound[IO])
// client: Client[IO] = org.http4s.client.Client$$anon$1@4e730614
 
val healthcheck: HealthCheck[IO, Id] = statusCodeHealthCheck(Request[IO]())
// healthcheck: HealthCheck[IO, Id] = sup.HealthCheck$$anon$1@1f49b89

val routes = healthCheckRoutes(healthcheck)
// routes: HttpRoutes[IO] = Kleisli(
//   org.http4s.HttpRoutes$$$Lambda$8810/0x0000000102731040@38a2de2e
// )

//also works with reports!

val report = HealthReporter.fromChecks(
  healthcheck.through(mods.tagWith("foo")),
  HealthCheck.const[IO, Id](Health.Healthy).through(mods.tagWith("bar"))
)
// report: HealthReporter[IO, NonEmptyList, Tagged[String, H]] = sup.HealthCheck$$anon$1@28a00efd

val reportRoutes = healthCheckRoutes(report)
// reportRoutes: HttpRoutes[IO] = Kleisli(
//   org.http4s.HttpRoutes$$$Lambda$8810/0x0000000102731040@7203f5f2
// )

val responseBody = reportRoutes.orNotFound.run(Request(uri = Uri.uri("/health-check"))).flatMap(_.bodyAsText.compile.string)
// responseBody: IO[String] = Bind(
//   Map(
//     Suspend(org.http4s.HttpRoutes$$$Lambda$8814/0x0000000102735840@38bd6acf),
//     cats.data.OptionT$$Lambda$8816/0x0000000102734840@10c25cc3,
//     0
//   ),
//   <function1>
// )
println(responseBody.unsafeRunSync())
// {"health":"Sick","checks":[{"tag":"foo","health":"Sick"},{"tag":"bar","health":"Healthy"}]}

remoteHealthCheck

There’s a way to build a healthcheck out of a request to a remote one:

val remoteCheck = remoteHealthCheck[IO, Id](Request())
// remoteCheck: HealthCheck[IO, Id] = sup.HealthCheck$$anon$1@7d03874c