How Many Shiny Apps Can You Host for Free?

[This article was first published on R - Hosting Data Apps, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

How Many Shiny Apps Can You Host for Free?

Shiny is an incredible piece of technology. The ease of which with you can make simple prototypes or even production-grade applications is unparalleled. All you need is a bit of R skills.

But all this is worthless unless you can present your app to your users. If you are just starting out, you don't need any headaches with deployment. You also probably don't want to pay big bucks for hosting either.

So what are your options for free Shiny app hosting? And how many apps can you host for free?

I ask this question on Twitter and got a bimodal response. Most people (51%) thought you can host 5 apps for free. However, the choice 'As many as you like' was voted second (36%). 9% of respondents thought you cannot host any apps for free.

Free hosting options

By free I mean that the total cost of ownership is $0. You are not paying monthly fees for cloud hosting, and you are not paying licensing fees.

You can use the Shiny Hosting Options table to find all the free options here:

Shiny Hosting Options
Pick the right hosting option for your Shiny app
How Many Shiny Apps Can You Host for Free?

At the time of writing, there are three platforms (PaaS) that offer free hosting:

In principle, you can sign up for each service and use the free tier to host your apps.

Shinyapps.io

This is a fully managed platform for hosting Shiny apps. It is operated by RStudio. You can host up to 5 apps for free. The free tier gives you 25 active hours per month. This is the uptime for the 5 apps combined. Apps are served by instances with 1 GB RAM, and you have a 1 GB upload bundle size limit.

This is the option that most respondents of the Twitter poll likely referred to. Shinyapps.io offers push-button publishing that makes deployment real easy.

The other two platforms are a bit more involved because the Shiny apps need to be containerized first.

Heroku

The Free plan gives your 550 dyno hours per month and 5 free apps. If you verify your Heroku account with a credit card (you will not be charged, unless you use a paid service), you get 1000 free dyno hours, 100 free apps. Apps are running on instances with 0.5 GB RAM. Apps on the Free plan will sleep after 30 mins of inactivity.

Fly.io

Fly offers a Free tier that includes 2,340 hours per month that is enough to run 3 shared 1 CPU virtual machines with 256 MB RAM full time.

Multiple user accounts

In total, 5 + 100 + 3 = 107 apps. Memory per app and available app hours differ among the platforms. But this is a generous amount for a lot of use cases with smaller apps and not a huge demand from the users.

As Harlan A. Nelson pointed out, you can have multiple user accounts, in which case this number can multiply. The Fly docs even encourage this by saying:

if you want to run more free apps, just make another organization and invite your friends

So in this sense, you can host as many apps for free as you like using different email addresses. But if you need larger instances, higher availability, custom domains, etc. you'll have to upgrade to a paid tier sooner or later.

Multiple apps in the same container

If this weren't enough, you can even host multiple Shiny apps in the same container using the Shiny Server-based parent image. The setup is quite simple, just copy multiple apps into the Shiny Server root folder (/srv/shiny-server/), as explained in this repository:

GitHub – analythium/shiny-correlation: Containerized Shiny app with multiple versions
Containerized Shiny app with multiple versions. Contribute to analythium/shiny-correlation development by creating an account on GitHub.
How Many Shiny Apps Can You Host for Free?

Try pulling ad running the Docker image analythium/correlation:v3:

docker pull analythium/correlation:v3

docker run -p 4000:3838 analythium/correlation:v3

You'll find two apps on the following two paths: http://localhost:4000/app2d/ and http://localhost:4000/app3d/. The Dockerfile looks like this:

FROM rocker/shiny:4.0.5

## install dependencies
RUN install2.r -r http://cran.rstudio.com/ rgl

## copy the apps
COPY ./app-v1.R /srv/shiny-server/app2d/app.R
COPY ./app-v2.R /srv/shiny-server/app3d/app.R

USER shiny
EXPOSE 3838
CMD ["/usr/bin/shiny-server"]

In theory, there is no limit to the number of apps you can host simultaneously using this setup.

Conclusions

It turns out that most respondents were right in their own ways because I left many details undefined. Shinyapps.io is the platform that most R and Shiny users are most familiar with. This is due to the RStudio IDE integration and most tutorials pointing to this free option. So that is your 5 free apps.

If you need to host more Shiny apps, sign up with your other email address so get another 5 apps for free. Or learn how to dockerize Shiny apps and deploy to Heroku and Fly.io under the free tier. Fly.io is your best option if you want the apps running 24/7 and under a secured custom domain (none of this is offered for Shinyapp.io and Heroku).

If you run out of email addresses and exhausted all your free apps, you can consider including multiple apps in the same Docker image and deploy these to Heroku and Fly.io. Those who chose  'As many as you like' were probably thinking along these lines. 107 times many times unlimited is a lot!

Further reading

How to Pick the Right Hosting Option for Your Shiny App
You mastered Shiny, your app is production-ready. Here are the different ways of hosting it. This post helps you pick one that best suits your needs!
How Many Shiny Apps Can You Host for Free?

To leave a comment for the author, please follow the link and comment on their blog: R - Hosting Data Apps.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)