class: center, middle, front # rig ![redbean](https://user-images.githubusercontent.com/232306/119369453-2fe15900-bc82-11eb-8128-6e7a23c7253e.png) ![chartjs](https://user-images.githubusercontent.com/232306/119369853-a2eacf80-bc82-11eb-9e07-35bda364344d.png) #### _redbean interactive grapher_ #### [github.com/cdrubin/rig](https://github.com/cdrubin/rig) ??? Notes for the _first_ slide! --- # agenda 1. introduction 2. technology choices 3. implementation details 4. demo 5. github access --- # introduction Systems for local use do not need to be Internet scale. The best are reliable, long-lived, easy to deploy and maintain, and fit the needs of the user first! #### _development philosopy_ - size does still matter - the Node ecosystem of modules can be brittle and bundles are outsized - "no need to ship me another browser when i have my own already, thank you!" - docker containers are many layers* of abstraction for repeatability - if i cannot reuse ♲ repeatability is needed #### _learning something new_ - modern Javascript and libraries without bundling or CDN-based modules - minimal proof-of-concept that is fun! - αcτµαlly pδrταblε εxεcµταblε --- # technology choices #### _backend_ - cosmopolitan libc's redbean web server ape - Lua - sqlite (not this version...) ![linux](https://user-images.githubusercontent.com/232306/119369515-438cbf80-bc82-11eb-9c54-2b2f78038377.png) ![windows](https://user-images.githubusercontent.com/232306/119369532-4982a080-bc82-11eb-8695-7bf85647002b.png) ![mac](https://user-images.githubusercontent.com/232306/119369565-50111800-bc82-11eb-96dd-59387228b713.png) ![freebsd](https://user-images.githubusercontent.com/232306/119369586-556e6280-bc82-11eb-871a-725012ea7caa.png) ![netbsd](https://user-images.githubusercontent.com/232306/119369607-5bfcda00-bc82-11eb-98fc-5f0240778f86.png) #### _frontend_ - simple HTML, CSS and Javascript - sqlite as sql.js wasm - yet-another-code-editor (yace) - prism.js - chart.js --- # implementation details #### _backend_ - sqlite csv import - redbean 1.0 - .init.lua launches local browser window to http://localhost:8080 - load.lua and save.lua handlers - all files appended to rig.com zipfile for distribution #### _frontend_ - vanilla Javascript - global variables! - inline CSS and event handlers - locally sourced non-minified Javascript libraries - load sqlite database into browser memory on load - load demo script file on load - execute SQL to populate data variables - execute Javascript to draw the chart --- # demo ![demo](https://raw.githubusercontent.com/cdrubin/rig/764c5a801cf58ea2ef29ee303b5995bbbc32d516/termtosvg_backend.svg) --- # github access The ```rig.com``` [release](https://github.com/cdrubin/rig/releases) file contains ```index.html```, the ```/lib``` directory, the ```sqlite.database```, the ```load.lua``` and ```save.lua``` handlers and .init.lua get open a local browser window when the user runs ```rig.com```. The ```rig``` [repo](https://github.com/cdrubin/rig) contains these constituent files before they were added to that ```rig.com``` zipfile. During development it is super helpful to serve files from the local directory with someting like: ```./rig.com -D .``` ![](https://user-images.githubusercontent.com/232306/119400434-2cf95f00-bca8-11eb-8fd0-1ec0f7379394.png)