Plans for a Shiny Book?

On this page, RStudio has a list of books that are designed to help users get to know RStudio products. Any plans for one on Shiny? I don't know why exactly, but Shiny has always been non-intuitive for me, and I think it would be great to have a book with tutorials and tips, as well as explanations of some of the logic of building apps in this way (& deployment!).
I know there are some books out there -- if RStudio has no plans to produce one, does anyone have any good recommendations?


While I don't know about plans for a book, you could start by checking out the new Shiny Homepage. There are a ton of great tutorials and examples of different uses for shiny. It is a great starting point and should get you started on the right path!

1 Like

There are a couple book on developing Shiny apps on Amazon, but I have not looked into either of them.

Older and maybe not as relevant:

Newer and a bit expensive, though with only three reviews:

A good, modern book on developing, deploying, and maintaining Shiny web applications would be really interesting and probably a very useful contribution to the R community. I also think a good Shiny book would be a beast to write.

In my opinion, that would need to cover more than just how the Shiny web framework works. Ideally, in addition to the many chapters on the various aspects of Shiny itself it would include chapters on:

The Shiny homepage has a ton of useful articles on many of those items and there are a bunch of great tutorials around the web on others. It would probably be beneficial to understand those ideas at a high level from a generic web application standpoint rather than strictly through Shiny, as well.


Those are indeed all very useful topics. But I would probably not include some of them in a shiny book, they're very advanced, I think a shiny book should try to stick to shiny essentials, advanced shiny usage, and venture a bit into related topics. But mentioning caching, load balancing, uptime/usage, even maybe webdev fundamentals seems a bit out of scope. I haven't read any books for similar frameworks in other languages, I wonder how much detail they go into outside of the respective language.


I definitely understand that perspective and for people just starting out in developing Shiny apps you are definitely right. That said, I think the RStudio Shiny website already covers what new Shiny devs very well. So well in fact that I think a book for that purpose is a bit unnecessary, outside the various obvious physical and offline aspect. I haven't seen with hardly anyone I know developing Shiny apps doing the rest of my list, including what I would consider pretty standard like testing and logging. To be clear though, those chapters would mostly be pretty high level/abstract -- more about why, how to get started, and references to other material to go from there. Maybe it could be two books: developing in Shiny; and administering Shiny apps.

My experience with books on other frameworks (only Flask and Django in Python) is that they did contain chapters on design, testing, logging, debugging, and using a SQL or NoSQL backend in addition to the framework specific aspects. They definitely did not cover hosting or caching or CI/CD. The other stuff on my list is generally more about deployment and devops, which I personally think is more important and less scary than most people seem to assume, but why I would want to include them.

1 Like

I'm sure you're not alone in thinking that. I still think all these non-shiny-specific topics can be learned in a book of their own ("fundamentals of web application development"?) rather than forcing them into a shiny book when they've got very little to do with shiny.
Unless there can be a lot of shiny specific tips on these topics, how to turn the theory into practice in shiny, then I would agree with you :slight_smile:

1 Like

Thought through this a bit more and I think you have some really good points. There is a need for a really solid intro, beginner book. I also think there is an unfilled need for a really detailed, advanced book that is also very closely tied to Shiny. Based on those two different, yet complementary needs, I propose:

The Little book should probably cover:

  • how to get setup and started in Shiny
  • how to use html tags for formatting
  • how to add interactive visualizations using external packages like ggiraph or plotly
  • how reactive programming works with a handful of specific apps to build as examples
  • how to design Shiny apps for different purposes like
    • interacting with a dataset to produce data visualizations
    • displaying a live dashboard
    • returning a prediction based on user input

The BIG book would then cover all of the Little book as well as everything I proposed previously with a tight focus on how to do those things with R+Shiny+Shiny Server. I would also want to include other R/Shiny specific topics like trade-offs of using Rmarkdown vs Shiny apps with Shiny Server, using Shiny widgets for file Input/Output, and wrapping javascript libraries for use in R with htmlwidgets.


Awesome suggestions! It's actually the more advanced end I'm interested in, because I'd like to learn more about the underlying logic of an app and the issues with hosting & deploying, using Shiny as a means to learn all that. Like everyone has noted, the Shiny website has great tutorials (@daattali has too on his site -- thanks Dean), but I'd like to delve more into the logic of everything. Like a lot of R users, my background is stars (political science), not web development.

