Production-level R Shiny App as an R package
Early this year, I was job searching and came across a Shiny developer position that caught my attention. After the first interview, I was given an assignment to create an app providing a concise and visual overview of business sales trends from a given dataset. Sounded like a great challenge, with plenty of room to explore and lots of freedom.
It’s been a few months and I didn’t want my work to go to waste, but I also don’t feel like diving back in with the same intensity. So, I decided to publish a short post with some context and showcase the App on shinyapps.io.
At the time, a friend in the field recommended checking out the golem framework and the book “Engineering Production-Grade Shiny Apps” by Colin Fay, Sébastien Rochette, Vincent Guyader and Cervan Girard. The book is an amazing read - it’s very well-structured, easy to read and navigate, and the concepts are very well explained and clear. I can’t recommend it enough for this type of task.
I applied some of the core concepts, such as:
- Shiny Modules.
- App as a package (following golem’s guidelines).
- Organized code into functions (utils.R, analytics.R, data ingestion, visualization…).
I’m proud of what I achieved, but I also recognize areas where I could’ve done better: - Aesthetics customization took up too much time (design in advance!). - Could’ve reduced the use of global variables. - Should’ve used renv for package and version management