{"id":13736315,"url":"https://github.com/rstudio/plumber","last_synced_at":"2025-05-13T16:08:31.451Z","repository":{"id":33206542,"uuid":"36849200","full_name":"rstudio/plumber","owner":"rstudio","description":"Turn your R code into a web API.","archived":false,"fork":false,"pushed_at":"2025-03-11T18:32:48.000Z","size":21540,"stargazers_count":1418,"open_issues_count":124,"forks_count":263,"subscribers_count":51,"default_branch":"main","last_synced_at":"2025-05-03T02:49:17.879Z","etag":null,"topics":["api","api-server","plumber","r"],"latest_commit_sha":null,"homepage":"https://www.rplumber.io","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rstudio.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-06-04T05:09:10.000Z","updated_at":"2025-04-18T11:16:52.000Z","dependencies_parsed_at":"2023-02-14T15:16:02.025Z","dependency_job_id":"9f463e99-7236-46e9-8bca-6a564447f601","html_url":"https://github.com/rstudio/plumber","commit_stats":{"total_commits":502,"total_committers":43,"mean_commits":"11.674418604651162","dds":0.6195219123505976,"last_synced_commit":"e829af6a94380cb897441c1c56129504afb9564f"},"previous_names":["trestletech/plumber"],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Fplumber","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Fplumber/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Fplumber/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Fplumber/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rstudio","download_url":"https://codeload.github.com/rstudio/plumber/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253980052,"owners_count":21994042,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-server","plumber","r"],"created_at":"2024-08-03T03:01:19.444Z","updated_at":"2025-05-13T16:08:31.424Z","avatar_url":"https://github.com/rstudio.png","language":"R","readme":"# plumber \u003ca href='https://www.rplumber.io/'\u003e\u003cimg src='man/figures/logo.svg' align=\"right\" height=\"138.5\" style=\"margin:10px;\" /\u003e\u003c/a\u003e\n\n\u003c!-- badges: start --\u003e\n[![R build status](https://github.com/rstudio/plumber/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/rstudio/plumber/actions)\n[![CRAN version](https://www.r-pkg.org/badges/version/plumber)](https://www.r-pkg.org/pkg/plumber)\n[![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/plumber?color=brightgreen)](https://www.r-pkg.org/pkg/plumber)\n[![codecov](https://app.codecov.io/gh/rstudio/plumber/branch/main/graph/badge.svg)](https://app.codecov.io/gh/rstudio/plumber)\n[![RStudio community](https://img.shields.io/badge/community-plumber-blue?style=social\u0026logo=rstudio\u0026logoColor=75AADB)](https://forum.posit.co/tag/plumber)\n\u003c!-- badges: end --\u003e\n\nPlumber allows you to create a web API by merely decorating your existing R\nsource code with `roxygen2`-like comments. Take a look at an example.\n\n```r\n# plumber.R\n\n#* Echo back the input\n#* @param msg The message to echo\n#* @get /echo\nfunction(msg=\"\") {\n  list(msg = paste0(\"The message is: '\", msg, \"'\"))\n}\n\n#* Plot a histogram\n#* @serializer png\n#* @get /plot\nfunction() {\n  rand \u003c- rnorm(100)\n  hist(rand)\n}\n\n#* Return the sum of two numbers\n#* @param a The first number to add\n#* @param b The second number to add\n#* @post /sum\nfunction(a, b) {\n  as.numeric(a) + as.numeric(b)\n}\n```\n\nThese comments allow `plumber` to make your R functions available as API\nendpoints. You can use either `#*` as the prefix or `#'`, but we recommend the\nformer since `#'` will collide with `roxygen2`.\n\n```r\nlibrary(plumber)\n# 'plumber.R' is the location of the file shown above\npr(\"plumber.R\") %\u003e%\n  pr_run(port=8000)\n```\n\nYou can visit this URL using a browser or a terminal to run your R function and\nget the results. For instance\n`http://localhost:8000/plot` will show you a\nhistogram, and\n`http://localhost:8000/echo?msg=hello`\nwill echo back the 'hello' message you provided.\n\nHere we're using `curl` via a Mac/Linux terminal.\n\n```\n$ curl \"http://localhost:8000/echo\"\n {\"msg\":[\"The message is: ''\"]}\n$ curl \"http://localhost:8000/echo?msg=hello\"\n {\"msg\":[\"The message is: 'hello'\"]}\n```\n\nAs you might have guessed, the request's query string parameters are forwarded\nto the R function as arguments (as character strings).\n\n```\n$ curl --data \"a=4\u0026b=3\" \"http://localhost:8000/sum\"\n [7]\n```\n\nYou can also send your data as JSON:\n\n```\n$ curl -H \"Content-Type: application/json\" --data '{\"a\":4, \"b\":5}' http://localhost:8000/sum\n [9]\n```\n\n## Installation\n\nYou can install the latest stable version from CRAN using the following command:\n\n```r\ninstall.packages(\"plumber\")\n```\n\nIf you want to try out the latest development version, you can install it from GitHub.\n\n```r\nremotes::install_github(\"rstudio/plumber\")\nlibrary(plumber)\n```\n\n## Cheat Sheet\n\n\u003ca href=\"https://github.com/rstudio/cheatsheets/blob/main/plumber.pdf\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/rstudio/cheatsheets/main/pngs/thumbnails/plumber-cheatsheet-thumbs.png\" width=\"630\" height=\"252\" alt=\"plumber cheat sheet\"/\u003e\u003c/a\u003e\n\n## Hosting\n\nIf you're just getting started with hosting cloud servers, the\n[DigitalOcean](https://www.digitalocean.com) integration included in `plumber`\nwill be the best way to get started. You'll be able to get a server hosting your\ncustom API in just two R commands. To deploy to DigitalOcean, check out the\n`plumber` companion package [`plumberDeploy`](https://github.com/meztez/plumberDeploy).\n\n[Posit Connect](https://posit.co/products/enterprise/connect/) is a commercial\npublishing platform that enables R developers to easily publish a variety of R\ncontent types, including Plumber APIs. Additional documentation is available at\n\u003chttps://www.rplumber.io/articles/hosting.html#rstudio-connect-1\u003e.\n\nA couple of other approaches to hosting plumber are also made available:\n\n- PM2 - \u003chttps://www.rplumber.io/articles/hosting.html#pm2-1\u003e\n- Docker - \u003chttps://www.rplumber.io/articles/hosting.html#docker\u003e\n\n## Related Projects\n\n- [OpenCPU](https://www.opencpu.org/) - A server designed for hosting R APIs\n  with an eye towards scientific research.\n- [jug](http://bart6114.github.io/jug/index.html) - *(development discontinued)*\n  an R package similar to Plumber but uses a more programmatic approach to\n  constructing the API.\n","funding_links":[],"categories":["R","Backend"],"sub_categories":["API Frameworks"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frstudio%2Fplumber","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frstudio%2Fplumber","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frstudio%2Fplumber/lists"}