Why WebSharper
One language across the whole stack
Write your reactive UI, your server endpoints and the types they share in a single F# codebase. WebSharper compiles it to a native .NET server and a JavaScript client that stay in sync — with typed calls instead of hand-written fetch and JSON glue.
Reactive values
A single Var is the source of truth, bound two-way to the DOM. Derived views recompute on their own when it changes, and the page updates in place — no virtual DOM and no DOM diffing needed.
Learn moreType-safe JS bindings
Describe a JavaScript library once, then use it from F# with full type checking — no hand-written interop, no any. Here the Leaflet map library is bound and the client fills the index.html template's holes.
Learn moreType-safe HTML templating
Use HTML templates to keep your logic and UI clearly separate and facilitate the collaboration between programmers and designers.
Learn moreType-safe remoting
Seamlessly call server-side asynchronous functions from the client side.
AJAX call, JSON serialization... Everything is handled automatically.
Web APIs and server-side JSON and HTML
Declare your URLs as a C# or F# endpoint type, and WebSharper handles the dispatch. Create safe internal links from endpoint values.
You can share the same rendering code and templates between the server and the client.
Automatically parse JSON requests and generate JSON responses based on your types.
Client-side routing
Write SPAs with the same routing API on the client side as you would use on the server side.
Learn moreModel-View-Update architecture with WebSharper.Mvu
Structure client-side applications with clear separation of concerns between logic and display. Based on WebSharper.UI, Mvu brings Elm-like architecture to WebSharper.
Learn moreUse powerful language constructs on the client side
F#: Query expressions, async workflows, sequence expressions...
C#: LINQ queries, asynchronous Tasks, generators...
Build React components
You can also use widespread libraries such as React to build applications. The syntax is as convenient as JSX, with the added benefit of strong typing.
Learn moreMetaprogramming
Source Code Generators
Write high-level specifications in F# (Warp) and let WebSharper generate the optimized boilerplate for you.
template Main "index.html"
endpoint Home "/" return Main
namespace MyApplication
open WebSharper.Sitelets
type EndPoint =
| [<EndPoint "/">] Home
namespace MyApplication
open WebSharper.UI.Templating
[<JavaScript>]
module UI =
type MyTemplate = Template<"index.html">
let Main = MyTemplate().Doc()
Interactive Explorer
template Main "index.html"
endpoint Home "/" return Main
namespace MyApplication
open WebSharper.Sitelets
type EndPoint =
| [<EndPoint "/">] Home