Deploying Your Survey

Preparing to deploy

Before deploying your survey, make sure everything is working locally. You should have done the following:

  1. You have rendered your survey.qmd document and don’t see any errors.
  2. You have locally run your app.R file by clicking the “Run App” button in RStudio or in your R console running the runApp() command and don’t see any errors.
  3. You have set up a database connection to store survey responses (e.g. using a Supabase project) and have already added the database parameters in the sd_database() function in your app.R file (see the Store Data page).
  4. You have set the password for your survey using surveydown::sd_set_password("my_password") using the password you set in the Supabase project (see the Password page).

With these steps completed, you are ready to deploy your survey online.

Tip

To make your app load faster, we recommend you render your survey.qmd file first, then set use_html = TRUE inside the sd_server() function in your app.R file. This will tell surveydown to skip rendering the survey.qmd file when the app launches and to instead use the pre-rendered html file, which will load much faster.

Deploying to shinyapps.io

Deploying your survey is pretty much the same as deploying any other Shiny app.

We recommend using shinyapps.io to host your survey as it is designed to work with Shiny Apps, but you can also use other hosting services such as RStudio Connect or HuggingFace.

Note

You may have deployed other Quarto documents on Quarto Pub before, but this site is only for static websites, so you SHOULD NOT use Quarto Pub for your survey deployment.

To start using shinyapps.io, you’ll need to create an account and follow the basic instructions to set up your sub-domain and authorize your IDE. See more information here.

Once you have your account and sub-domain ready, make sure you have the rsconnect package installed. You should have done this while authorizing your IDE, but in case you didn’t, you can install it with:

install.packages('rsconnect')

Then to deploy your survey, run:

rsconnect::deployApp(appName = "Survey Name")

The tab name of the HTML page is defined by the appName argument.

That’s it! Now you should have your survey site deployed on shinyapps.io. Congratulations! 🎉

Deploying to Other Hosting Services

You can deploy shiny apps to other hosting services. Here are some guides for several other alternatives:

You can also install Posit Connect on your own server, which is the recommended approach for remaining compliant with any security protocols your organization requires.

Back to top