package vif

  1. Overview
  2. Docs
A simple web framework for OCaml 5

Install

dune-project
 Dependency

Authors

Maintainers

Sources

vif-0.0.1.beta2.tbz
sha256=a16ff3dba7675d237d59188b032052b383ad9e367eb7c570c4e6e78b978b98e5
sha512=ad553f15f33f9f2427b691713f630476fd1f15b4cb61944a401cfb35c29dd3d1d3760b02dd211bddd39b6cf6ccc8ea5d9f88eefc3776611e2a7020242a16b9a9

Description

Published: 26 Feb 2026

README

νιϝ, a small framework for building a web server from an OCaml script

(nu)(iota)(digamma)

disclaimer: Please note that this is an experimental project. It's also an opportunity to build something that can be satisfying for web development. However, we do not recommend using this project in production.

Vif is a small program that runs an OCaml script and launches a Web server from it. The main idea is to be able to set up a typed Web server as quickly as possible (note that we use hurl, an HTTP client in OCaml)

$ opam pin add -y https://github.com/robur-coop/vif
$ opam pin add -y https://github.com/robur-coop/hurl
$ opam install vif hurl
$ cat >main.ml <<EOF
#require "vif" ;;

let default req server () =
  let field = "content-type" in
  let open Vif.Response.Syntax in
  let* () = Vif.Response.add ~field "text/html; charset=utf-8" in
  let* () = Vif.Response.with_string req "Hello World!" in
  Vif.Response.respond `OK
;;

let routes =
  let open Vif.Uri in
  let open Vif.Route in
  [ get (rel /?? nil) --> default ]

let () =
  Miou_unix.run @@ fun () ->
  Vif.run routes ()
;;
EOF
$ vif --pid vif.pid main.ml &
$ hurl http://localhost:8080/
HTTP/1.1 200 OK

connection: close
content-length: 12
content-type: text/html

Hello World!

$ kill -SIGINT $(cat vid.pid)

Examples

The examples folder contains several examples of the use of vif. It shows the management of more complex requests (json, multipart-form, etc.) as well as the use of an SQL database with caqti. A complete example of a web application that uses dune is available here. It is a summary of our tutorial available here: creating a user space with a chatroom using Vif.

Dependencies (21)

  1. tyxml >= "4.6.0"
  2. hmap
  3. multipart_form-miou
  4. conan-database
  5. conan-unix >= "0.0.6"
  6. decompress >= "1.5.0"
  7. mirage-crypto-rng-miou-unix
  8. tyre >= "1.0"
  9. httpcats >= "0.2.0"
  10. cmdliner >= "1.3.0"
  11. jsont >= "0.2.0"
  12. fluxt >= "0.0.1~beta2"
  13. flux >= "0.0.1~beta2"
  14. bytesrw
  15. fpath >= "0.7.3"
  16. logs >= "0.9.0"
  17. bos >= "0.2.1"
  18. fmt >= "0.11.0"
  19. uri >= "4.4.0"
  20. dune >= "3.0.0"
  21. ocaml >= "5.3.0"

Dev Dependencies (5)

  1. brr with-test
  2. caqti-driver-sqlite3 with-test
  3. caqti-miou with-test
  4. jwto with-test
  5. hurl with-test

Used by (1)

  1. vifu

Conflicts (1)

  1. result < "1.5"