Dream – Tidy Web Framework for OCaml and ReasonML

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • dream

    Tidy, feature-complete Web framework

  • Yes. OCaml + all of the 3 OCaml-to-JS compilers support OCaml syntax.

    Dream itself demonstrates:

    - Server and client both written in Reason, using ocamlc+Melange https://github.com/aantron/dream/tree/master/example/r-fulls...

    That example could also have been written in OCaml syntax, because ocamlc (native) and Melange (JS) both support OCaml. However, Reason is nicer if you want to use React with JSX.

    - Server and client both written in OCaml, using ocamlc+Js_of_ocaml https://github.com/aantron/dream/tree/master/example/w-fulls...

    The remaining example uses Ocaml on the server and ReScript on the client, using the ReScript compiler. However, you could use OCaml on the client with the ReScript compiler. Just as with Melange, you would lose access to nice JSX syntax https://github.com/aantron/dream/tree/master/example/r-fulls...

    It's definitely a lot and not user-friendly to have to decide between all these options, but the community is experimenting greatly right now... so it's good and bad, and that's how it is :/

    As for Node.js, using ReScript syntax requires you to use Node.js on the native side, but that is the only coupling. If you write your native side in OCaml or Reason, you can compile it to native code with ocamlc (technically, ocamlopt is the internal command; nobody uses either one directly, but the build system calls them).

  • sihl

    A modular functional web framework

  • Really exciting to watch the developments in OCaml/Reason web frameworks/libraries. I love the language and wish I could use it instead of Ruby for my personal projects at least. Others that have caught my interest are:

    Sihl: https://github.com/oxidizing/sihl

    ReWeb: https://github.com/yawaramin/re-web/

    Of course, if you're interested in OCaml/Reason and don't know about Revery you're missing out.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • re-web

    Experimental web framework for ReasonML & OCaml

  • Really exciting to watch the developments in OCaml/Reason web frameworks/libraries. I love the language and wish I could use it instead of Ruby for my personal projects at least. Others that have caught my interest are:

    Sihl: https://github.com/oxidizing/sihl

    ReWeb: https://github.com/yawaramin/re-web/

    Of course, if you're interested in OCaml/Reason and don't know about Revery you're missing out.

  • opium

    Sinatra like web toolkit for OCaml

  • You may have meant this post:

    https://discuss.ocaml.org/t/excited-about-dream-web-framewor...

    or another in that thread, as the specific one linked doesn't compare Dream with Opium!

    Opium itself is found here:

    https://github.com/rgrinberg/opium

  • rescript-compiler

    The compiler for ReScript.

  • Typescript is indeed a step in this same direction!, as I see it.

    Underneath, Typescript has a goopier type system than OCaml. Formally speaking. Therefore Typescript ends up being less consistent and a less efficient tool for thought ... for me personally.

    That's the underneath part. On the surface we can use any syntax we care to.

    The Rescript language – FKA ReasonML – is a JavaScript-style syntax frontend for the OCaml compiler, plus a backend that compiles to quite readable and fast JavaScript: https://rescript-lang.org/

    The end result is a very readable language that feels comfortable. We can quickly write robust programs in it. (More robust than TypeScript!) It also interoperates very elegantly with the JS ecosystem, and runs on any JavaScript runtime.

    OCaml code and ReScript language can be transpiled to each other, so depending on how Dream talks to the external world – i.e. what's the shape of the system call interface at the end of Dream's world? - then maybe Dream the OCaml web framework can be used as a JavaScript web framework and run on Node.js. Which is interesting and I want to understand now that I know to ask the question – thanks!

  • lwt

    OCaml promises and concurrent I/O

  • Dream doesn't have much of a system call dependency footprint itself. It's basically just a convention for plugging request -> response functions into a web server. Some of its native dependencies will have to be replaced by Node equivalents. Soon after that, it would be portable to Node.

    There is already work underway to port Dream to Mirage, to run in unikernels: https://github.com/aantron/dream/pull/22

    Lwt, Dream's promise library, is itself getting ported to run on top of libuv: https://github.com/ocsigen/lwt/issues/813

    libuv is, of course, the I/O library that powers Node, so it might be practical to run Dream as a native node module very soon after doing this.

    (As an aside, I'm supposed to work on that libuv project, but instead I've been working on Dream :P)

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts