Tidy, feature-complete Web framework for OCaml and ReasonML


Easy-to-use, feature-complete Web framework without boilerplate.

Note: the project is in a pre-alpha state; currently writing examples.

Dream is one flat module in one package, documented on one page, but with many examples. It offers:

Every part of the API is arranged to be easy to understand, use, and remember. Dream sticks to base OCaml types like string and list, introducing only a few types of its own — and some of those are just abbreviations for bare functions!

The neat interface is not a limitation. Everything is still configurable by a large number of optional arguments. Where necessary, Dream exposes the lower-level machinery that it is composed from. For example, the basic body and WebSocket readers return strings, but you can also do zero-copy streaming.

You can even run Dream as a quite bare abstraction over its underlying set of HTTP libraries, where it acts only as minimal glue code between their slightly different interfaces, and takes care of horridness like ALPN.


  • The first examples of Dream make up a Tutorial. See the full list and start wherever you like, or begin at 1-hello, the Dream version of Hello, world!

  • Several of the tutorials and examples are available in Reason syntax, with more to come over time!

  • There are additional Examples, covering various HTTP scenarios.

  • See the API documentation.

Getting started

TODO opam release, esy instructions, quick-start script.

opam install dream


Dream uses several submodules, so be sure to clone with

git clone https://github.com/aantron/dream.git --recursive


Dream is based on work by the authors and contributors of its many dependencies and their transitive dependencies. There are, however, several influences that cannot be discovered directly:



  • [ ] Finish more of the examples, cross-link everything.
  • [ ] Correct the cipher rotation envelope scheme.
  • [ ] Quick start script.


  • [ ] Optimizations: router, logger, microparsers (form data, etc.), fully zero-allocation streaming.
  • [ ] WebSocket and stream backpressure.
  • [ ] HTTP3/QUIC.
Open Issues
Last Commit
2 weeks ago