package sihl

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

Module SihlSource

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)

Sihl App

Sourcemodule App = App

Authentication

Sourcemodule Authn = Authn

Authorization

Sourcemodule Authz = Authz

CLI Command

Sourcemodule Cmd = Cmd

Configuration

Sourcemodule Config = Configuration

Core

Sourcemodule Core = Core

Data

Sourcemodule Data = Data

Emailing

Sourcemodule Email = Email

Logging

Sourcemodule Log = Log

Message

Sourcemodule Message = Message

Job Queue

Sourcemodule Queue = Queue

Scheduler

Sourcemodule Schedule = Schedule

Seed

Sourcemodule Seed = Seed

Session

Sourcemodule Session = Session

Storage

Sourcemodule Storage = Storage

Token

Sourcemodule Token = Token

User Management

Sourcemodule User = User

Utils & Helpers

Sourcemodule Utils = Utils

Web

Sourcemodule Web = Web
OCaml

Innovation. Community. Security.