United Kingdom: +44 (0)208 088 8978

Why we love SAFE Stack – series overview

Matt announces an upcoming blog series: why we love SAFE Stack

We're hiring Software Developers

Click here to find out more

It's no secret that we love SAFE Stack at Compositional IT, and we're not alone. But it struck me recently that we could do better at communicating why that is. In the next few weeks and months, we'll release a series of posts that address exactly that 🚀

Topics that we'll cover

In order to meet our aim of conveying why we love SAFE Stack, the posts will be high level and focus on the motivations behind the libraries/tools. Of course, we'll link to further reading if you want to dive deeper. Here's a taster of what we'll discuss.


We'll kick off with Fable.Remoting and how it can help you avoid client-server communication headaches.

type ITodosApi = {
    getTodos: unit -> Async<Todo list>
    addTodo: Todo -> Async<Todo>

Giraffe and Saturn

Next on the list is a post about Giraffe and Saturn. We'll discuss how you get the benefits of ASP.NET Core with more clarity and simplicity than alternative approaches.

let webApp =
    choose [
        GET >=>
            choose [
                route "/" >=> redirectTo false "/users"
                route "/users" >=> Users.handleGet
                routef "/users/%i" Users.Single.handleGet
                routef "/users/%i/account-management" Users.Single.AccountManagement.Get.handle
        POST >=>
            choose [
                routef "/users/%i/account-management" Users.Single.AccountManagement.Post.handle
        setStatusCode 404 >=> text "Not Found"


Of course, one of the things that we love about SAFE Stack is F#! We'll highlight a few things that make F# great.

Fable and Feliz

With Fable and Feliz you can compile F# to JavaScript and interop with the React ecosystem, which is very powerful! Elm-inspired patterns fit well with F# and make front-end state easy to reason about.

let Component () =
    React.useElmish (init, update) ||> View.view

FAKE and Farmer

With SAFE Stack, not only do you use F# for client and server code, you use it for your build script and declarative infrastructure-as-code too!

Target.create "Azure" (fun _ ->
    let web = webApp {
        name "SAFE-App"
        operating_system OS.Linux
        runtime_stack (DotNet "8.0")
        zip_deploy "deploy"

    let deployment = arm {
        location Location.WestEurope
        add_resource web

    deployment |> Deploy.execute "SAFE-App" Deploy.NoParameters |> ignore)

This makes deploying your app as easy as running dotnet new Azure!

What you can expect to get from the series

If you're new to SAFE Stack you'll get an overview of the whole stack and discover some reasons why you should consider it for your next web app 💡 If you're a SAFE Stack novice you'll get a deeper understanding of the constituent parts and how they fit together 🤓 If you're a SAFE Stack enthusiast you'll have a new resource that you can share to convince others! Perhaps you'll also learn a bit more about why you love SAFE Stack too 🙂

We're excited to get started and hope that you enjoy the ride!