I've been wanting to write a Shiny book, and have spent time on it in fits in starts in the last couple of years. But I've not been able to balance my usual responsibilities with book writing (unlike several of my colleagues who seem to have no trouble pumping out a book a year on top of their normal job).

The current plan is for me to take one more good run at it after rstudio::conf 2018, and if I'm still unable to make real headway, then find a different way to get the Shiny book that's in my head, down on paper (i.e. get someone to write it with/for me).

That said, I do think there is much more to Shiny than could be expressed in a single book. While mine might be in the vein of a "Mastering Shiny", there's also room for a "Learning Shiny" (though Chris Beeley's book covers that pretty well from my hazy recollection, and we do have tutorials already) and especially for a "Shiny by Example" or "Shiny Cookbook".


@RobertMyles if it's general web development you're interested in learning, Shiny is maybe not the best vehicle for doing that. Shiny's architecture is quite different than other web frameworks, so you'd have a lot to unlearn if you want to take your Shiny skills and apply them to, say, a Django or Rails back-end.

That said, IMHO general purpose web back-ends are not all that interesting these days for "modern" web apps--all the complexity and interesting bits have moved to the client side with things like React, Redux, and d3, while the web framework mostly speaks JSON. Anecdotally it feels like many people are finding they don't need heavyweight web backend frameworks and are just using lower-level web frameworks like Flask and Express. If you learn those techniques and want to apply them in R, you can look at httpuv, fiery, plumber, OpenCPU, etc.


Thanks for the advice, @jcheng!

I would really appreciate a book on how to use applying standard web tools/approaches to Shiny development.

One of the best pieces of advice I got on how to improve Shiny loading times, courtesy of @jcheng, was to use a CDN to speed up the loading of a large javascript dependency. The large dependency meant that my app loading time took anywhere between 1s-45s.

To diagnose the issue we used Chrome developer tools -> Network tab to identify any slow loading assets. Then to fix it we inserted the following into the UI file.

htmltools::htmlDependency("viz", "99",
src = c(href = ""),
script = "viz.js")

Joe's explanation of why this works - "This will cause viz.js to be loaded from a CDN instead of your Shiny Server. Because it's being served from a static site, it should be cacheable by the browser--it may be equally slow the first time loading but hopefully after that you should get much faster load times."


@jcheng this sounds really promising! Like others have said in this thread, having a book about mastering shiny is a huge need in the community. Personally I've been toying with the idea of writing a case-studies in Shiny themed book. Would be happy to discuss further at rstudio::conf to bounce some ideas around.


@iain FWIW we're investigating performance improvements that should make that technique no longer necessary (by making more htmlwidgets assets cacheable by default). But glad that advice has been helpful to you.

1 Like

Joe, it will be easier if you aim at a one-hundred-page short book on a relatively small topic every year, instead of thinking of the seven volumes of "The Art of Reactive Programming". :wink: I think we have got (more than) enough materials on to write four or five 100-page books. (Actually same thing for -- we need an "official" rmarkdown book, too.)


Thanks @yihui, that's a really good point.

I really dig the new :sparkles: shiny site setup with modules targeted by level and task (that was my interpretation, @mine &or anyone, totally me if I'm mischaracterizing that). The advantage to the bookdown structure, as I see it, is just that there's one place to go to figure out where you might need to go next. (For blogdown, I sometimes forget who used what frameworks in which posts. So, even though there are a bunch of great how-to tutorials for getting up and running with blogdown, I often end up bouncing through a few of them to find the specifics of what someone is asking about, e.g. Hugo w/ Travis on GitHub pages, or something).

I know keeping any of this up to date is no small task (one that surely takes on more gravity when it's coming from inside the house-- by which I mean rstudio :wink:). However, I do think a bookdown-type outline (similar to what @yihui had for early days of blogdown) ith links could be a helpful intermediate step...

Thanks for the feedback @mara. Indeed the goal of the reorganization was to provide a clear pathway for learning Shiny (or figuring out how to do specific things with Shiny).

1 Like

@jcheng, I gotta agree with @yihui here :slight_smile: And perhaps this might help you: writing just a small bit every day can create a momentum which carries itself along. You might get it done quicker than you think :wink: . Perhaps making it public like the R for Data Science and Bookdown (& Blogdown) books are might help. Maybe @yihui and @hadley might have tips with regard to this? 'Cos a good Shiny book would be awesome :smiley:

1 Like

I'll be one of the first to buy! Because my Shiny skills really need it...

1 Like