{"id":17343258,"url":"https://github.com/geirolz/toolkit","last_synced_at":"2025-08-20T22:47:06.276Z","repository":{"id":65507725,"uuid":"588236301","full_name":"geirolz/toolkit","owner":"geirolz","description":"A Scala 3, lightweight and functional non-intrusive library to build typed and declarative Scala application with managed resources and dependencies","archived":false,"fork":false,"pushed_at":"2025-03-16T00:10:34.000Z","size":1139,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-28T08:12:12.237Z","etag":null,"topics":["application","application-framework","cats","cats-effect","functional-programming","microservice","microservices","resources","scala","service","toolkit"],"latest_commit_sha":null,"homepage":"https://geirolz.github.io/toolkit/","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/geirolz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"patreon":"geirolz"}},"created_at":"2023-01-12T16:43:08.000Z","updated_at":"2025-03-16T00:10:38.000Z","dependencies_parsed_at":"2023-02-12T18:15:35.554Z","dependency_job_id":"baed0802-c782-4052-b864-af8c9c845e90","html_url":"https://github.com/geirolz/toolkit","commit_stats":{"total_commits":242,"total_committers":3,"mean_commits":80.66666666666667,"dds":"0.30578512396694213","last_synced_commit":"fba810de6ef6f380492dc6d6f3acc13f0eebbd37"},"previous_names":["geirolz/toolkit","geirolz/app-toolkit"],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geirolz%2Ftoolkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geirolz%2Ftoolkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geirolz%2Ftoolkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geirolz%2Ftoolkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geirolz","download_url":"https://codeload.github.com/geirolz/toolkit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248952068,"owners_count":21188421,"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":["application","application-framework","cats","cats-effect","functional-programming","microservice","microservices","resources","scala","service","toolkit"],"created_at":"2024-10-15T16:08:54.754Z","updated_at":"2025-04-14T19:54:10.284Z","avatar_url":"https://github.com/geirolz.png","language":"Scala","funding_links":["https://patreon.com/geirolz"],"categories":[],"sub_categories":[],"readme":"# Toolkit\n\n[![Build Status](https://github.com/geirolz/toolkit/actions/workflows/cicd.yml/badge.svg)](https://github.com/geirolz/toolkit/actions)\n[![codecov](https://img.shields.io/codecov/c/github/geirolz/toolkit)](https://codecov.io/gh/geirolz/toolkit)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/db3274b55e0c4031803afb45f58d4413)](https://www.codacy.com/manual/david.geirola/toolkit?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=geirolz/toolkit\u0026amp;utm_campaign=Badge_Grade)\n[![Sonatype Nexus (Releases)](https://img.shields.io/nexus/r/com.github.geirolz/toolkit_2.13?server=https%3A%2F%2Foss.sonatype.org)](https://mvnrepository.com/artifact/com.github.geirolz/toolkit)\n[![Scala Steward badge](https://img.shields.io/badge/Scala_Steward-helping-blue.svg?style=flat\u0026logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAQCAMAAAARSr4IAAAAVFBMVEUAAACHjojlOy5NWlrKzcYRKjGFjIbp293YycuLa3pYY2LSqql4f3pCUFTgSjNodYRmcXUsPD/NTTbjRS+2jomhgnzNc223cGvZS0HaSD0XLjbaSjElhIr+AAAAAXRSTlMAQObYZgAAAHlJREFUCNdNyosOwyAIhWHAQS1Vt7a77/3fcxxdmv0xwmckutAR1nkm4ggbyEcg/wWmlGLDAA3oL50xi6fk5ffZ3E2E3QfZDCcCN2YtbEWZt+Drc6u6rlqv7Uk0LdKqqr5rk2UCRXOk0vmQKGfc94nOJyQjouF9H/wCc9gECEYfONoAAAAASUVORK5CYII=)](https://scala-steward.org)\n[![Mergify Status](https://img.shields.io/endpoint.svg?url=https://api.mergify.com/v1/badges/geirolz/toolkit\u0026style=flat)](https://mergify.io)\n[![GitHub license](https://img.shields.io/github/license/geirolz/toolkit)](https://github.com/geirolz/toolkit/blob/main/LICENSE)\n\n\u003cdiv align=\"center\"\u003e\n \u003cimg src=\"images/logo.png\" alt=\"logo\" width=\"50%\"/\u003e\n\u003c/div\u003e\n\nToolkit is a lightweight and non-intrusive open-source library designed to simplify the development of typed and\ndeclarative applications in Scala.\n\nIt offers a functional approach to building applications by managing resources and\ndependencies, allowing developers to focus on the core aspects of their application logic.\n\nRead this article about this library:\n[Semantic of a functional app in Scala](https://www.reddit.com/r/scala/comments/14g3uxo/semantic_of_a_functional_app_in_scala/)\n\nPlease, drop a ⭐️ if you are interested in this project and you want to support it.\n\n- [Features](#features)\n- [Notes](#notes)\n- [Getting Started](#getting-started)\n- [Integrations](#integrations)\n- [Adopters](#adopters)\n- [Contributing](#contributing)\n- [License](#license)\n- [Acknowledgements](#acknowledgements)\n- [Contact](#contact)\n\n## Features\n\n\u003e Resources --build--\u003e Dependencies --\u003e [Finalize Resources] --build--\u003e App Logic -\u003e [Finalize Dependencies]\n\n- **Resource Management:** Toolkit simplifies the management of application resources, such as configuration\n  settings, logging, and custom resources. By abstracting away the resource handling, it reduces boilerplate code and\n  provides a clean and concise syntax for managing resources.\n\n- **Dependency Injection:** The library provides a straightforward way to handle application dependencies. It allows you\n  to define and inject application-specific services and repositories, encouraging modular and testable code.\n\n- **Declarative Syntax:** Toolkit promotes a declarative coding style, where you can describe the structure and\n  behavior of your application in a clear and concise manner. This leads to code that is easier to understand, reason\n  about, and maintain.\n\n## Notes\n- Resources are released before providing the app execution.\n- Dependencies are released at the end of the app execution as defined as `Resource[F, *]`.\n- If you need to run an infinite task using `provide*` you should use `F.never` or equivalent to keep the task running.\n\n## Getting Started\n\nTo get started with Toolkit, follow these steps:\n\n1. **Installation:** Include the library as a dependency in your Scala project. You can find the latest version and\n   installation instructions in the [Toolkit GitHub repository](https://github.com/geirolz/toolkit).\n\n```sbt\nlibraryDependencies += \"com.github.geirolz\" %% \"toolkit\" % \"0.0.11\"\n```\n\n2. **Define Your Application:** Create a new Scala objects or classes that represents your application dependencies and\n   resources.\n\n```scala\nimport cats.Show\nimport cats.effect.{Resource, IO}\nimport com.geirolz.app.toolkit.*\nimport com.geirolz.app.toolkit.logger.ConsoleLogger\nimport com.geirolz.app.toolkit.novalues.NoResources\n\n// Define config\ncase class Config(host: String, port: Int)\nobject Config:\n  given Show[Config] = Show.fromToString\n\n// Define service dependencies\ncase class AppDependencyServices(kafkaConsumer: KafkaConsumer[IO])\n\nobject AppDependencyServices:\n    def resource(using AppContext.NoDepsAndRes[SimpleAppInfo[String], ConsoleLogger[IO], Config]): Resource[IO, AppDependencyServices] =\n      Resource.pure(AppDependencyServices(KafkaConsumer.fake))\n\n// A stubbed kafka consumer\ntrait KafkaConsumer[F[_]]:\n  def consumeFrom(name: String): fs2.Stream[F, KafkaConsumer.KafkaRecord]\n\nobject KafkaConsumer:\n\n  import scala.concurrent.duration.DurationInt\n\n  case class KafkaRecord(value: String)\n\n  def fake: KafkaConsumer[IO] =\n    (name: String) =\u003e\n      fs2.Stream\n        .eval(IO.randomUUID.map(t =\u003e KafkaRecord(t.toString)).flatTap(_ =\u003e IO.sleep(5.seconds)))\n        .repeat\n```\n\n3. **Build Your Application:** Build your application using the Toolkit DSL and execute it. Toolkit\n   takes care of managing resources, handling dependencies, and orchestrating the execution of your application logic.\n\n```scala\nimport cats.effect.{ExitCode, IO, IOApp}\nimport com.geirolz.app.toolkit.*\nimport com.geirolz.app.toolkit.logger.Logger\n\nobject Main extends IOApp:\n    override def run(args: List[String]): IO[ExitCode] =\n      App[IO]\n        .withInfo(\n          SimpleAppInfo.string(\n            name = \"toolkit\",\n            version = \"0.0.1\",\n            scalaVersion = \"2.13.10\",\n            sbtVersion = \"1.8.0\"\n          )\n        )\n        .withConsoleLogger()\n        .withConfigF(IO.pure(Config(\"localhost\", 8080)))\n        .dependsOn(AppDependencyServices.resource)\n        .beforeProviding(ctx.logger.info(\"CUSTOM PRE-PROVIDING\"))\n        .provideOne(\n          // Kafka consumer\n          ctx.dependencies.kafkaConsumer\n            .consumeFrom(\"test-topic\")\n            .evalTap(record =\u003e ctx.logger.info(s\"Received record $record\"))\n            .compile\n            .drain\n        )\n        .onFinalize(ctx.logger.info(\"CUSTOM END\"))\n        .run(args)\n```\n\nCheck a full example [here](https://github.com/geirolz/toolkit/tree/main/examples)\n\nFor detailed usage examples and API documentation, please refer to\nthe [Toolkit Wiki](https://github.com/geirolz/toolkit/wiki).\n\n## Integrations\n\nFor a comprehensive list of integrations between Toolkit and other popular libraries,\nplease refer to the [integrations.md](docs/compiled/integrations.md) file.\n\nIt provides an overview of the integrations available, including libraries such as PureConfig, Log4cats, Odin, and more.\n\nEach integration showcases the benefits and features it brings to your Toolkit-based applications,\nenabling you to enhance functionality and streamline development. Explore the integrations to leverage the power of\nToolkit\nin combination with other powerful libraries.\n\n## Adopters\n\nIf you are using Toolkit in your company, please let me know and I'll add it to the list! It means a lot to me.\n\n## Contributing\n\nWe welcome contributions from the open-source community to make Toolkit even better. If you have any bug reports,\nfeature requests, or suggestions, please submit them via GitHub issues. Pull requests are also welcome.\n\nBefore contributing, please read\nour [Contribution Guidelines](https://github.com/geirolz/toolkit/blob/main/CONTRIBUTING.md) to understand the\ndevelopment process and coding conventions.\n\nPlease remember te following:\n\n- Run `sbt scalafmtAll` before submitting a PR.\n- Run `sbt gen-doc` to update the documentation.\n\n## License\n\nToolkit is released under the [Apache License 2.0](https://github.com/geirolz/toolkit/blob/main/LICENSE).\nFeel free to use it in your open-source or commercial projects.\n\n## Acknowledgements\n\nWe would like to thank all the contributors who have made Toolkit possible. Your valuable feedback, bug reports, and\ncode contributions have helped shape and improve the library.\n\n## Contact\n\nFor any questions or inquiries, you can reach out to the maintainers of Toolkit via email or open an issue in the\nGitHub repository.\n\n---\n\nHappy coding with Toolkit!\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeirolz%2Ftoolkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeirolz%2Ftoolkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeirolz%2Ftoolkit/lists"}