Skip to content
Lara is a lightweight cross-platform C# library for Web UI development with server-side rendering.
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Fixed #33. Added new method for deserialization passing type as param… Jul 11, 2019
support added feedback html files Jun 9, 2019
.gitignore hide inherited members from documentation Jun 20, 2019
LICENSE Create LICENSE May 14, 2019 added gitter channel Jun 27, 2019

Lara Web Engine

Lara is a lightweight, high-performance cross-platform C# library for Web UI development with DOM manipulation and server-side rendering.

The purpose of Lara is to give you full control of the HTML document tree from the server in C#.

  • Cross-Platform: .NET Standard and runs on Windows, Linux, and MacOS.
  • Web UI: Create HTML5 web applications with full control of the DOM tree in C#.
  • Server-side rendering: The server keeps a virtual copy of the page and flushes the modifications to the browser.

Lara can be used to develop either websites or desktop apps with an HTML5 frontend.

The source code contains a sample project that is also available as a separate repository.

We welcome questions and feedback! Our Gitter channel is here and we also have a general feedback form here.

Sample application

To create a web page:

  • Create a class that implements the interface 'IPage'
  • Call LaraUI.Publish(...) to make your page available

Lara uses async/await to allow for high server throughput. If you're new to these, simply follow the examples that return 'Task.CompletedTask' at the end.


namespace SampleProject
    class Program
        static async Task Main()

            // associate home address with code that creates home page
            LaraUI.Publish("/", () => new MyPage());

            // start web server using default settings on a dynamic port number
            var host = await LaraUI.StartServer();

            // write address in console
            string address = LaraUI.GetFirstURL(host);
            Console.WriteLine($"Server listening in {address}.");

            // launch browser tab (alternatively, the user can navigate to the address)

            // wait for termination
            Console.WriteLine("Press Ctrl+C to terminate");
            await host.WaitForShutdownAsync();

    class MyPage : IPage
        int counter = 0;

        public Task OnGet(IPageContext context)
            var button = Element.Create("button");
            var text = new TextNode { Data = "Click me" };
            button.On("click", app =>
                text.Data = $"Clicked {counter} times";
                return Task.CompletedTask;
            return Task.CompletedTask;

Integrating Lara into your existing web server

The example above calls into Lara's StartServer() method to create a default web host.

Alternatively, you can and add Lara as one more service with the following line:


Developing a desktop application

Here you need to choose a tool to load your locally-hosted website inside a desktop window. Some options available:

  • Creating an electron app using electron-cgi (recommended). This seems to be the most resilient way to run a web desktop app. It comes at the cost of having to distribute electron with nodejs.
  • Using Chromely. Currently supports Windows and Linux. Their Windows version based on CefSharp works very well.

How does Lara work?

Whenever the browser triggers a registered event (e.g. click on a button), it sends to the server a message saying that the button was clicked. The server executes the code associated with the event, manipulating the server's copy of the page, and replies a JSON message with the delta between server and client.


We'd love to hear your feedback. Write to us here.

You can’t perform that action at this time.