> For the complete documentation index, see [llms.txt](https://hmdc.gitbook.io/r/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hmdc.gitbook.io/r/deploy/devlocalwithrstudio.md).

# Developing locally with RStudio

You can use RStudio to develop your Shiny application, whether starting a new application or migrating an already existing application. Follow these tips to ensure your RStudio workflow is optimized for Shiny on Heroku.

## Creating a new project

### From GitHub

If you cloned the [heroku-docker-r-example-app](https://github.com/hmdc/heroku-docker-r-example-app) as a template, when creating a new project in RStudio select *Version Control*

![When creating a new project, select project from version control.](https://2195695945-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lt_1GefQ_nEYQAi8Gwz%2F-Ltfl3xl4PUkUGgoGj8W%2F-LtflOtswVulafhLuTe8%2Fselect-version-control.png?generation=1573766617909544\&alt=media) ![Enter the details of your Git repository](https://2195695945-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lt_1GefQ_nEYQAi8Gwz%2F-Ltfl3xl4PUkUGgoGj8W%2F-LtflOtuwc391cSx0fA0%2Fclone-git-repo.png?generation=1573766618112615\&alt=media)

### Enable Packrat

Click **Tools** → **Project Options** → **Packrat**.

Make sure that the following checkboxes are all selected. This will speed up your deployment process after the initial deploy.

* ✔️ Use packrat with this project
* ✔️ Automatically snapshot local changes
* ✔️ Git ignore packrat library
* ✔️ Git ignore packrat sources

![Your Packrat options should look like this](https://2195695945-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lt_1GefQ_nEYQAi8Gwz%2F-Ltfl3xl4PUkUGgoGj8W%2F-LtflOtwhPz6mooFlPa8%2Fpackrat-options.png?generation=1573766617897658\&alt=media)

### From scratch

When creating a project from scratch in RStudio, make sure the following options are selected.

* ✔️ Create a git repository
* ✔️ Use packrat with this project

![Your project options should look like this](https://2195695945-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lt_1GefQ_nEYQAi8Gwz%2F-LtfxdcYTXxkwAB5qoEU%2F-LtfxeYTUpipol6L1Bip%2Fproject-options.png?generation=1573769358809424\&alt=media)

## Migrating an existing project

Open your project normally as you would through RStudio and enable Packrat, following the above instructions for enabling Packrat support in a project.
