Workflow for maintaining different versions of a Shiny app

Lately I have been making several very similar Shiny apps for different clients and hosting them on shinyapps.io.

Each app has a different title, different data, some differences in branding etc. but otherwise the code is very similar.

  • git partial pull
  • Can't checkout other branch's with Git
  • what does subproject commit mean?
  • How to Tell Engine Yard to Not Delete a File in the .gitignore
  • Private Git on OpenShift
  • Triggering Jenkins build on both new tags & commits
  • I’m having trouble maintaining these apps. When find and fix a bug I currently have to go through 5 different apps and make the change each time.

    Does anyone have good suggestions on how to handle this? Git branches? I know the best solution would be to have one app and upload different data, but that’s not possible unfortunately.

    I’d like to keep using shinyapps.io, but I’m open to hosting the apps somewhere else if it makes my workflow better.

  • Compiling renderscript source code
  • git commit as different user without email / or only email
  • How can I move all git content one-level up in the folder hierarchy?
  • Difference between 'rebase master' and 'rebase --onto master' from a branch derived from a branch of master
  • Whats the best way to work with Github and multiple computers?
  • How to delete stash by commit sha
  • 2 Solutions collect form web for “Workflow for maintaining different versions of a Shiny app”

    As I wrote in the comment shinyModules() will help you: https://shiny.rstudio.com/articles/modules.html

    Shiny modules are to shiny functions, like ordinary functions are to repeating code.

    Or to put it differently:

    • Repeating code –> function
    • repeating shiny function –> shiny module

    As the documentation is a bit complicated here and there, i wrote a simplified example here:
    Create a reactive function outside the shiny app.

    You could store all the shiny modules in a file modules.R and add a global.R script to each of the apps that loads the modules (source("../modules.R"). Then you only have to update the functions within modules.R. That change of structure might take a while in the beginning. But, i think in the long run it pays off for more complex apps.

    I ended up making a library that contained most of the code I needed for the apps, as suggested by Adam Spannbauer in the comments.

    It’s not perfect; I still have some duplication and I have to have the library on GitHub so that it will work with shinyapps.io. However, it’s a big improvement on what I was doing previously.

    Git Baby is a git and github fan, let's start git clone.