dreamversion Documentation on ocaml.org

Tidy, feature-complete Web framework

Dream is a feature-complete Web framework with a simple programming model and no boilerplate. It provides only two data types, request and response.

Almost everything else is either a built-in OCaml type, or an abbreviation for a bare function. For example, a Web app, known in Dream as a handler, is just an ordinary function from requests to responses. And a middleware is then just a function from handlers to handlers.

Within this model, Dream adds:

  • Session management with pluggable back ends.
  • A fully composable router.
  • Support for HTTP/1.1, HTTP/2, and HTTPS.
  • WebSockets.
  • GraphQL, including subscriptions and a built-in GraphiQL editor.
  • SQL connection pool helpers.
  • Server-side HTML templates.
  • Automatic secure handling of cookies and forms.
  • Unified, internationalization-friendly error handling.
  • A neat log, and OCaml runtime configuration.
  • Helpers for Web formats, such as Base64url, and a modern cipher.

Because of the simple programming model, everything is optional and composable. It is trivially possible to strip Dream down to just a bare driver of the various HTTP protocols.

Dream is presented as a single module, whose API is documented on one page. In addition, Dream comes with a large number of examples. Security topics are introduced throughout, wherever they are applicable.

Tags http web framework websocket graphql server http2 tls
AuthorAnton Bachin <antonbachin@yahoo.com>
LicenseMIT
Published
Homepagehttps://github.com/camlworks/dream
Issue Trackerhttps://github.com/camlworks/dream/issues
Documentationhttps://camlworks.github.io/dream
MaintainersSebastian Willenbrink <sebastian.willenbrink@mailbox.org>, Yawar Amin <yawar.amin@gmail.com> and Anton Bachin <antonbachin@yahoo.com>
Dependencies
Source [http] https://github.com/camlworks/dream/releases/download/1.0.0/dream-1.0.0.tbz
sha256=beb367e9abe25097c6c43c466e6ed9ac324923db0acdccdace8365f5210f856e
sha512=d4482208b3955a60192ca60f69eae1af7e1cf49dc023c495ce94cc9f96c8fffe69dcc77f8004ca7a90b09f1f4b1aa33623b740169af9107264ec9db93592dbff
Edithttps://github.com/ocaml/opam-repository/tree/master/packages/dream/dream.1.0.0/opam