{"id":46796772,"url":"https://github.com/marcinzh/enterprise","last_synced_at":"2026-03-10T04:34:00.526Z","repository":{"id":183803869,"uuid":"670778535","full_name":"marcinzh/enterprise","owner":"marcinzh","description":"Serve HTTP using Algebraic Effects and Handlers","archived":false,"fork":false,"pushed_at":"2025-08-07T10:50:32.000Z","size":81,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-07T11:14:13.140Z","etag":null,"topics":["algebraic-effects","functional-programming","http-server","scala"],"latest_commit_sha":null,"homepage":"","language":"Scala","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/marcinzh.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-07-25T20:20:08.000Z","updated_at":"2025-08-07T10:50:36.000Z","dependencies_parsed_at":"2025-05-05T14:34:11.374Z","dependency_job_id":"4cc4bf94-2161-4d7a-aac8-37dfa062e4a3","html_url":"https://github.com/marcinzh/enterprise","commit_stats":{"total_commits":14,"total_committers":1,"mean_commits":14.0,"dds":0.0,"last_synced_commit":"90a9f6053fd523259ebd0b71dac60019fd65ec72"},"previous_names":["marcinzh/enterprise"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/marcinzh/enterprise","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcinzh%2Fenterprise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcinzh%2Fenterprise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcinzh%2Fenterprise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcinzh%2Fenterprise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcinzh","download_url":"https://codeload.github.com/marcinzh/enterprise/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcinzh%2Fenterprise/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30324449,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T01:36:58.598Z","status":"online","status_checked_at":"2026-03-10T02:00:06.579Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["algebraic-effects","functional-programming","http-server","scala"],"created_at":"2026-03-10T04:33:59.551Z","updated_at":"2026-03-10T04:34:00.514Z","avatar_url":"https://github.com/marcinzh.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.marcinzh/enterprise-core_3/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.marcinzh/enterprise-core_3)  [![javadoc](https://javadoc.io/badge2/io.github.marcinzh/enterprise-core_3/javadoc.svg)](https://javadoc.io/doc/io.github.marcinzh/enterprise-core_3)\r\n\r\n# Enterprise \u003cimage style=\"max-height:1.2em\" src=\"https://github.githubassets.com/images/icons/emoji/unicode/1f680.png\"\u003e\u003cimage style=\"max-height:1.2em\" src=\"https://github.githubassets.com/images/icons/emoji/unicode/1fa90.png\"\u003e\r\n\r\nMinimalist library for creating HTTP services, using algebraic effects and handlers.\r\n\r\n- ⚗️ 🔬 🧪 \u0026nbsp; 𝑷𝑹𝑶𝑻𝑶𝑻𝒀𝑷𝑬 \u0026nbsp;   🚧 WIP 🚧\r\n- Uses Scala 3.\r\n- Uses [Turbolift](https://marcinzh.github.io/turbolift/) as effect system.\r\n- Adapts parts of design of preexisting purely-functional HTTP libraries ([Http4s](https://github.com/http4s/http4s), [ZIO-Http](https://github.com/zio/zio-http)) for the new effect system.\r\n\r\n\r\n## Design\r\n\r\nServices are defined as values of type:\r\n```scala\r\ntype Service[U] = Response[U] !! (RequestEffect \u0026 U)\r\n````\r\nWhich should be read as: \"Computation, that **returns** `Response` and **requests effects**: `RequestEffect` and `U`\".\r\nWhere `U` means user selected set of effects involved in computing the response.\r\n\r\n`RequestEffect` is an instance of Turbolift's `Reader` effect, predefined in Enterprise.\r\n\r\nExamples of ptional effects, predefined in Enterprise, are:\r\n- `ResponseError` - An instance of Turbolift's `Error` effect. Allows interruption of processing of the request, returning given `Response` value. \r\n- `RouterEffect` - An instance of Turbolift's `Choice` effect. Allows defining routes by partial functions. Composition can be done with Turbolift's `++!` operator (similar to `\u003c|\u003e` of `Alternative`).\r\n\r\nSuch effects can be handled at:\r\n- Request scope: before `.serve` call (i.e. once per each served request). \r\n- Server scope: after `.serve` call (i.e. once per server launch).\r\n\r\nMultiple handlers can be chained, using Turbolift's `\u0026\u0026\u0026!` operator.\r\n\r\n\r\n## Example\r\n\r\nRun the server with `scala-cli`:\r\n\r\n\u003e [!IMPORTANT]\r\n\u003e Turbolift requires **Java 11** or newer.\r\n\r\n```scala\r\n//\u003e using scala \"3.3.7\"\r\n//\u003e using dep \"io.github.marcinzh::enterprise-core:0.12.0\"\r\npackage examples\r\nimport turbolift.!!\r\nimport turbolift.Extensions._\r\nimport enterprise.{Response, Router}\r\nimport enterprise.DSL._\r\nimport enterprise.server.Syntax._\r\nimport enterprise.server.undertow.UndertowServer\r\n\r\n@main def main =\r\n  Router:\r\n    case GET / \"sarcastic\" / text =\u003e\r\n      val text2 = text.zipWithIndex.map((c, i) =\u003e if i % 2 == 0 then c.toLower else c.toUpper).mkString\r\n      Response.text(text2).pure_!!\r\n\r\n  .handleWith(Router.handler)\r\n  .serve\r\n  .handleWith(UndertowServer.handler)\r\n  .handleWith(Config.localhost(9000).handler)\r\n  .runIO\r\n```\r\n\r\nQuery the server with `HTTPie`:\r\n\r\n```bash\r\nhttp GET \"http://localhost:9000/sarcastic/Resistance is futile\"\r\n```\r\n\r\n---\r\n\r\nSee [examples folder](./modules/examples/src/main/scala/examples/) for more.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcinzh%2Fenterprise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcinzh%2Fenterprise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcinzh%2Fenterprise/lists"}