package sihl

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Sihl is a high-level web application framework providing a set of composable building blocks and recipes that allow you to develop web apps quickly and sustainably. Statically typed functional programming with OCaml makes web development fun and safe.

Things like database migrations, HTTP routing, user management, sessions, logging, emailing, job queues and schedules are just a few of the topics Sihl takes care of.

Let's have a look at a tiny Sihl app in a file called sihl.ml:

module Service = struct
  module Random = Sihl.Utils.Random.Service
  module Log = Sihl.Log.Service
  module Config = Sihl.Config.Service
  module Db = Sihl.Data.Db.Service
  module MigrationRepo = Sihl.Data.Migration.Service.Repo.MariaDb
  module Cmd = Sihl.Cmd.Service
  module Migration = Sihl.Data.Migration.Service.Make (Cmd) (Db) (MigrationRepo)
  module WebServer = Sihl.Web.Server.Service.Make (Cmd)
  module Schedule = Sihl.Schedule.Service.Make (Log)
end

let services : (module Sihl.Core.Container.SERVICE) list =
  [ (module Service.WebServer) ]

let hello_page =
  Sihl.Web.Route.get "/hello/" (fun _ ->
      Sihl.Web.Res.(html |> set_body "Hello!") |> Lwt.return)

let routes = [ ("/page", [ hello_page ], []) ]

module App = Sihl.App.Make (Service)

let _ = App.(empty |> with_services services |> with_routes routes |> run)

Core

module Core = Core

Sihl App

module App = App

Utils & Helpers

module Utils = Utils

Configuration

module Config = Configuration

Logging

module Log = Log

Data

module Data = Data

Web

module Web = Web

CLI Command

module Cmd = Cmd

Scheduler

module Schedule = Schedule

Authorization

module Authz = Authz

Token

module Token = Token

Authentication

module Authn = Authn

Emailing

module Email = Email

Session

module Session = Session

Message

module Message = Message

Storage

module Storage = Storage

User Management

module User = User

Job Queue

module Queue = Queue
OCaml

Innovation. Community. Security.