{"id":13682805,"url":"https://github.com/jaspervz/todo-http4s-doobie","last_synced_at":"2026-01-28T03:33:36.184Z","repository":{"id":50201905,"uuid":"115415031","full_name":"jaspervz/todo-http4s-doobie","owner":"jaspervz","description":"A sample project of a microservice using http4s, doobie, and circe.","archived":false,"fork":false,"pushed_at":"2024-12-27T16:05:32.000Z","size":49,"stargazers_count":186,"open_issues_count":0,"forks_count":44,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-30T09:51:36.996Z","etag":null,"topics":["circe","doobie","fs2","h2-database","http4s","pureconfig","scala"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jaspervz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2017-12-26T11:09:46.000Z","updated_at":"2025-01-30T17:37:08.000Z","dependencies_parsed_at":"2024-01-14T16:07:30.855Z","dependency_job_id":"d4d77cfe-4485-4e28-8c40-6fbde84c9ae2","html_url":"https://github.com/jaspervz/todo-http4s-doobie","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jaspervz/todo-http4s-doobie","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaspervz%2Ftodo-http4s-doobie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaspervz%2Ftodo-http4s-doobie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaspervz%2Ftodo-http4s-doobie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaspervz%2Ftodo-http4s-doobie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaspervz","download_url":"https://codeload.github.com/jaspervz/todo-http4s-doobie/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaspervz%2Ftodo-http4s-doobie/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28836694,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T02:10:51.810Z","status":"ssl_error","status_checked_at":"2026-01-28T02:10:50.806Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["circe","doobie","fs2","h2-database","http4s","pureconfig","scala"],"created_at":"2024-08-02T13:01:53.486Z","updated_at":"2026-01-28T03:33:36.158Z","avatar_url":"https://github.com/jaspervz.png","language":"Scala","funding_links":[],"categories":["Scala"],"sub_categories":[],"readme":"# todo-http4s-doobie\nA sample project of a microservice using [http4s](http://http4s.org/), [doobie](http://tpolecat.github.io/doobie/),\nand [circe](https://github.com/circe/circe).\n\nThe microservice allows CRUD of todo items with a description and an importance (high, medium, low).\n\n## End points\nThe end points are:\n\n| Method  | Url         | Description                                                                                                                                                                       |\n|---------| ----------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| GET     | /todos      | Returns all todos.                                                                                                                                                                |\n| GET     | /todos/{id} | Returns the todo for the specified id, 404 when no todo present with this id.                                                                                                     |\n| POST    | /todos      | Creates a todo, give as body JSON with the description and importance, returns a 201 with the created todo.                                                                       |\n| PUT     | /todos/{id} | Updates an existing todo, give as body JSON with the description and importance, returns a 200 with the updated todo when a todo is present with the specified id, 404 otherwise. |\n|  DELETE | /todos/{id} | Deletes the todo with the specified todo, 404 when no todo present with this id.                                                                                                  |\n\nHere are some examples on how to use the microservice with curl, assuming it runs on the default port 8080:\n\nCreate a todo:\n```curl -X POST --header \"Content-Type: application/json\" --data '{\"description\": \"my todo\", \"importance\": \"high\"}' http://localhost:8080/todos```\n\nGet all todos:\n```curl http://localhost:8080/todos```\n\nGet a single todo (assuming the id of the todo is 1):\n```curl http://localhost:8080/todos/1```\n\nUpdate a todo (assuming the id of the todo is 1):\n```curl -X PUT --header \"Content-Type: application/json\" --data '{\"description\": \"my todo\", \"importance\": \"low\"}' http://localhost:8080/todos/1```\n\nDelete a todo (assuming the id of the todo is 1):\n```curl -X DELETE http://localhost:8080/todos/1```\n\n## http4s\n[http4s](http://http4s.org/) is used as the HTTP layer. http4s provides streaming and functional HTTP for Scala.\nThis example project uses [cats-effect](https://github.com/typelevel/cats-effect), but is possible to use\nhttp4s with another effect monad.\n\nBy using an effect monad, side effects are postponed until the last moment.\n\nhttp4s uses [fs2](https://github.com/functional-streams-for-scala/fs2) for streaming. This allows to return\nstreams in the HTTP layer so the response doesn't need to be generated in memory before sending it to the client.\n\nIn the example project this is done for the `GET /todos` endpoint.\n\n## doobie\n[doobie](http://tpolecat.github.io/doobie/) is used to connect to the database. This is a pure functional JDBC layer for Scala.\nThis example project uses [cats-effect](https://github.com/typelevel/cats-effect) in combination with doobie,\nbut doobie can use another effect monad.\n\nBecause both http4s and doobie use an effect monad, the combination is still pure and functional.\n\n## circe\n[circe](https://github.com/circe/circe) is the recommended JSON library to use with http4s. It provides\nautomatic derivation of JSON Encoders and Decoders.\n\n## Configuration\n[pureconfig](https://github.com/pureconfig/pureconfig) is used to read the configuration file `application.conf`.\nThis library allows reading a configuration into well typed objects.\n\n## Database\n[h2](http://www.h2database.com/) is used as a database. This is an in memory database, so when stopping the application, the state of the\nmicroservice is lost.\n\nUsing [Flyway](https://flywaydb.org/) the database migrations are performed when starting the server.\n\n## Tests\nThis example project contains both unit tests, which mock the repository that accesses the database, and\nintegration tests that use the [http4s](http://http4s.org/) HTTP client to perform actual requests.\n\nRun the tests with `sbt test`. The integration tests are in a separate sbt project,\nrun them with `sbt \"integrationTest / test\"`\n\n## Running\nYou can run the microservice with `sbt run`. By default it listens to port number 8080, you can change\nthis in the `application.conf`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaspervz%2Ftodo-http4s-doobie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaspervz%2Ftodo-http4s-doobie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaspervz%2Ftodo-http4s-doobie/lists"}