Top F# Backend Web Frameworks in 2023

Date: 2023-02-02 | fsharp | web | frameworks | backend


In this post we're going to be comparing and ranking the top F# frameworks for backend web development.

Methodology

Candidates

For this comparison, we're going to implement some requirements to help narrow the field and ensure we get good signal:noise.

Candidate Requirements

  • Functional-first - so we get the most out of F#
  • Backend framework (with benchmarks) - Backend is where I have most experience and recommend F# for
  • "officially endorsed" by the F# Foundation (fsharp.org) - some agreed upon levels of trust (see: Web Programming with F#)
  • Active development - so you don't build yourself into a dead end

Candidate frameworks that fit all these requirements narrows our list quite a bit:

F# Backend Framework Candidates

Notable omissions:

  • Frontend Frameworks: Fable, Bolero, etc
  • Backend Frameworks:
    • ASP.NET Core - Most things run on top of this and it's not functional-first
    • ServiceStack - A lot of things, but functional-first does not seem like one of them

Comparisons

In order to compare and rank candidate frameworks, we're going to use a few proxy measures for performance and usage. This is less comprehensive than individual, direct reviews of each framework but it's also a lot more concise and in some ways a bit more objective. I would still encourage you to take a look at each but this will give a good survey of the landscape.

The first category we'll be looking into is usage. This is generally a proxy for technology adoption and how much you can trust ongoing support.

  • GitHub Stars - A proxy for interest
    • Risks: Doesn't necessarily mean people are actually using it
  • Downloads (Nuget) - A proxy for actual usage
    • Risks:
      • may skew high if used in large deployments
      • may skew low if packages aren't used directly from Nuget

The second category is performance. Performance is rarely the most important thing in your app and performance benchmarks are filled with asterisks but it's definitely something you want to be aware of so it doesn't bite you later on.

Framework Results

Now that we've got our experiment setup, let's crunch some numbers.

Performance

Requests / Second (via Web Frameworks Benchmark)

  1. Falco - 120711
  2. Giraffe - 119423
  3. Saturn - 100916
  4. WebSharper - 84785
  5. Suave - 42743

Falco wins out but is closely followed by Giraffe and then Saturn. While Falco is a newer framework it's done well in many different kinds of benchmarks.

Note: Suave scores surprisingly low in performance which may indicate something's wrong with the benchmark though it also performs poorly in TechEmpower - Plaintext so could just be slow. I noticed a similarly weird result in Giraffe which led to: Improving F# / Giraffe web benchmarks by 6.56x

F# Frameworks - GitHub Stars vs Performance

F# Frameworks - GitHub Stars vs Performance

Usage - GitHub

GitHub Stars:

  1. Giraffe - 1900
  2. Suave - 1300
  3. Saturn - 671
  4. WebSharper - 514
  5. Falco - 423

Giraffe and Suave are by far the most starred projects on GitHub. Saturn is in third which makes sense as it's in many ways a simplified version of the other two, built on top of Giraffe.

F# Frameworks - Nuget Downloads vs Performance

F# Frameworks - Nuget Downloads vs Performance

Usage - Nuget Downloads

Nuget Downloads (per month)

  1. Suave - 22410
  2. Giraffe - 18750
  3. WebSharper - 6300
  4. Saturn - 4140
  5. Falco - 720

Suave and Giraffe again take the top spots with far more downloads than the other candidates combined. WebSharper comes in third but it's unclear if all of this is coming from F# usage or some C# usage.

Top Frameworks 2023

Now that we have all the data, we can tabulate the top F# backend web frameworks for 2023.

Best F# Backend Web Frameworks:

  1. Giraffe - Giraffe is all-around well-used and boasts great performance. It serves as a great foundation for any backend web service and is my choice for most projects (see: Up and Running with CloudSeed (F# / SvelteKit boilerplate))
  2. Suave - Suave is well-used but doesn't hold up under performance tests. If performance is not a concern then Suave is probably fine for small usecases.
  3. Saturn - Saturn scores well across the board and since it's built on Giraffe you can also drop down a layer for extra capabilities / performance.
  4. Falco - Falco is still a new comer and thus doesn't have the adoption you're probably looking for in a production library. That said, it has consistently been performing well on benchmarks and has a small devoted following so may rise the ranks in a few years.
  5. WebSharper - Okay results, used by some - though many of those users may be on the C# side of things.

Conclusion

F# is my favorite general purpose programming language and is my go-to for building new projects / businesses. If I had to recommend one framework I would rec Giraffe but any of these frameworks should give you a decent start.

If you're interested in getting started with F# and Giraffe, you might be interested in these posts:

-