Code Monkey home page Code Monkey logo

kanban-app's Introduction

Desktop Kanban Board

Look ma, no Electron!

What is this?

This is a web-based Kanban board application, built with Elm and Rust.

The only different from this application and hundred thousands of web-based application out there is: We don't need Electron!.

Instead, it use native WebView (WebKit for Linux/macOS, and MSHTML on Windows), more details see here.

The whole source code in this repository is just a desktop client, which you can actually use for any web-based application.

Note: I maintain my own version of zserge/webview and Boscop/web-view, because I want to add some customized titlebar on macOS, and my code is ugly enough to create a PR on these repos.

Instruction

Step 1: Build the web application

Skip this if you're using an online hosted application from an URL, or building your own app.

Clone the Kanelm application source code from here https://github.com/huytd/kanelm

Follow the instruction in that repo to config your jsonbin.io config, then install the dependencies and build it:

yarn install
elm-package install
yarn build

What you will get is a dist folder, and you only need the dist.js file, copy it to www folder of this repo.

└── www
    └── dist.js

Step 2: Build the desktop application

You gonna need cargo bundle.

Install it, then run:

cargo bundle --release

Now you got it.

Wait, what happened?

Well, the Elm application will be compiled into a single dist.js file, the content of this JavaScript file will be inlined into our Rust source code:

src/main.rs

let html = format!(r#"
    <html>
        <head>
        <link href="https://fonts.googleapis.com/css?family=PT+Sans" rel="stylesheet"> 
        <style>{css}</style>
        </head>
        <body>
        <script>{js}</script>
        </body>
    </html>
    "#,
    css = r#"body { background: #1d1f21; }"#,
    js = include_str!("../www/dist.js"));

The Rust application will then create a new window, contains a webview, load this HTML content into that webview, and that's it.

But Electron did the same thing?

Yeh, but sometimes, all you need is just a webview to display your web application on a desktop. You don't need file system access or automatic update, blah blah, it would be a huge waste to ship your app with >100MB of Chromium and V8 in it.

In fact, this application only uses 0-3% CPU and the bundle size is >800KB on macOS.

kanban-app's People

Contributors

atilacamurca avatar huytd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kanban-app's Issues

Unable to create App on MacOS

I'm trying to execute the following instructions but its failing as missing dist.js in www folder

git clone https://github.com/huytd/kanban-app.git
cd ./kanban-app
cargo bundle --release

Error:

Compiling kanbanapp v0.1.0 (/Users/vipersnh/data/external_apps/kanban-app)                    
error: couldn't read src/../www/dist.js: No such file or directory (os error 2)                  
  --> src/main.rs:25:10                                                                          
   |                                                                                             
25 |     js = include_str!("../www/dist.js"));                                                   
   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                     
                                                                                                 
error: aborting due to previous error                                                            
                                                                                                 
error: Could not compile `kanbanapp`.                                                            

To learn more, run the command again with --verbose.
error: Result of `cargo build` operation was unsuccessful: exit code: 101
~


cargo bundle does not exist

Hello,

Thanks for this effort. However following the example to bundle I get the following error:

error: no such subcommand: `bundle`

	Did you mean `build`?

Is the command correct?
By the way, the output of build for prod is a program that is executed from a console. Is that the expected output?

Regards

The OS X App only displays a window with black background

I built the web app and tested it in Firefox. I added an entry to the board. I then copied dist.js to the kanban-app repo and built the OS X bundle. Upon launching Kanban.app I only get a black window.

Thanks for sharing this! I really can't stand that a super simple app built with Electron weighs 100 MB+.

Suggestion: pure Rust through tether

Really really like this -- but after researching the HiDPI and MSHTML engine (prefer Edge if having to deal with Windows) I stumbled upon tether which seems to be a nearly-pure-Rust version to get a WebView up...

Allow it to be built with just Cargo

I don't know if it's possible and how hard it would be, but I can tell you it would be pretty cool to be able to just cargo install this (or clone it and cargo build it).

Building on Windows: unresolved external symbol webview_set_background_color

When building on Windows shows this message:

