Easy HTTPS and HTTP/2 support — Dream runs without a
...all without sacrificing ease of use — Dream has:
A simple programming model — Web apps are just functions!
Unified, internationalization-friendly error handling.
Cryptography helpers, key rotation, and a chosen cipher.
A neat logger, and attention to configuring the OCaml runtime
Deployment instructions for Digital Ocean, Heroku, and
Fly.io, with sample CI scripts.
Every part of the API is arranged to be easy to understand, use, and remember.
Dream sticks to base OCaml types like
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, and very loose coupling. 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.
And, even though Dream is presented as one package for ordinary usage, it is
internally factored into several sub-libraries, according to the
different dependencies of each, for fast porting to different environments.
Dream is a low-level and unopinionated framework, and you can swap out its
conveniences. For example, you can use TyXML with server-side JSX
instead of Dream's built-in templates. You can bundle assets into a single
Dream binary, or use Dream in a subcommand. Dream tries to be as
functional as possible, touching global runtime state only lazily, when called
Visit any of the examples, such as
2-middleware, and re-create the files locally. The file
shows how to depend on Dream. All of the examples are installed by running
npx esy, and started with
npx esy start.
opam install dream
dune exec ./middleware.exe
Tutorial — Threads together the first several examples
of Dream, touching all the basic topics, including security. See the full list
and start wherever you like, or begin at
1-hello, the Dream
version of Hello, world!
Deploying — Quick start instructions for
Examples — These cover various HTTP scenarios.
command-line interface for Dream applications.
— live reloading.
address syntax validation.
— The Elm Architecture with a Dream server, client compiled
Apart from the issues, good places
to discuss Dream are...
@antron to poke @aantron specifically.
All kinds of contributions are welcome, including examples, links to blogs,
related libraries, and, of course, PRs! See CONTRIBUTING.md.
As an immediate note, if you'd like to clone the repo, be sure to use
--recursive, because Dream uses several git submodules:
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:
The lower-level HTTP and WebSocket servers are vendored copies of
Antonio Nuno Monteiro's forks and original works, with credit
also due to their contributors, and Spiros Eliopoulos in
particular, as the original author of two of the projects.
with-test & >= "2.5.0"