Slide 1

Slide 1 text

Engineering Production-Grade Shiny Apps with {golem} Colin Fay / Vincent Guyader - ThinkR Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 1 / 26

Slide 2

Slide 2 text

Colin FAY Data Scientist & R-Hacker at ThinkR. Vincent Guyader ThinkR Founder & CTO, Data Scientist, R expert. Find us on the web http://thinkr.fr http://rtask.thinkr.fr http://github.com/thinkr-open http://twitter.com/thinkr_fr $ whoami Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 2 / 26

Slide 3

Slide 3 text

ThinkR Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 3 / 26

Slide 4

Slide 4 text

Data Science engineering, focused on R.  Training  Software Engineering  R in production  Consulting ThinkR Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 4 / 26

Slide 5

Slide 5 text

What's a "prod-ready" software?  Has meta-data  Is divided in functions  Is tested  Lists requirements  Is documented Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 5 / 26

Slide 6

Slide 6 text

What {shiny} devs claim: Reality: Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 6 / 26

Slide 7

Slide 7 text

Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 7 / 26

Slide 8

Slide 8 text

Here comes {golem} {golem} is an R package that contains a framework for building production-ready Shiny Applications. Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 8 / 26

Slide 9

Slide 9 text

Q & A What do you like the most? Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 9 / 26

Slide 10

Slide 10 text

Q & A What do you like the most? A: Work on building data manipulation, visualisation, and models Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 9 / 26

Slide 11

Slide 11 text

Q & A What do you like the most? A: Work on building data manipulation, visualisation, and models B: Spend 15 minutes on checking that you've correctly copied and pasted a Shiny Module skeleton Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 9 / 26

Slide 12

Slide 12 text

Why {golem}? Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 10 / 26

Slide 13

Slide 13 text

Why {golem}?  If you have to copy and paste a piece of code more than twice, write a function Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 11 / 26

Slide 14

Slide 14 text

Why {golem}?  If you have to copy and paste a piece of code more than twice, write a function  If you have to copy and paste an infrastructure more than twice, write a framework Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 11 / 26

Slide 15

Slide 15 text

Why {golem}? Why using {golem}?  Automation is gold  Sharing is caring  Collective intelligence Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 12 / 26

Slide 16

Slide 16 text

 Has meta-data  Is divided in functions  Is tested  Lists requirements  Is documented DESCRIPTION R/ tests/ NAMESPACE man/ & vignettes {golem} central philosophy Shiny App As a Package What's a "prod-ready" Shiny App? Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 13 / 26

Slide 17

Slide 17 text

And the cool thing... Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 14 / 26

Slide 18

Slide 18 text

golex ├── DESCRIPTION ├── NAMESPACE ├── R │ ├── app_config.R │ ├── app_server.R │ ├── app_ui.R │ └── run_app.R ├── dev │ ├── 01_start.R │ ├── 02_dev.R │ ├── 03_deploy.R │ └── run_dev.R ├── inst │ ├── app │ │ └── www │ │ └── favicon.ico │ └── golem-config.yml Standard things DESCRIPTION, NAMESPACE, man/ R/ app_server & app_ui: Shiny UI and Server run_app: launches your app dev/ 0._.*.R: scripted worflows run_dev.R: relaunches your app while developing Understanding {golem} Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 15 / 26

Slide 19

Slide 19 text

Wait... Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 16 / 26

Slide 20

Slide 20 text

Build golem::add_module() golem::add_css_file() golem::add_js_handler() golem::use_favicon() Deploy golem::add_rstudioconnect_file() golem::add_shinyappsio_file() golem::add_shinyserver_file() golem::add_dockerfile() Automation with {golem} Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 17 / 26

Slide 21

Slide 21 text

Template files (and where to put them) golem::add_module( name = "my_module.R" ) ✓ File created at R/mod_my_module.R Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 18 / 26

Slide 22

Slide 22 text

Template files (and where to put them) ... #' @importFrom shiny NS tagList mod_my_module_ui <- function(id){ ns <- NS(id) tagList( ) } #' @noRd mod_my_module_server <- function(input, output, session){ ns <- session$ns } ## To be copied in the UI # mod_my_module_ui("my_module_ui_1") ## To be copied in the server # callModule(mod_my_module_server, "my_module_ui_1") Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 19 / 26

Slide 23

Slide 23 text

What's next All WIP and ideas are currently listed at https://github.com/ThinkR-open/golem/issues Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 20 / 26

Slide 24

Slide 24 text

What's next golem 0.2.0 — CRAN release candidate Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 21 / 26

Slide 25

Slide 25 text

What's next? Spread the word (and share stickers): tweets, blog posts, talk to your friends and family about {golem} Open issues when you encounter a bug Give feedback about things you might find weird Open issue if you have idea / feature requests Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 22 / 26

Slide 26

Slide 26 text

What's next? Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 23 / 26

Slide 27

Slide 27 text

golemverse.org Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 24 / 26

Slide 28

Slide 28 text

connect.thinkr.fr/engineering-shiny/ Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 25 / 26

Slide 29

Slide 29 text

Thx! Questions? Colin Fay & Vincent Guyader Colin FAY (@_ColinFay) - https://rtask.thinkr.fr 26 / 26