Introduction

This tutorial is an overview of the main features of the Ocsigen
framework. It explains how to program web sites and client-server Web
applications in OCaml using Eliom, Lwt, Js_of_ocaml
and other libraries of the Ocsigen project. Read it to understand the
basics, then refer to each project's manual for more detail.

This programming guide assumes you know the OCaml language, and
that you have a working installation of Ocsigen Server, Eliom,
Lwt, Js_of_ocaml, (and Ocsigen Widgets for some examples). In
particular, you need to have the interfaces (cmi) installed for all
these packages (the -dev-packages in some distributions).
The best way to install OCaml (on MacOS, Linux ...) is to use the Opam
package manager.
The installation is described here.

We recommend to register to our
mailing list
where you can ask your questions and get news from the project.
You can also come and chat with us on
IRC in channel #ocsigen on freenode.net (e.g. by using
their webchat)!

The first section of this page is an overview of the tutorial.
The second section of this introduction lists our main
software projects.

Keep in mind that one of the key feature of Eliom is that it allows
one to mix commonplace Web interactions (URLs, forms, links,
bookmarks, back button) with dynamic client side features. In
particular, the client-side program does not stop when the user
clicks a link, sends a form, or presses the back button–yet the user
still can save bookmarks on pages! This opens up a wide field of new
possibilities, and should facilitate the emergence of new kinds of Web
applications.

If you want a more complete manual

Read the manual of each project, and/or the API documentation.

Ocsigen software projects

Most projects are independent and can be used for non Eliom-releated
applications, for example:

the cooperative threading library Lwt,

the TyXML library for generating typed XML,

the database query library Macaque,

the Js_of_ocaml compiler (from Ocaml bytecode to JavaScript),

Ocsigen Server, a full-featured Web server.

Ocsigen Server

Ocsigen Server is a full featured Web server written in modular way.
It implements most features of the HTTP protocol, and has a powerful
extension mechanism that make easy to plug your own OCaml modules
for generating pages. Many extensions are already written:

Eliom

Eliom is an extension for Ocsigen Server
that allows the creation of reliable client/server Web applications
(or traditional dynamic Web sites) in OCaml.
It implements many new concepts, and as a result, its approach to application development is very different
from all other Web programming tools.

Expressiveness

Eliom enables the creation of complex Web sites in very few lines of code, by providing high level programming primitives for many aspects of Web programming: communication between the client and the server, implementation of complex Web interaction, sessions, etc.

Static typing

Eliom also improves the stability of your application by making extensive use of OCaml's static typing. The compiler checks many things for you, helping you to remove many bugs. For example, the validity of pages (e.g. well-formed HTML) is checked at compile time! Moreover, Eliom statically checks for example that your Web site does not contain any broken links and that the parameters in a link or a form correspond to the service it leads to (and many other things).

A client/server application in one piece of code!

One of the most significant features of Eliom is that it allows you to write the client- and server-side of a Web application as a single program. The client side parts are automatically extracted and compiled into JavaScript to be executed in the browser. The communication between the server is straightforward (in both directions!), as you can use server side values in the client side code, and vice verse.

Note that client side features can be mixed with traditional Web interaction
(links, forms, bookmarks, back button ...)

Security

Eliom helps you to make your Web application secure by automatically addressing several common security issues (code injection, session fixation ...) and by providing features to implement very secure behaviours (avoiding for example "cross-site request forgery").

Lwt

Lwt is a cooperative thread library for OCaml.
It provides an alternative to the more usual preemptive threads approach
for programming concurrent applications, that avoids most problems of concurrent
data access and deadlocks.
It is used by Ocsigen Server and Eliom and has now become one of the standard ways to
implement concurrent applications in OCaml.
All your Web sites must be written in Lwt-compatible way!

Js_of_ocaml

Js_of_ocaml is a compiler of OCaml bytecode to JavaScript. It facilitates to run Ocaml programs in a Web browser. Its key features are the following:

The whole language, and most of the standard library are supported.

The compiler is easy to install: it depends only on Findlib and Lwt.

The generated code which is independant of Eliom and the Ocsigen Server. You can use it with any Web server.

You can use a standard installation of OCaml to compile your programs. In particular, you do not have to recompile a library to use it with Js_of_ocaml. You just have to link your program with a specific library to interface with the browser API.

Ocsigen-start

Ocsigen-start is a library and a template of Eliom application,
with many common features like
user registration, login box, notification system, etc.