RestRserve is an R web API framework for building high-performance AND robust microservices and app backends. On UNIX-like systems and Rserve backend RestRserve handles requests in parallel: each request in a separate fork - credits go to Simon Urbanek.

Quick start

Creating application is as simple as:

app = Application$new()

  path = "/health", 
  FUN = function(.req, .res) {

  path = "/addone", 
  FUN = function(.req, .res) {
    result = list(x = .req$body$x + 1L)

backend = BackendRserve$new()
backend$start(app, http_port = 8080)

Test it with curl:

curl localhost:8080/health
# OK
curl -H "Content-Type: application/json" -d '{"x":10}' localhost:8080/addone
# {"x":11}


Using convenient .req, .res names for handler arguments allows to leverage autocomplete.

Learn RestRserve


  • Stable, easy to install, few dependencies
  • Concise and intuitive syntax
  • Well documented, comes with many examples - see inst/examples
  • Fully featured http server with the support for URL encoded and multipart forms
  • Build safe and secure applications - RestRserve supports https, provides building blocks for basic/token authentication
  • Raise meaningful http errors and allows to interrupt request handling from any place of the user code
  • Saves you from boilerplate code:
    • automatically decodes request body from the common formats
    • automatically encodes response body to the common formats
    • automatically parses URI templates (such as /get/{item_id})
    • helps to expose OpenAPI and Swagger/Redoc/Rapidoc UI
  • It is fast!



install.packages("RestRserve", repos = "")


Debian and Alpine based images are available on docker-hub -

docker pull rexyai/restrserve

You can also install specific version (and we encourage to do so):

docker pull rexyai/restrserve:1.2.0-alpine


Guidelines for filing issues / pull requests -


Known limitations

  • RestRserve is primarily tested on UNIX systems. While it works natively on Windows please don’t expect it to be as performant as on UNIX-like systems. If you really want to use it on Windows - consider to use Windows Subsystem for Linux.
  • Keep in mind that every request is handled in a separate process (fork from a parent R session). While this feature allows to handle requests in parallel it also restricts reuse of certain objects which are not fork-safe (notably database connections, rJava objects, etc)