{"id":13680745,"url":"https://github.com/aantron/dream","last_synced_at":"2025-05-14T08:09:19.237Z","repository":{"id":37255694,"uuid":"345513448","full_name":"aantron/dream","owner":"aantron","description":"Tidy, feature-complete Web framework","archived":false,"fork":false,"pushed_at":"2024-12-20T08:18:22.000Z","size":3701,"stargazers_count":1677,"open_issues_count":115,"forks_count":142,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-04-12T03:43:59.838Z","etag":null,"topics":["framework","graphql","http","ocaml","reasonml","web","websockets"],"latest_commit_sha":null,"homepage":"https://aantron.github.io/dream/","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/aantron.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","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},"funding":{"github":"aantron"}},"created_at":"2021-03-08T02:59:36.000Z","updated_at":"2025-04-10T14:55:48.000Z","dependencies_parsed_at":"2024-01-02T15:48:24.410Z","dependency_job_id":"edf01998-d062-499e-9bc9-7555c53b3aa0","html_url":"https://github.com/aantron/dream","commit_stats":{"total_commits":995,"total_committers":51,"mean_commits":19.50980392156863,"dds":0.1336683417085427,"last_synced_commit":"27ff43177b57a9c64abb39e72750fbd5f6a47199"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aantron%2Fdream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aantron%2Fdream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aantron%2Fdream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aantron%2Fdream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aantron","download_url":"https://codeload.github.com/aantron/dream/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254101558,"owners_count":22014908,"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":["framework","graphql","http","ocaml","reasonml","web","websockets"],"created_at":"2024-08-02T13:01:21.433Z","updated_at":"2025-05-14T08:09:14.228Z","avatar_url":"https://github.com/aantron.png","language":"OCaml","readme":"\u003ch1 align=\"center\"\u003eDream\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\nEasy-to-use, feature-complete Web framework without boilerplate.\n\u003c/p\u003e\n\n\u003cbr\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/aantron/dream/master/docs/asset/sample.png\"\u003e\u003c/img\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#quick-start\"\u003eQuick Start\u003c/a\u003e |\n  \u003ca href=\"https://github.com/aantron/dream/tree/master/example#readme\"\u003e\n    Tutorial\u003c/a\u003e |\n  \u003ca href=\"https://aantron.github.io/dream/\"\u003eReference\u003c/a\u003e\n  \u0026nbsp;\u0026nbsp;\n\u003c/p\u003e\n\n\u003cbr\u003e\n\u003cbr\u003e\n\nDream is **one flat module** in **one package**, documented on\n[**one page**][api-main], but with [**many examples**][tutorial]. It offers:\n\n- [**WebSockets**][websocket] and [**GraphQL**][graphql] for your modern Web\n  apps.\n- [**HTML templates**][templates] with embedded OCaml or\n  [Reason][reason-templates] \u0026mdash; use existing skills!\n- [**Sessions**][sessions] with pluggable storage [back ends][back-ends].\n- Easy [**HTTPS** and **HTTP/2** support][https] \u0026mdash; Dream runs without a\n  proxy.\n- Helpers for [**secure cookies**][cookies] and\n  [**CSRF-safe forms**][forms].\n- **Full-stack ML** with clients compiled by [**Melange**][melange],\n  [**ReScript**][rescript], or [**js_of_ocaml**][jsoo].\n\n\u003cbr\u003e\n\n...all without sacrificing ease of use \u0026mdash; Dream has:\n\n- A simple programming model \u0026mdash; Web apps are [**just functions**][handler]!\n- Composable [**middleware**][middleware] and [**routes**][routing].\n- Unified, internationalization-friendly [**error handling**][errors].\n- [**Cryptography**][crypto] helpers, key rotation, and a chosen cipher.\n- A neat [**logger**][logging], and attention to configuring the OCaml runtime\n  nicely.\n- [**Deployment**][deploy] instructions for **Digital Ocean**, **Heroku**, and\n  **Fly.io**, with sample CI scripts.\n\n\u003cbr\u003e\n\nEvery part of the API is arranged to be easy to understand, use, and remember.\nDream sticks to base OCaml types like `string` and `list`, introducing only a\nfew [types][types] of its own \u0026mdash; and some of those are just abbreviations\nfor bare functions!\n\nThe neat interface is not a limitation. Everything is still configurable by a\nlarge number of optional arguments, and very loose coupling. Where necessary,\nDream exposes the lower-level machinery that it is composed from. For example,\nthe basic body and WebSocket readers [return strings][basic-read], but you can\nalso do [zero-copy streaming][streaming].\n\nYou can even run Dream as a [quite bare abstraction][raw] over its [underlying\nset of HTTP libraries][vendor], where it acts only as minimal glue code between\ntheir slightly different interfaces.\n\nAnd, even though Dream is presented as one package for ordinary usage, it is\ninternally factored into [several sub-libraries][libs], according to the\ndifferent dependencies of each, for fast porting to different environments.\n\nDream is a low-level and unopinionated framework, and you can swap out its\nconveniences. For example, you can use TyXML with [server-side JSX][jsx]\ninstead of Dream's built-in templates. You can bundle assets into a [single\nDream binary][one-binary], or use Dream in a subcommand. Dream tries to be as\nfunctional as possible, touching global runtime state only lazily, when called\ninto.\n\n[https]: https://github.com/aantron/dream/tree/master/example/l-https#folders-and-files\n[websocket]: https://github.com/aantron/dream/tree/master/example/k-websocket#folders-and-files\n[graphql]: https://github.com/aantron/dream/tree/master/example/w-graphql-subscription#folders-and-files\n[templates]: https://github.com/aantron/dream/tree/master/example/7-template#folders-and-files\n[reason-templates]: https://github.com/aantron/dream/tree/master/example/r-template#folders-and-files\n[middleware]: https://github.com/aantron/dream/tree/master/example/2-middleware#folders-and-files\n[handler]: https://aantron.github.io/dream/#type-handler\n[routing]: https://github.com/aantron/dream/tree/master/example/3-router#folders-and-files\n[cookies]: https://aantron.github.io/dream/#cookies\n[forms]: https://aantron.github.io/dream/#forms\n[sessions]: https://github.com/aantron/dream/tree/master/example/b-session#folders-and-files\n[back-ends]: https://aantron.github.io/dream/#back-ends\n[errors]: https://github.com/aantron/dream/tree/master/example/9-error#folders-and-files\n[crypto]: https://aantron.github.io/dream/#cryptography\n[logging]: https://github.com/aantron/dream/tree/master/example/2-middleware#folders-and-files\n[melange]: https://github.com/aantron/dream/tree/master/example/r-fullstack-melange#folders-and-files\n[rescript]: https://github.com/aantron/dream/tree/master/example/w-fullstack-rescript#folders-and-files\n[jsoo]: https://github.com/aantron/dream/tree/master/example/w-fullstack-jsoo#folders-and-files\n[types]: https://aantron.github.io/dream/#types\n[basic-read]: https://aantron.github.io/dream/#val-body\n[streaming]: https://aantron.github.io/dream/#streaming\n[raw]: https://aantron.github.io/dream/#builtin\n[alpn]: https://en.wikipedia.org/wiki/Application-Layer_Protocol_Negotiation\n[libs]: https://github.com/aantron/dream/tree/master/src\n[deploy]: https://github.com/aantron/dream/tree/master/example#deploying\n[jsx]: https://github.com/aantron/dream/tree/master/example/r-tyxml#folders-and-files\n[one-binary]: https://github.com/aantron/dream/tree/master/example/w-one-binary#folders-and-files\n\n\u003cbr\u003e\n\n## Quick start\n\nYou can get\n[one](https://github.com/aantron/dream/tree/master/example/2-middleware#folders-and-files)\nof the first [tutorials][tutorial] and build it locally with:\n\n\u003cpre\u003e\u003cb\u003ebash -c \"$(curl -fsSL https://raw.githubusercontent.com/aantron/dream/master/example/quickstart.sh)\"\u003c/b\u003e\u003c/pre\u003e\n\n### opam\n\nCreate a project directory with an optional local switch:\n\n```\nmkdir project\ncd project\nopam switch create . 5.1.0\neval $(opam env)\n```\n\nInstall Dream:\n\n```\nopam install dream\n```\n\nAfter that, go to any of the [examples][tutorial], such as\n[**`2-middleware`**][2-middleware], re-create the files locally, and run it:\n\n```\ndune exec ./middleware.exe\n```\n\n[esy-example]: https://github.com/aantron/dream/tree/master/example/w-esy#folders-and-files\n[quickstart.sh]: https://github.com/aantron/dream/blob/master/example/quickstart.sh\n[esy]: https://esy.sh/\n[2-middleware]: https://github.com/aantron/dream/tree/master/example/2-middleware#folders-and-files\n\n## esy\n\nVisit any of the [examples][tutorial], such as\n[**`2-middleware`**][2-middleware], and re-create the files locally. The file\n[`esy.json`](https://github.com/aantron/dream/blob/master/example/2-middleware/esy.json)\nshows how to depend on Dream. All of the examples are installed by running `npx\nesy`, and started with `npx esy start`.\n\n\u003cbr\u003e\n\n## Documentation\n\n- [**Tutorial**][tutorial] \u0026mdash; Threads together the first several examples\n  of Dream, touching all the basic topics, including security. See the full list\n  and start wherever you like, or begin at [**`1-hello`**][1-hello], the Dream\n  version of *Hello, world!*\n- [**Reason syntax**][reason-examples] \u0026mdash; Several of the examples are\n  written in Reason. See [**`r-hello`**][r-hello].\n- [**Full-stack**][fullstack] \u0026mdash; See skeleton projects\n  [**`r-fullstack-melange`**][melange], [**`w-fullstack-rescript`**][rescript],\n  and [**`w-fullstack-jsoo`**][jsoo].\n- [**Deploying**][deploying] \u0026mdash; Quick start instructions for\n  small-to-medium deployments.\n- [**Examples**][examples] \u0026mdash; These cover various HTTP scenarios.\n- [**API reference**][api-main]\n- [Watching][watch] and [live reloading][reload].\n\n[tutorial]: https://github.com/aantron/dream/tree/master/example#readme\n[examples]: https://github.com/aantron/dream/tree/master/example#examples\n[1-hello]: https://github.com/aantron/dream/tree/master/example/1-hello#folders-and-files\n[r-hello]: https://github.com/aantron/dream/tree/master/example/r-hello#folders-and-files\n[reason-examples]: https://github.com/aantron/dream/tree/master/example#reason\n[deploying]: https://github.com/aantron/dream/tree/master/example#deploying\n[api-main]: https://aantron.github.io/dream/#types\n[fullstack]: https://github.com/aantron/dream/tree/master/example#full-stack\n[watch]: https://github.com/aantron/dream/tree/master/example/w-watch#folders-and-files\n[reload]: https://github.com/aantron/dream/tree/master/example/w-live-reload#folders-and-files\n\n\u003cbr\u003e\n\n## Recommended projects\n\n- [`dream-cli`](https://github.com/tmattio/dream-cli) \u0026nbsp;\u0026mdash;\u0026nbsp;\n  command-line interface for Dream applications.\n- [`dream-encoding`](https://github.com/tmattio/dream-encoding) \u0026nbsp;\u0026mdash;\n  \u0026nbsp; compression middleware.\n- [`dream-livereload`](https://github.com/tmattio/dream-livereload)\n  \u0026nbsp;\u0026mdash;\u0026nbsp; live reloading.\n- [`emile`](https://github.com/dinosaure/emile) \u0026nbsp;\u0026mdash;\u0026nbsp; email\n  address syntax validation.\n- [`letters`](https://github.com/oxidizing/letters) \u0026nbsp;\u0026mdash;\u0026nbsp; SMTP\n  client.\n\n\u003cbr\u003e\n\n## Example repositories\n\n- [`dream-mail-example`](https://github.com/jsthomas/dream-email-example)\n  \u0026nbsp;\u0026mdash;\u0026nbsp; sends email using RabbitMQ and Mailgun\n  [[blog post](https://jsthomas.github.io/ocaml-email.html),\n  [discuss](https://discuss.ocaml.org/t/how-to-send-email-from-dream/8201)].\n- [`dream-melange-tea-tailwind`](https://github.com/tcoopman/dream-melange-tea-tailwind)\n  \u0026nbsp;\u0026mdash;\u0026nbsp; The Elm Architecture with a Dream server, client compiled\n  by Melange.\n\n\u003cbr\u003e\n\n## Contact\n\nApart from the [issues](https://github.com/aantron/dream/issues), good places\nto discuss Dream are...\n\n- #dream on the [Reason Discord](https://discord.gg/2JTYRq2rYh).\n- #webdev on the [OCaml Discord](https://discord.gg/sx45hPkkWV).\n- The [OCaml Discuss forum](https://discuss.ocaml.org/).\n- The development stream on [Twitch](https://www.twitch.tv/antron_ML).\n\nHighlight `@antron` to poke @aantron specifically.\n\n\u003cbr\u003e\n\n## Contributing\n\nAll kinds of contributions are welcome, including examples, links to blogs,\nrelated libraries, and, of course, PRs! See [CONTRIBUTING.md][contributing.md].\n\nAs an immediate note, if you'd like to clone the repo, be sure to use\n`--recursive`, because Dream uses several git [submodules][vendor]:\n\n```\ngit clone https://github.com/aantron/dream.git --recursive\n```\n\n[contributing.md]: https://github.com/aantron/dream/blob/master/docs/CONTRIBUTING.md\n\n\u003cbr\u003e\n\n## Acknowledgements\n\nDream is based on work by the authors and contributors of its [**many\ndependencies**][opamfile] and their transitive dependencies. There are, however,\nseveral influences that cannot be discovered directly:\n\n- Templates are inspired by [**ECaml**][ecaml] from [Alexander Markov][komar]\n  and [**Embedded OCaml Templates**][eot] from [Emile Trotignon][trotignon].\n- Dream's handler and middleware types are simplified from [**Opium**][opium] by\n  [Rudi Grinberg][rgrinberg] and contributors.\n- The lower-level HTTP and WebSocket servers are [vendored][vendor] copies of\n  [Antonio Nuno Monteiro][anmonteiro]'s forks and original works, with credit\n  also due to their contributors, and [Spiros Eliopoulos][seliopou] in\n  particular, as the original author of two of the projects.\n- The API docs are instantiated by [**Soupault**][soupault] from\n  [Daniil Baturin][dmbaturin].\n- The name was inspired by [**Morph**][morph] from [Ulrik Strid][ulrikstrid],\n  which was itself partially inspired by [Opium][opium].\n- [Raphael Rafatpanah][persianturtle] and [El-Hassan Wanas][foocraft] provided\n  important early feedback.\n\n[ecaml]: http://komar.in/en/code/ecaml\n[komar]: https://github.com/apsheronets\n[eot]: https://github.com/EmileTrotignon/embedded_ocaml_templates\n[trotignon]: https://github.com/EmileTrotignon\n[opamfile]: https://github.com/aantron/dream/blob/master/dream.opam\n[opium]: https://github.com/rgrinberg/opium\n[vendor]: https://github.com/aantron/dream/tree/master/src/vendor\n[rgrinberg]: https://github.com/rgrinberg\n[anmonteiro]: https://github.com/anmonteiro\n[soupault]: https://github.com/dmbaturin/soupault\n[dmbaturin]: https://github.com/dmbaturin\n[morph]: https://github.com/reason-native-web/morph\n[ulrikstrid]: https://github.com/ulrikstrid\n[seliopou]: https://github.com/seliopou\n[persianturtle]: https://github.com/persianturtle\n[foocraft]: https://github.com/foocraft\n","funding_links":["https://github.com/sponsors/aantron"],"categories":["OCaml","Reason"],"sub_categories":["Libraries"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faantron%2Fdream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faantron%2Fdream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faantron%2Fdream/lists"}