A new way to write Web sites

Ocsigen provides expressive concepts to program these common behaviours of Web interaction using a very few lines of code:

  • Service-based Web programming
  • Powerful service identification mechanism
  • Dynamic creation of new services

Ocsigen uses the expressiveness of the OCaml language to provide high level semantic concepts dedicated to Web programming. It relieves the programmer of many technical details.

Service based programming

An Ocsigen Web site is written as a single OCaml module. Requests are handled by services, which can be seen as functions called by clicking on a hyperlink or by sending a form.

Services may return HTML pages, but also files, redirections, or many other types of output. There is also a kind of service called action, that just performs a side effect on server side.


The following piece of code defines two services. The first one returns an HTML5 page, the second one returns a redirection to the first one.

let s1 = Html5.register_service