{"id":13726257,"url":"https://github.com/yawaramin/re-web","last_synced_at":"2025-09-05T18:31:52.999Z","repository":{"id":47545867,"uuid":"177249769","full_name":"yawaramin/re-web","owner":"yawaramin","description":"Experimental web framework for ReasonML \u0026 OCaml","archived":false,"fork":false,"pushed_at":"2022-10-04T05:17:25.000Z","size":761,"stargazers_count":260,"open_issues_count":8,"forks_count":8,"subscribers_count":10,"default_branch":"main","last_synced_at":"2024-12-25T03:06:26.718Z","etag":null,"topics":["http","ocaml","reasonml","web-framework","websocket"],"latest_commit_sha":null,"homepage":"https://yawaramin.github.io/re-web/re-web/index.html","language":"OCaml","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/yawaramin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-23T05:49:04.000Z","updated_at":"2024-11-05T00:43:33.000Z","dependencies_parsed_at":"2023-01-19T05:01:05.146Z","dependency_job_id":null,"html_url":"https://github.com/yawaramin/re-web","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yawaramin%2Fre-web","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yawaramin%2Fre-web/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yawaramin%2Fre-web/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yawaramin%2Fre-web/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yawaramin","download_url":"https://codeload.github.com/yawaramin/re-web/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232052269,"owners_count":18465727,"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":["http","ocaml","reasonml","web-framework","websocket"],"created_at":"2024-08-03T01:02:57.113Z","updated_at":"2025-01-01T06:09:50.385Z","avatar_url":"https://github.com/yawaramin.png","language":"OCaml","funding_links":[],"categories":["OCaml"],"sub_categories":[],"readme":"## ReWeb - a type-safe ergonomic ReasonML and OCaml web framework (WIP)\n\n[![npm](https://img.shields.io/npm/v/@yawaramin/re-web.svg)](https://npmjs.org/package/@yawaramin/re-web)\n[![Build Status](https://dev.azure.com/yawaramin/re-web/_apis/build/status/yawaramin.re-web?branchName=main)](https://dev.azure.com/yawaramin/re-web/_build/latest?definitionId=1\u0026branchName=main)\n[![Test Status](https://img.shields.io/azure-devops/tests/yawaramin/re-web/4?compact_message)](https://dev.azure.com/yawaramin/re-web/_test/analytics?definitionId=4\u0026contextType=build)\n\nReWeb is a web framework based on several foundations:\n\n- The amazing work of the people behind\n  [Httpaf](https://github.com/inhabitedtype/httpaf),\n  [H2](https://github.com/anmonteiro/ocaml-h2), [Esy](https://esy.sh/),\n  and others\n- The core idea of\n  ['Your server as a function'](https://monkey.org/~marius/funsrv.pdf)\n  by Marius Eriksen which was also the idea behind Twitter's Finagle web\n  stack\n- Jasim Basheer's essay\n  ['Rails on OCaml'](https://protoship.io/blog/rails-on-ocaml/) which\n  identifies the need for an ergonomic, Rails-like web framework that\n  still preserves the type safety benefits of OCaml.\n\nReWeb's main concepts are:\n\n- Services: a service is a function from a request to a promise of\n  response (i.e. an asynchronous function).\n- Filters: a filter is a function that takes a service as input and\n  returns a service as output. It can be inserted into the 'request\n  pipeline' and manipulate the request before the service finally\n  handles it.\n- Server: a server is a function that takes a route (pair of HTTP method\n  and path list) as input and returns a service as output.\n- Type-safe request pipeline: requests have a type parameter that\n  reveals their 'context' i.e. some data that's stored inside them.\n  Filters and services must change requests correctly and in the right\n  order, or the compiler will present type errors.\n\nNotice that all the main concepts here are just functions. They are all\ncomposeable using just function composition. Services can call other\nservices. Filters can slot together by calling each other. Servers can\ndelegate smaller scopes to other servers. See `bin/Main.re` for examples\nof all of these.\n\n## Documentation\n\n- [API Reference](https://yawaramin.github.io/re-web/re-web/ReWeb/index.html)\n- [User's Manual](https://yawaramin.github.io/re-web/re-web/ReWeb__Manual/index.html)\n\n## Examples\n\n### Fullstack Reason\n\nCheck out the demo repo which shows a fullstack Reason setup with ReWeb\nand ReasonReact, with code sharing:\nhttps://github.com/yawaramin/fullstack-reason/\n\nThis repo can be cloned and used right away for a new project.\n\n### Bin directory\n\nFinally, check out the example server in the `bin/` directory. The\n`Main.re` file there has extensive examples of almost everything ReWeb\ncurrently supports.\n\nRun the example server:\n\n    $ esy bin\n\nSend some requests to it:\n\n    $ curl localhost:8080/hello\n    $ curl localhost:8080/auth/hello\n    $ curl --user 'bob:secret' localhost:8080/auth/hello\n\nGo to http://localhost:8080/login in your browser, etc.\n\n## Try\n\nYou need Esy, you can install the beta using [npm](https://npmjs.com):\n\n    $ npm install --global esy@latest\n\nThen run the `esy` command from this project root to install and build dependencies.\n\n    $ esy\n\nNow you can run your editor within the environment (which also includes merlin):\n\n    $ esy $EDITOR\n    $ esy vim\n\nAlternatively you can try [vim-reasonml](https://github.com/jordwalke/vim-reasonml)\nwhich loads esy project environments automatically.\n\nAfter you make some changes to source code, you can re-run project's build\nagain with the same simple `esy` command.\n\n    $ esy\n\nGenerate documentation:\n\n    $ esy doc\n    $ esy open '#{self.target_dir}/default/_doc/_html/index.html'\n\nShell into environment:\n\n    $ esy shell\n\nRun the test suite with:\n\n    $ esy test\n\n## Warning\n\nReWeb is experimental and not for production use! I am still ironing out\nthe API. But (imho) it looks promising for real-world usage.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyawaramin%2Fre-web","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyawaramin%2Fre-web","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyawaramin%2Fre-web/lists"}