Need help with servr?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

220 Stars 31 Forks 333 Commits 8 Opened issues


A simple HTTP server in R

Services available


Need anything else?

Contributors list


R-CMD-check CRAN downloads from the RStudio mirror <!-- badges: end -->

A simple HTTP server to serve files under a given directory based on the httpuv package.

You can install this package from CRAN (stable version) or XRAN (development version):

install.packages('servr')  # stable version; use a CRAN mirror, or
install.packages('servr', repos = '')  # devel version

This package is licensed under GPL.

Serve static files

To some degree, this package is like

python -m SimpleHTTPServer
python -m
. It may be used to serve:

You can either run

in an interactive R session, or run from command line:
# default: port 4321, do not launch browser
Rscript -e "servr::httd()"

open a web browser

Rscript -e "servr::httd()" -b

listen on port 4000

Rscript -e "servr::httd()" -p4000

pass arguments to the httd() function

Rscript -e "servr::httd(,4000,TRUE)"

There is also a shell script under

system.file('bin', package = 'servr')
; if it is added to
, you can simply run
servr  # serve the current directory
servr -b  # launch the browser
servr -b -p4000  # change port to 4000

Serve and watch a directory

Similar to

, the function
can both serve and watch a directory. If you are viewing an HTML file in the browser, it will be automatically refreshed whenever there are any changes in the directory (e.g. you added, deleted, or modified certain files in the directory).

Serve dynamic documents


, there are functions
, and
in this package to serve HTML files generated from R Markdown documents (via knitr or rmarkdown). R Markdown documents can be automatically re-compiled when their HTML output files are older than the corresponding source files, and HTML pages in the web browser can be automatically refreshed accordingly, so you can focus on writing R Markdown documents, and results will be updated on the fly in the web browser. This is even more useful when you write R Markdown documents in the RStudio IDE, because the HTML files are displayed in the RStudio viewer pane, and you can put the source document and its output side by side.

Jekyll with servr and knitr

Serve package vignettes

The function

can be used to serve R Markdown/HTML package vignettes. The HTML output files are generated and displayed in the web browser so you can preview the vignettes, and they will be cleaned up after they are loaded in the web browser to make sure your source package is clean.

Daemonized server

All server functions can be used in the daemonized mode, i.e., they can be non-blocking in the R session, which allows you to continue working in the R console after the server is launched. This mode can be set via the argument

daemon = TRUE
in most server functions. See
for more information.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.