Will the shiny app work only if we keep the code running in background in RStudio?




While trying a tutorial on shiny in R and I used the following code to just build a basic app template


and I get this

Listening on

and a new window with a blank app page which I can even open in a browser. But it runs only until we don’t press the stop button or press Esc. Does this mean that if we build a shiny web app, we would always need a computer with some R code running in the background always?
Or we can save the app on some server or something and keep it running?



yes you can run it on some server see this

also look at RStdudio and configure it for that. Just go tools and configure publishing with your login details at http://www.shinyapps.io


Hi Ajay,
I am facing a problem, where my shiny app is working fine locally, but when i publish it on shineyapp.io an empty page comes up with greyed area. i came across that it is due to working directory while checking logs
below error showing in logs
2015-12-01T02:31:44.282382+00:00 shinyapps[71490]: Error in setwd(“https://psdhillon.shinyapps.io/ts_shiny”) :
2015-12-01T02:31:44.282384+00:00 shinyapps[71490]: cannot change working directory

As i have tried few things, but i am unable to get across this little but very important step. Can you please guide me on this. the working directory which i need to mention in server.R should be the app directory where i have placed my data file, server file & ui file. right, tried this. but no success, plz help



It seems that you want to use other directory that the one allowed when you push to shiny.io.
You should keep in mind that your data should be in the subdirectory data that the images you use should be under the subdirectory images. Both directory should be below the server.R ui.R.
Hope this help.