What is the interest of the 'golem' package?


The 'golem' package:

  • provides a function to create a CSS file in the www folder => I prefer to create it manually

  • provides a function to fill the DESCRIPTION file => one can fill it directly, no interest

  • provides a command to build the package => I prefer to click on a button in RStudio

  • etc.

So, am I missing something? What is the interest of 'golem'? Why is it described as a package to build robust shiny apps? I don't see what is more robust with 'golem'.

I am familiar with R packages and I find it is easier to not use 'golem' and its myriad of functions. And on the other hand, I think someone not familiar with R packages will not understand what he/she does if he/she uses 'golem'.

But maybe I'm missing something and you will enlighten me :slightly_smiling_face:

Hey there,

Here are some thoughts about this:

  • You can add the CSS yourself manually, indeed. But for example for the JavaScript handlers, there is no "empty template" by default but {golem} provides one for you. Otherwise, you need to go to Shiny - Communicating with Shiny via JavaScript and copy and paste code.

  • Same goes for golem::add_module(), a function that provides both a module skeleton and a testing skeleton. Without these function, you'd have to copy and paste code from the internet, and remove parts of it to make it work. As someone who write a lot of shiny modules, that function has saved me a lot of time AND a lot of typos from copying and pasting stuff.

  • Conventional names and structure : {golem} tries to enforce you to follow a specific development pattern, so for example whenever I receive a {golem} app to debug, or I'm taking over a project from one of my colleage, I know exactly what the file contains and where to look for things. The good thing with {shiny} is that it will allow to build an "unstructured project" and the app still works on your machine, but it's basically a nightmare maintaining multiple apps that do not follow conventions.

  • Production / dev configuration: {golem}, with the golem-config.yaml file, has a standard way to define production and development vars and value

  • etc...

I know that it feels that there are a lot of things inside {golem} and that at the end of the day you could do it manually BUT as someone once said:

Everything that can be automated should be automated

And at the end of the day this is really what {golem} is about: standardization and automation, so that you can safely work on your app with your colleagues and with yourself in 6 months, and so that you don't waste time doing things that can be done in a safer and automated way, like the module addition, which I think is the greatest example of what {golem} tries to do: before {golem}, you had to go to Shiny - Modularizing Shiny app code, copy the code, create a file at the correct place, name it in a correct way so that you know it's a module, paste the code, remove the code that you don't need, rename the functions with the correct name, and start working on your module. Which is a recipe for disaster on the long run :slight_smile:

So, to sum up: yes, you can do everything manually, for example you could use R in the command line, but you use RStudio button because you feel that it's easier and safer :wink: If your goal is to write "quick and dirty" app that will never be sent to production or that aims at being maintained over a long period, you probably don't need {golem}, but as soon as you're working on a "serious" app, it's safer to go with it.


and when your app is ready, clean and tested, golem can create for you the Dockerfile you need for deployment

@saturne do you type your R documentation with LateX or do you use {roxygen2} ? do you use {usethis} or {devtools} for package developpement ?

There are no wrong answers to these questions, but as said, what can be automated must be automated :slight_smile:


1 Like

Thanks. I will continue to experiment.

@vincent I don't use devtools and usethis, except:

  • devtools for CRAN checking and CRAN release

  • usethis::use_tidydescription and usethis::use_github_action

I don't need a template for my JS files :slight_smile: I practice Shiny since its beginning, so I know.

I don't use convention names for my functions (yet). When developing a Shiny app, I start by doing a package without Shiny app, that can be used without Shiny. Then I develop the Shiny app, using the functions of the package.

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.