

GitHub - Zaid-Ajaj/desktop-feliz-with-photino
source link: https://github.com/Zaid-Ajaj/desktop-feliz-with-photino
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Feliz on Desktop with Photino (Experimental)
Build a desktop application by embedding a small full stack F# web application in it with the help of Photino.
Phontino hosts a lightweight chromium instance in a desktop window and this application embeds a full web application in it.
Using Suave as a mini embedded web server for the backend and Feliz/React on the frontend.
The frontend communicates with the backend via HTTP to access system APIs that are otherwise unavailable from the browser window.
The data transport between client and server is fully type-safe thanks to Fable.Remoting
Here is a gif of the application running during development. Notice how things like hot module reloading work out of the box so that we can edit the UI code and you see the changes immediately without having to reload the application.
If you want, you could develop the application in the browser by simply navigating to
http://localhost:8080
but it's better to see how it looks like in the desktop window.
Dependencies
The dependencies need are the .NET SDK (v5.0+) and Node.js (v12+)
When developing on Windows 10, the Edge Dev Channel version needs to be installed from Microsoft Edge Insider to be able to view the browser
Development
Before doing anything, start with installing npm dependencies into the client using npm install
.
Then to start development mode with hot module reloading, run:
npm install # Get dependencies used, like webpack npm start
This will start the development server after compiling the project, once it is finished, navigate to http://localhost:8080 to view the application .
While the frontend is running, go the ./Desktop
and run the application in debug mode using
dotnet restore
dotnet run
This will do two things:
- Runs a Suave backend in the background on port 5000 (API for the frontend)
- Opens a Photino window navigating to localhost:8080 which is where the frontend is being hosted
Build and package the application
The Build
project includes a couple of build targets to package up the application.
cd ./Build # windows dotnet run -- build-win64 # linux dotnet run -- build-linux64 # macOS dotnet run -- build-osx64
You will find the application packaged inside the directory
Windows -> {root}/Desktop/bin/Release/net5.0/win10-x64/publish
Linux -> {root}/Desktop/bin/Release/net5.0/linux-x64/publish
MacOS -> {root}/Desktop/bin/Release/net5.0/osx-x64/publish
Feel free to extend the packaging function yourself:
let buildFor(runtime: Runtime) = let releaseMode = Release Dotnet.Publish(desktop, [ Dotnet.Configuration(releaseMode) Dotnet.Runtime(runtime) Dotnet.SelfContained() Dotnet.PublishSingleFile() ]) Npm.Install(solutionRoot) Npm.Run("build", solutionRoot) let clientTarget = path [ desktop; "bin"; releaseMode.Format(); "net5.0"; runtime.Format(); "publish"; "wwwroot" ] Copy.DirectoryFrom(clientDist).To(clientTarget) // Windows buildFor(Runtime.Win10_x64) // Linux buildFor(Runtime.Linux_x64) // macOS buildFor(Runtime.Osx_x64)
Recommend
-
11
Feliz.Snabbdom Use Snabbdom in Fable/Elmish apps with a Feliz-like API (see differences with Feliz), as an alternative...
-
18
README.md Feliz.Engine.Bulma An F# implementation of Bulma layered on top of Feliz.Engine,...
-
30
Feliz Binding for ReactFlow (https://reactflow.dev/) Installation Install the nuget package dotnet paket add Feliz.ReactFlow and install the npm package
-
6
Feliz.Engine Feliz.Engine provides an abstract API based on the great work by Zaid Ajaj and contributors with Feliz that can be implemented for different applications using F# to decla...
-
15
Feliz.ViewEngine.Htmx A library that allows using Htmx attributes with Feliz.ViewEngine Install from Nuget dotnet add...
-
13
Femto Femto is CLI tool that manages the npm packages used by Fable bindings. It installs them using the npm package manager that you are using whether that is npm...
-
11
Reliable Client Server Data Transport for F# web applications - Zaid Ajaj - NDC Oslo 2021419 viewsMar 1, 202222DislikeShareSav...
-
5
Zaid-Ajaj/pulumi-schema-explorer: Web application and UI to explore Pulumi schemas Skip to content...
-
13
Comments Owner Many changes have been happening across the
-
8
Photino是什么 Photino是一组使用Web (HTML/CSS/JavaScript)UI创建桌面应用程序的技术。TryPhotino.io 维护 .NET 构建,并鼓励社区开发 Photino.Native 控件以用于其他语言和平台。我们鼓励并将支持Phot...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK