https://github.com/integrativesoft/lara
  
  
    Lara Web Engine is a lightweight C# framework for web user interface development. 
    https://github.com/integrativesoft/lara
  
cross-platform csharp dotnet html5 lara ui web web-components web-development web-services
        Last synced: 7 months ago 
        JSON representation
    
Lara Web Engine is a lightweight C# framework for web user interface development.
- Host: GitHub
 - URL: https://github.com/integrativesoft/lara
 - Owner: integrativesoft
 - License: apache-2.0
 - Created: 2019-05-14T12:38:55.000Z (over 6 years ago)
 - Default Branch: master
 - Last Pushed: 2023-07-19T00:48:53.000Z (over 2 years ago)
 - Last Synced: 2024-05-20T17:45:48.821Z (over 1 year ago)
 - Topics: cross-platform, csharp, dotnet, html5, lara, ui, web, web-components, web-development, web-services
 - Language: C#
 - Homepage:
 - Size: 6.28 MB
 - Stars: 147
 - Watchers: 7
 - Forks: 8
 - Open Issues: 3
 - 
            Metadata Files:
            
- Readme: README.md
 - License: LICENSE
 - Support: support/jetbrains.svg
 
 
Awesome Lists containing this project
- awesome-csharp - Lara - Lara Web Engine is a library for developing Web user interfaces in C# (GUI)
 - awesome-dotnet-cn - Lara - Lara Web Engine 是C#中用于开发Web用户接口的库。 (GUI)
 - awsome-dotnet - Lara - Lara Web Engine is a library for developing Web user interfaces in C# (GUI)
 - fucking-awesome-dotnet-core - Lara - Lara Web Engine is a library for developing Web user interfaces in C# (Frameworks, Libraries and Tools / GUI)
 - awesome-dotnet-core - Lara - Lara Web Engine is a library for developing Web user interfaces in C# (Frameworks, Libraries and Tools / GUI)
 - awesome-dotnet-core - Lara - Lara Web Engine是用于使用C#开发Web用户界面的库 (框架, 库和工具 / 图形用户界面GUI)
 - fucking-awesome-dotnet - Lara - Lara Web Engine is a library for developing Web user interfaces in C# - (Blazor Server-Side Alternative) (GUI / GUI - Framework)
 - awesome-dotnet - Lara - Lara Web Engine is a library for developing Web user interfaces in C# - (Blazor Server-Side Alternative) (GUI / GUI - Framework)
 
README
          ## Lara Web Engine
[](https://github.com/integrativesoft/lara/blob/master/LICENSE) [](https://www.nuget.org/packages/Integrative.Lara/)  [](https://www.nuget.org/packages/Integrative.Lara/)  [](https://travis-ci.org/integrativesoft/lara)  [](https://coveralls.io/github/integrativesoft/lara?branch=master)
==================
**Lara** is a server-side rendering framework for developing **web user interfaces** using C#.
>*"It is similar to server-side Blazor, but is much more lightweight and easier to install. For example, while any type of Blazor requires a whole SDK, Lara is just a NuGet package."* [ScientificProgrammer.net](https://scientificprogrammer.net/2019/08/18/pros-and-cons-of-blazor-for-web-development/?pagename=pros-and-cons-of-blazor)
## Sample application
```csharp
using Integrative.Lara;
using System;
using System.Threading.Tasks;
namespace SampleApp
{
    public static class Program
    {
        public static async Task Main()
        {
            // create and start application
            const int port = 8182;
            using var app = new Application();
            app.PublishPage("/", () => new MyCounterComponent { Value = 5 });
            await app.Start(new StartServerOptions { Port = port });
            // print address on console
            var address = $"http://localhost:{port}";
            Console.WriteLine($"Listening on {address}/");
            // helper function to launch browser (comment out as needed)
            LaraUI.LaunchBrowser(address);
            // wait for ASP.NET Core shutdown
            await app.WaitForShutdown();
        }
    }
    internal class MyCounterComponent : WebComponent
    {
        private int _value; // triggers PropertyChanged event
        public int Value { get => _value; set => SetProperty(ref _value, value); }
        public MyCounterComponent()
        {
            ShadowRoot.Children = new Node[]
            {
                new HtmlDivElement() // on PropertyChanged, assigns InnerText
                    .Bind(this, x => x.InnerText = Value.ToString()),
                new HtmlButtonElement
                    { InnerText = "Increase" }
                    .Event("click", () => Value++)
            };
        }
    }
}
```
## Adding Lara to an existing web server application
To add Lara to an existing ASP.NET Core server, add to the Startup class or equivalent:
```csharp
private readonly Application _laraApp = new Application();
public void Configure(IApplicationBuilder app)  
{  
    app.UseLara(_laraApp, new LaraOptions
    {
        // configuration options
    });
} 
```
## Creating Desktop applications
To create a desktop container for your web app, here's a few options:
- [electron.js](https://www.electronjs.org/) combined with [electron-cgi](https://github.com/ruidfigueiredo/electron-cgi#readme) library
- [Chromely](https://github.com/chromelyapps/Chromely)
- [neutralinojs](https://github.com/neutralinojs/neutralinojs)
## Getting started
There's no need to download this repository to use Lara, instead, there's a [NuGet package](https://www.nuget.org/packages/Integrative.Lara/).
**Check out the [wiki documentation](https://github.com/integrativesoft/lara/wiki)**
## 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.
## How to contribute
**Please send feedback!** Issues, questions, suggestions, requests for features, and success stories. Please let me know by either opening an issue. Thank you!
**If you like Lara, please give it a star - it helps!**
## Credits
Thanks to [JetBrains](https://www.jetbrains.com/?from=LaraWebEngine) for the licenses of Rider and DotCover.
[](https://www.jetbrains.com/?from=LaraWebEngine)