RestRserve

R web API framework for building high-performance microservices and app backends

https://github.com/rexyai/restrserve

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.8%) to scientific vocabulary

Keywords

http-server openapi r rest-api swagger-ui
Last synced: 6 months ago · JSON representation

Repository

R web API framework for building high-performance microservices and app backends

Basic Info
  • Host: GitHub
  • Owner: rexyai
  • Language: R
  • Default Branch: master
  • Homepage: https://restrserve.org
  • Size: 3.68 MB
Statistics
  • Stars: 291
  • Watchers: 19
  • Forks: 34
  • Open Issues: 11
  • Releases: 0
Topics
http-server openapi r rest-api swagger-ui
Created about 8 years ago · Last pushed 11 months ago
Metadata Files
Readme Changelog Contributing

README.md

RestRserve

R build status CRAN status codecov License Lifecycle: stable gitter tinyverse <!-- badges: end -->

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: ```r library(RestRserve) app = Application$new()

app$addget( path = "/health", FUN = function(.req, .res) { .res$setbody("OK") })

app$addpost( path = "/addone", FUN = function(.req, .res) { result = list(x = .req$body$x + 1L) .res$setcontenttype("application/json") .res$setbody(result) })

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

Test it with curl:

```sh curl localhost:8080/health

OK

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

{"x":11}

```

Autocomplete

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

Learn RestRserve

Features

  • 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!

Installation

From CRAN

r install.packages("RestRserve", repos = "https://cloud.r-project.org")

Docker

Debian and Alpine based images are available on docker-hub -https://hub.docker.com/r/rexyai/restrserve/

sh docker pull rexyai/restrserve

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

sh docker pull rexyai/restrserve:1.2.0-alpine

Contributing

Guidelines for filing issues / pull requests - CONTRIBUTING.md.

Acknowledgements

  • Simon Urbanek (@s-u) for awesome Rserve and all the work on R itself and on his other packages
  • Jeff Allen (@trestletech) for his work on Swagger UI in plumber (from where we took inspiration for our implementation)
  • Brodie Gaslam (@brodieG) for help with understanding on how to get traceback from try-catch function calls. Also thanks Hadley Wickham (@hadley) for evaluate::try_capture_stack function which we use for this purpose.

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)

Related projects

Owner

  • Name: rexy.ai
  • Login: rexyai
  • Kind: organization
  • Email: hello@rexy.ai

GitHub Events

Total
  • Issues event: 6
  • Watch event: 15
  • Issue comment event: 8
  • Push event: 9
  • Pull request event: 4
  • Fork event: 3
  • Create event: 3
Last Year
  • Issues event: 6
  • Watch event: 15
  • Issue comment event: 8
  • Push event: 9
  • Pull request event: 4
  • Fork event: 3
  • Create event: 3

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 547
  • Total Committers: 10
  • Avg Commits per committer: 54.7
  • Development Distribution Score (DDS): 0.307
Past Year
  • Commits: 3
  • Committers: 2
  • Avg Commits per committer: 1.5
  • Development Distribution Score (DDS): 0.333
Top Committers
Name Email Commits
Dmitriy Selivanov s****y@g****m 379
Artem Klevtsov a****v@g****m 154
DavZim d****n@h****e 5
Ryan Hafen r****n@g****m 2
AbrJA a****s@o****x 2
Michael Chirico c****m@g****m 1
Jone Keat Lim j****t@g****m 1
Jan Gorecki j****i 1
Barret Schloerke b****t@r****m 1
Alassane Samba a****a@o****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 77
  • Total pull requests: 40
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 12 days
  • Total issue authors: 45
  • Total pull request authors: 10
  • Average comments per issue: 3.75
  • Average comments per pull request: 2.33
  • Merged pull requests: 40
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 3
  • Pull requests: 2
  • Average time to close issues: 4 months
  • Average time to close pull requests: 2 days
  • Issue authors: 3
  • Pull request authors: 2
  • Average comments per issue: 0.67
  • Average comments per pull request: 1.5
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • dselivanov (12)
  • richarddmorey (4)
  • hongooi73 (3)
  • rplati (3)
  • mattjvincent (3)
  • vikram-rawat (3)
  • longhua8800w (3)
  • mentik (2)
  • DavZim (2)
  • AbrJA (2)
  • andreas-ullrich (2)
  • Tartomas (2)
  • mrchypark (2)
  • sambaala (2)
  • rdatasculptor (2)
Pull Request Authors
  • dselivanov (20)
  • artemklevtsov (9)
  • DavZim (5)
  • yihui (2)
  • AbrJA (2)
  • hafen (2)
  • MichaelChirico (2)
  • jonekeat (1)
  • schloerke (1)
  • sambaala (1)
Top Labels
Issue Labels
bug (24) not-confirmed (22) question (20) docs (11) enhancement (7) core (6) FAQ (6) Rserve (3) done (3) help wanted (2) performance (2) discussion (2) low (2) not-reproducible (2) windows (1) usability (1)
Pull Request Labels
docs (1) core (1) WIP (1)

Packages

  • Total packages: 3
  • Total downloads:
    • cran 536 last-month
  • Total docker downloads: 20,358
  • Total dependent packages: 2
    (may contain duplicates)
  • Total dependent repositories: 20
    (may contain duplicates)
  • Total versions: 46
  • Total maintainers: 1
proxy.golang.org: github.com/rexyai/restrserve
  • Versions: 15
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.5%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago
proxy.golang.org: github.com/rexyai/RestRserve
  • Versions: 15
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.5%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago
cran.r-project.org: RestRserve

A Framework for Building HTTP API

  • Versions: 16
  • Dependent Packages: 2
  • Dependent Repositories: 20
  • Downloads: 536 Last month
  • Docker Downloads: 20,358
Rankings
Stargazers count: 1.6%
Forks count: 2.6%
Dependent repos count: 6.3%
Average: 8.4%
Docker downloads count: 12.6%
Downloads: 13.4%
Dependent packages count: 13.7%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.6.0 depends
  • R6 >= 2.4.0 imports
  • Rcpp >= 1.0.3 imports
  • Rserve >= 1.7.3 imports
  • checkmate >= 1.9.4 imports
  • digest >= 0.6.29 imports
  • jsonlite >= 1.6 imports
  • methods * imports
  • mime >= 0.7 imports
  • parallel * imports
  • uuid >= 0.1 imports
  • curl * suggests
  • knitr * suggests
  • lgr >= 0.3.2 suggests
  • lintr * suggests
  • rmarkdown * suggests
  • sys * suggests
  • tinytest >= 1.0.0 suggests
.github/workflows/test-coverage.yaml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • r-lib/actions/setup-pandoc master composite
  • r-lib/actions/setup-r master composite
.github/workflows/R-CMD-check.yaml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • actions/upload-artifact main composite
  • r-lib/actions/setup-pandoc v1 composite
  • r-lib/actions/setup-r v1 composite
.github/workflows/build-image-tag.yaml actions
  • actions/checkout v2 composite
  • docker/build-push-action v3 composite
  • docker/login-action v2 composite
  • docker/metadata-action v4 composite
.github/workflows/pkgdown.yaml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • r-lib/actions/setup-pandoc v1 composite
  • r-lib/actions/setup-r v1 composite
docker/Dockerfile docker
  • r-base 4.2.0 build