cargo bundle --release
   Compiling pkg-config v0.3.11
   Compiling urlencoding v1.0.0
   Compiling bitflags v1.0.2
   Compiling cc v1.0.13
   Compiling fnv v1.0.6
   Compiling webview-sys v0.1.0 (https://github.com/huytd/web-view#55446f00)
   Compiling web-view v0.1.3 (https://github.com/huytd/web-view#55446f00)
   Compiling kanbanapp v0.1.0 (file:///C:/workspace/ws_rust/webview/kanban-app)
error: linking with `C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\link.exe` failed: exit code: 1120
  |
  = note: "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\bin\\amd64\\link.exe" "/NOLOGO" "/NXCOMPAT" "/LIBPATH:C:\\Users\\myuser\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\workspace\\ws_rust\\webview\\kanban-app\\target\\release\\deps\\kanbanapp-70a5735e8a294d4e.kanbanapp0-29c0540dd9b7912980960dda4f918df6.rs.rcgu.o" "C:\\workspace\\ws_rust\\webview\\kanban-app\\target\\release\\deps\\kanbanapp-70a5735e8a294d4e.kanbanapp1-29c0540dd9b7912980960dda4f918df6.rs.rcgu.o" "C:\\workspace\\ws_rust\\webview\\kanban-app\\target\\release\\deps\\kanbanapp-70a5735e8a294d4e.kanbanapp10-29c0540dd9b7912980960dda4f918df6.rs.rcgu.o" "C:\\workspace\\ws_rust\\webview\\kanban-app\\target\\release\\deps\\kanbanapp-70a5735e8a294d4e.kanbanapp11-29c0540dd9b7912980960dda4f918df6.rs.rcgu.o" "C:\\workspace\\ws_rust\\webview\\kanban-app\\target\\release\\deps\\kanbanapp-70a5735e8a294d4e.kanbanapp12-29c0540dd9b7912980960dda4f918df6.rs.rcgu.o" "C:\\workspace\\ws_rust\\webview\\kanban-app\\target\\release\\deps\\kanbanapp-70a5735e8a294d4e.kanbanapp13-29c0540dd9b7912980960dda4f918df6.rs.rcgu.o" "C:\\workspace\\ws_rust\\webview\\kanban-app\\target\\release\\deps\\kanbanapp-70a5735e8a294d4e.kanbanapp14-29c0540dd9b7912980960dda4f918df6.rs.rcgu.o" "C:\\workspace\\ws_rust\\webview\\kanban-app\\target\\release\\deps\\kanbanapp-70a5735e8a294d4e.kanbanapp15-29c0540dd9b7912980960dda4f918df6.rs.rcgu.o" "C:\\workspace\\ws_rust\\webview\\kanban-app\\target\\release\\deps\\kanbanapp-70a5735e8a294d4e.kanbanapp2-29c0540dd9b7912980960dda4f918df6.rs.rcgu.o" "C:\\workspace\\ws_rust\\webview\\kanban-app\\target\\release\\deps\\kanbanapp-70a5735e8a294d4e.kanbanapp3-29c0540dd9b7912980960dda4f918df6.rs.rcgu.o" "C:\\workspace\\ws_rust\\webview\\kanban-app\\target\\release\\deps\\kanbanapp-70a5735e8a294d4e.kanbanapp4-29c0540dd9b7912980960dda4f918df6.rs.rcgu.o" "C:\\workspace\\ws_rust\\webview\\kanban-app\\target\\release\\deps\\kanbanapp-70a5735e8a294d4e.kanbanapp5-29c0540dd9b7912980960dda4f918df6.rs.rcgu.o" "C:\\workspace\\ws_rust\\webview\\kanban-app\\target\\release\\deps\\kanbanapp-70a5735e8a294d4e.kanbanapp6-29c0540dd9b7912980960dda4f918df6.rs.rcgu.o" "C:\\workspace\\ws_rust\\webview\\kanban-app\\target\\release\\deps\\kanbanapp-70a5735e8a294d4e.kanbanapp7-29c0540dd9b7912980960dda4f918df6.rs.rcgu.o" "C:\\workspace\\ws_rust\\webview\\kanban-app\\target\\release\\deps\\kanbanapp-70a5735e8a294d4e.kanbanapp8-29c0540dd9b7912980960dda4f918df6.rs.rcgu.o" "C:\\workspace\\ws_rust\\webview\\kanban-app\\target\\release\\deps\\kanbanapp-70a5735e8a294d4e.kanbanapp9-29c0540dd9b7912980960dda4f918df6.rs.rcgu.o" "/OUT:C:\\workspace\\ws_rust\\webview\\kanban-app\\target\\release\\deps\\kanbanapp-70a5735e8a294d4e.exe" "C:\\workspace\\ws_rust\\webview\\kanban-app\\target\\release\\deps\\kanbanapp-70a5735e8a294d4e.crate.allocator.rcgu.o" "/OPT:REF,ICF" "/DEBUG" "/NATVIS:C:\\Users\\myuser\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\myuser\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\myuser\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/LIBPATH:C:\\workspace\\ws_rust\\webview\\kanban-app\\target\\release\\deps" "/LIBPATH:C:\\workspace\\ws_rust\\webview\\kanban-app\\target\\release\\build\\webview-sys-f87238d888017fad\\out" "/LIBPATH:C:\\Users\\myuser\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\workspace\\ws_rust\\webview\\kanban-app\\target\\release\\deps\\libweb_view-0e33ca75d1b050e9.rlib" "C:\\workspace\\ws_rust\\webview\\kanban-app\\target\\release\\deps\\libwebview_sys-9a659468f203156e.rlib" "C:\\workspace\\ws_rust\\webview\\kanban-app\\target\\release\\deps\\libbitflags-37d75e7fdfc43a2f.rlib" "C:\\workspace\\ws_rust\\webview\\kanban-app\\target\\release\\deps\\liburlencoding-fc442f33cc70a2c8.rlib" "C:\\workspace\\ws_rust\\webview\\kanban-app\\target\\release\\deps\\libfnv-785605adde077827.rlib" "C:\\Users\\myuser\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-2c4933d637650696.rlib" "C:\\Users\\myuser\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-4e84946c98528056.rlib" "C:\\Users\\myuser\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-72b9681bec1030ab.rlib" "C:\\Users\\myuser\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liblibc-e00373028739c601.rlib" "C:\\Users\\myuser\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc_system-0e75458e9a4fb014.rlib" "C:\\Users\\myuser\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-c77aa7bb18318789.rlib" "C:\\Users\\myuser\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd_unicode-134992189f511d68.rlib" "C:\\Users\\myuser\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-6819054bfe8f72ed.rlib" "C:\\Users\\myuser\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-091a0224b9345a0d.rlib" "ole32.lib" "comctl32.lib" "oleaut32.lib" "uuid.lib" "gdi32.lib" "advapi32.lib" "ws2_32.lib" "userenv.lib" "shell32.lib" "msvcrt.lib"
  = note: kanbanapp-70a5735e8a294d4e.kanbanapp0-29c0540dd9b7912980960dda4f918df6.rs.rcgu.o : error LNK2019: unresolved external symbol webview_set_background_color referenced in function _ZN8web_view3run17h8d0792e84c62bc37E
          C:\workspace\ws_rust\webview\kanban-app\target\release\deps\kanbanapp-70a5735e8a294d4e.exe : fatal error LNK1120: 1 unresolved externals


error: aborting due to previous error

error: Could not compile `kanbanapp`.

To learn more, run the command again with --verbose.
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error(Term(NotSupported), State { next_error: None, backtrace: Some(stack backtrace:
   0:     0x7ff7c571453d - <no info>
   1:     0x7ff7c5713960 - <no info>
   2:     0x7ff7c571350c - <no info>
   3:     0x7ff7c57135b3 - <no info>
   4:     0x7ff7c556f661 - <no info>
   5:     0x7ff7c554b5a1 - <no info>
   6:     0x7ff7c55557d6 - <no info>
   7:     0x7ff7c5794c4d - <no info>
   8:     0x7ff7c579e9d2 - <no info>
   9:     0x7ff7c5795344 - <no info>
  10:     0x7ff7c554d62a - <no info>
  11:     0x7ff7c57b05a9 - <no info>
  12:     0x7ffb11671fe4 - BaseThreadInitThunk) })', libcore\result.rs:945:5
stack backtrace:

Any idea about what can be?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.