The SAFE Stack

The SAFE Stack

We're great believers in using F# wherever possible. This need not be confined to server-side backend processes but can also include web programming on the client. That's why we came up with the SAFE stack - a stack of existing open-source F# technologies which can be used together to build cohesive cloud-ready, applications that take advantage of F# features that lead to quicker, lower cost development - even in the browser.

Adopting Javascript industry-standard libraries and frameworks is now within reach of F# developers, allowing teams to reuse existing skills and techniques to create responsive and highly-performant browser applications. Compositional IT are there to help you to start to create compelling and powerful end-to-end applications entirely in F#.

Contact us to find out more.

A flexible stack for F# developers

The SAFE stack provides developers who are already enjoying the benefits with functional programming, and in particular F#, with a flexible stack that provides complete end-to-end solutions for cloud-ready, web-enabled applications using popular and widely-used technologies that use functional programming techniques as first-class citizens.

SAFE is not a prescriptive stack, and will not lock you into any particular library or framework - SAFE offers alternatives at every level of the stack to cater for all teams and vendors.

For those developers who are not familiar with functional programming, or are .NET developers who have not taken the leap to F#, SAFE provides a coherent stack that will get you up and running as quickly as possible whilst leaving you safe in the knowledge that Compositional IT can support you whilst you upskill.

SAFE code sample

Suave for server-side programming

SAFE code sample 1

Use the Suave Model to create applications that favour a functional-first approach for servicing HTTP requests.

Suave model represents a set of functions and combinators that let developers represent the logic of their web application as a set of functions that are composed together. This model offers an excellent way to write simple code using basic F# functions, and then compose them together using Suave's powerful combinators in a stateless manner into complex applications - a great use of F# and FP principles.

No interfaces, no inheritance, and no heavyweight libraries or frameworks needed.

Azure for hosting and services

Use Microsoft Azure to provide the hosting environment for compute, storage and other platform services.

With its wide variety of platform services, rock-solid reliability and low costs, Azure is the perfect platform to build a powerful, flexible system at a low cost that allows your system to shine. Cloud providers such as Microsoft Azure offers a growing number of valuable platform services that can be cheaply and quickly employed and then utilised. These services enable rapid application development and deployment at low cost, with minimal upfront costs.

When coupled with F#'s powerful type system, scripting capabilities and impressive collection of libraries, Azure becomes an even more compelling package.

SAFE code sample 2

Fable for F# in the browser

SAFE code sample 3

Fable is an F# to JavaScript compiler powered by Babel, designed to produce readable and standard code.

Fable is more than simply a library that cross-compiles into Javascript - it behaves as a first-class citizen of both the F# world in .NET and in the Javascript world. So, F# users can use .NET seamlessly, whist Fable also doesn't ignore the Javascript ecosystem, integrating with NPM and Typescript definitions with no runtime overhead. It does all this whilst still taking the time to generate easy-to-read Javascript!

Enjoy the benefits of F# whilst taking advantage of increased reach through browser-based applications.

The Elmish Model for web apps

Use Elmish as an client-side application framework to handle UI interaction.

Instead of models such as Angular JS or JQuery, the Elmish model takes full advantage of the functional programming pattern and avoids developers having to get their hands dirty with direct access to HTML. Making use of Facebook's widely-used React framework, Elmish on F# allows developers to create pure functional applications using the simple model-view-update pattern.

Create user interfaces using a simple pattern that scales from simple samples to complex, interactive applications.

SAFE code sample 4